git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@117325 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/accounting-manager-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/accounting-manager-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/gwt-user.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt/gwt-2.6.1/doc/javadoc/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/gwt-dev.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt/gwt-2.6.1/doc/javadoc/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA.jar" sourcepath="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||||
|
<classpathentry kind="output" path="target/accounting-manager-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>accounting-manager</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
filesCopiedToWebInfLib=
|
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
jarsExcludedFromWebInfLib=
|
||||||
|
lastWarOutDir=/home/giancarlo/workspace2/accounting-manager/target
|
||||||
|
warSrcDir=
|
||||||
|
warSrcDirIsOutput=false
|
|
@ -0,0 +1,6 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="tabular-data-manager">
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
<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>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<root>
|
||||||
|
<facet id="jst.jaxrs">
|
||||||
|
<node name="libprov">
|
||||||
|
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||||
|
</node>
|
||||||
|
</facet>
|
||||||
|
</root>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1,2 @@
|
||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||||
|
<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="AccountingManager.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 AccountingManager.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>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Resource>
|
||||||
|
<ID></ID>
|
||||||
|
<Type>Service</Type>
|
||||||
|
<Profile>
|
||||||
|
<Description>accounting-manager manages accounting informations</Description>
|
||||||
|
<Class>PortletsAdmin</Class>
|
||||||
|
<Name>accounting-manager</Name>
|
||||||
|
<Version>0.0.1-SNAPSHOT</Version>
|
||||||
|
<Packages>
|
||||||
|
<Software>
|
||||||
|
<Description>accounting-manager manages accounting informations</Description>
|
||||||
|
<Name>accounting-manager</Name>
|
||||||
|
<Version>0.0.1-SNAPSHOT</Version>
|
||||||
|
<MavenCoordinates>
|
||||||
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
|
<artifactId>accounting-manager</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</MavenCoordinates>
|
||||||
|
<Type>webapplication</Type>
|
||||||
|
<Files>
|
||||||
|
<File>accounting-manager-0.0.1-SNAPSHOT.war</File>
|
||||||
|
</Files>
|
||||||
|
</Software>
|
||||||
|
</Packages>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
gCube System - License
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||||
|
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||||
|
implied warranty is given for its use, quality or fitness for a particular case.
|
|
@ -0,0 +1 @@
|
||||||
|
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
|
@ -0,0 +1,48 @@
|
||||||
|
The gCube System - accounting-manager
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2)
|
||||||
|
|
||||||
|
Authors
|
||||||
|
-------
|
||||||
|
|
||||||
|
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa,
|
||||||
|
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
||||||
|
|
||||||
|
|
||||||
|
Version and Release Date
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
v. 0.0.1-SNAPSHOT (2015-04-30)
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
accounting-manager manages accounting informations
|
||||||
|
|
||||||
|
|
||||||
|
Download information
|
||||||
|
--------------------
|
||||||
|
Source code is available from SVN:
|
||||||
|
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager
|
||||||
|
|
||||||
|
Binaries can be downloaded from:
|
||||||
|
http://software.d4science.research-infrastructures.eu/
|
||||||
|
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
accounting-manager manages accounting informations
|
||||||
|
|
||||||
|
Documentation is available on-line from the Projects Documentation Wiki:
|
||||||
|
https://gcube.wiki.gcube-system.org/gcube/index.php/Accounting_Manager
|
||||||
|
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
---------
|
||||||
|
|
||||||
|
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets.admin.accounting-manager.0-0-1" date="2015-09-01">
|
||||||
|
<Change>First Release</Change>
|
||||||
|
</Changeset>
|
||||||
|
</ReleaseNotes>
|
|
@ -0,0 +1 @@
|
||||||
|
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager
|
|
@ -0,0 +1,441 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>maven-parent</artifactId>
|
||||||
|
<groupId>org.gcube.tools</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- POM file generated with GWT webAppCreator -->
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
|
<artifactId>accounting-manager</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
<name>accounting-manager</name>
|
||||||
|
<description>accounting-manager manages accounting informations</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>Giancarlo Panichi</name>
|
||||||
|
<email>g.panichi@isti.cnr.it</email>
|
||||||
|
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
|
||||||
|
<roles>
|
||||||
|
<role>architect</role>
|
||||||
|
<role>developer</role>
|
||||||
|
</roles>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||||
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
<release.date>2015-04-30</release.date>
|
||||||
|
<wikiurl>https://gcube.wiki.gcube-system.org/gcube/index.php/Accounting_Manager</wikiurl>
|
||||||
|
<templatesDirectory>templates</templatesDirectory>
|
||||||
|
<distroDirectory>distro</distroDirectory>
|
||||||
|
<configDirectory>config</configDirectory>
|
||||||
|
|
||||||
|
<!-- GWT configuration -->
|
||||||
|
<gwtVersion>2.6.1</gwtVersion>
|
||||||
|
<gwtLogVersion>3.3.2</gwtLogVersion>
|
||||||
|
<gxtVersion>3.1.1</gxtVersion>
|
||||||
|
<!-- <gxt2Version>2.6.1</gxt2Version> -->
|
||||||
|
|
||||||
|
|
||||||
|
<KEYS>${env.KEYS}</KEYS>
|
||||||
|
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>localRun</id>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- GWT -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-user</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-servlet</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-dev</artifactId>
|
||||||
|
<version>${gwtVersion}</version> </dependency> -->
|
||||||
|
|
||||||
|
<!-- GXT 3 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sencha.gxt</groupId>
|
||||||
|
<artifactId>gxt</artifactId>
|
||||||
|
<version>${gxtVersion}</version>
|
||||||
|
</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> -->
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sencha.gxt</groupId>
|
||||||
|
<artifactId>gxt-chart</artifactId>
|
||||||
|
<version>${gxtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.highcharts4gwt</groupId>
|
||||||
|
<artifactId>highcharts</artifactId>
|
||||||
|
<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>
|
||||||
|
<groupId>javax.portlet</groupId>
|
||||||
|
<artifactId>portlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- PORTAL -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
<!-- <version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version> -->
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>custom-portal-handler</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslcore</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>accesslogger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Social -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslsocial</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- GCube Widgets -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>gcube-widgets</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- WSLT dependencies <dependency> <groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
<artifactId>workspace-light-tree</artifactId> <version>[2.13.1-SNAPSHOT,
|
||||||
|
3.0.0-SNAPSHOT)</version> </dependency> <dependency> <groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library</artifactId> <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>provided</scope> </dependency> -->
|
||||||
|
|
||||||
|
<!-- Session Checker -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
<artifactId>session-checker</artifactId>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- Accounting Analytics -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.accounting</groupId>
|
||||||
|
<artifactId>accounting-analytics</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Accounting Persistence-Couchdb -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.accounting</groupId>
|
||||||
|
<artifactId>accounting-analytics-persistence-couchdb</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- LOGGING -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
|
<artifactId>gwt-log</artifactId>
|
||||||
|
<version>${gwtLogVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- JUnit TEST -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
|
||||||
|
<!-- Generate compiled stuff in the folder used for developing mode -->
|
||||||
|
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<!-- GWT Maven Plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>gwt-maven-plugin</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<configuration>
|
||||||
|
<extraJvmArgs>-Xmx1024M -Xss1024k -Dgwt.compiler.localWorkers=1</extraJvmArgs>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<runTarget>AccountingManager.html</runTarget>
|
||||||
|
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||||
|
<module>org.gcube.portlets.admin.accountingmanager.AccountingManager</module>
|
||||||
|
<!-- <compileSourcesArtifacts> <artifact>com.github.highcharts4gwt:highcharts</artifact>
|
||||||
|
</compileSourcesArtifacts> -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Copy static web files before executing gwt:run -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<!--<goals> <goal>exploded</goal> </goals> -->
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<webappDirectory>${webappDirectory}</webappDirectory>
|
||||||
|
<warName>${project.build.finalName}</warName>
|
||||||
|
|
||||||
|
<!-- Include static jar into WEB-INF/lib -->
|
||||||
|
<!-- <webResources> <resource> <directory>lib</directory> <includes>
|
||||||
|
<include>*.jar</include> </includes> <targetPath>WEB-INF/lib</targetPath>
|
||||||
|
</resource> </webResources> -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Maven Surefire Plugin for Test -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.16</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>false</skipTests>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit47</artifactId>
|
||||||
|
<version>2.16</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Maven -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-profile</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${configDirectory}</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${templatesDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>profile.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>copy-distro-resources</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${distroDirectory}</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${templatesDirectory}</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>profile.xml</exclude>
|
||||||
|
<exclude>descriptor.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<configuration>
|
||||||
|
<filesets>
|
||||||
|
<fileset>
|
||||||
|
<directory>${distroDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<followSymlinks>false</followSymlinks>
|
||||||
|
</fileset>
|
||||||
|
<fileset>
|
||||||
|
<directory>${configDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<followSymlinks>false</followSymlinks>
|
||||||
|
</fileset>
|
||||||
|
</filesets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>${templatesDirectory}/descriptor.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
<finalName>${project.build.finalName}</finalName>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='AccountingManager'>
|
||||||
|
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
<inherits name="com.google.gwt.http.HTTP" />
|
||||||
|
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
|
||||||
|
|
||||||
|
<!-- <inherits name='com.extjs.gxt.ui.GXT' /> -->
|
||||||
|
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||||
|
|
||||||
|
<!-- Add this for using GXT charts -->
|
||||||
|
<inherits name='com.sencha.gxt.chart.Chart' />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- GXT Theme -->
|
||||||
|
<!-- <inherits name='com.sencha.gxt.theme.blue.Blue' /> -->
|
||||||
|
<!-- <inherits name='com.sencha.gxt.theme.gray.Gray' /> -->
|
||||||
|
<!-- Be sure to include Neptunes gxt-theme-neptune.jar in the classpath -->
|
||||||
|
<inherits name='com.sencha.gxt.theme.neptune.Theme' />
|
||||||
|
|
||||||
|
<!-- <inherits name="com.google.gwt.logging.Logging" /> -->
|
||||||
|
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||||
|
|
||||||
|
<inherits name="com.google.gwt.resources.Resources" />
|
||||||
|
|
||||||
|
<!--<inherits name="org.moxieapps.gwt.highcharts.Highcharts"/> -->
|
||||||
|
<inherits name='com.github.highcharts4gwt.highcharts' />
|
||||||
|
|
||||||
|
|
||||||
|
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Specify the app entry point class. -->
|
||||||
|
<entry-point class='org.gcube.portlets.admin.accountingmanager.client.AccountingManager' />
|
||||||
|
|
||||||
|
<!-- <set-configuration-property name="locale.cookie" value="AMLangCookie"
|
||||||
|
/> <set-configuration-property name="locale.queryparam" value="AMLang" />
|
||||||
|
<set-configuration-property name="locale.usemeta" value="Y" /> <set-configuration-property
|
||||||
|
name="locale.useragent" value="Y" /> <set-configuration-property name="locale.searchorder"
|
||||||
|
value="cookie,queryparam,meta,useragent" /> <extend-property name="locale"
|
||||||
|
values="en" /> <extend-property name="locale" values="it" /> <extend-property
|
||||||
|
name="locale" values="es" /> <set-property name="locale" value="en, it, es"
|
||||||
|
/> <set-property-fallback name="locale" value="en" /> -->
|
||||||
|
|
||||||
|
<!-- <set-property name="log_DivLogger" value="ENABLED" /> <set-property
|
||||||
|
name="log_ConsoleLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
|
||||||
|
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
|
||||||
|
<set-property name="log_DivLogger" value="DISABLED" />
|
||||||
|
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||||
|
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||||
|
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,144 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.filters.FiltersPanel;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.maindata.MainDataPanel;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.menu.AccountingManagerMenu;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerService;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.Viewport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingManager implements EntryPoint {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final String JSP_TAG_ID = "amp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final AccountingManagerServiceAsync accountingManagerService = GWT
|
||||||
|
.create(AccountingManagerService.class);
|
||||||
|
|
||||||
|
// Main Panel
|
||||||
|
private static BorderLayoutContainer mainPanelLayout;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public void onModuleLoad() {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Install an UncaughtExceptionHandler which will produce
|
||||||
|
* <code>FATAL</code> log messages
|
||||||
|
*/
|
||||||
|
Log.setUncaughtExceptionHandler();
|
||||||
|
|
||||||
|
// use deferred command to catch initialization exceptions in
|
||||||
|
// onModuleLoad2
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
public void execute() {
|
||||||
|
loadMainPanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadMainPanel() {
|
||||||
|
AccountingManagerResources.INSTANCE.accountingManagerCSS().ensureInjected();
|
||||||
|
//ScriptInjector.fromString(AccountingManagerResources.INSTANCE.jqueryJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
||||||
|
AccountingManagerController controller = new AccountingManagerController();
|
||||||
|
EventBus eventBus = controller.getEventBus();
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
mainPanelLayout = new BorderLayoutContainer();
|
||||||
|
mainPanelLayout.setId("mainPanelLayout");
|
||||||
|
mainPanelLayout.setBorders(false);
|
||||||
|
mainPanelLayout.getElement().getStyle().setBackgroundColor("rgb(3, 126, 207)");
|
||||||
|
|
||||||
|
|
||||||
|
//Main
|
||||||
|
MainDataPanel mainDataPanel=new MainDataPanel(eventBus);
|
||||||
|
MarginData mainData = new MarginData(new Margins(2));
|
||||||
|
mainPanelLayout.setCenterWidget(mainDataPanel, mainData);
|
||||||
|
|
||||||
|
//Menu
|
||||||
|
AccountingManagerMenu accountingManagerMenu=new AccountingManagerMenu(eventBus);
|
||||||
|
|
||||||
|
BorderLayoutData menuData = new BorderLayoutData(58);
|
||||||
|
menuData.setMargins(new Margins(5));
|
||||||
|
menuData.setCollapsible(false);
|
||||||
|
menuData.setSplit(false);
|
||||||
|
|
||||||
|
mainPanelLayout.setNorthWidget(accountingManagerMenu, menuData);
|
||||||
|
|
||||||
|
//Filters
|
||||||
|
FiltersPanel filtersPanel=new FiltersPanel(eventBus);
|
||||||
|
BorderLayoutData westData = new BorderLayoutData(310);
|
||||||
|
westData.setCollapsible(true);
|
||||||
|
westData.setSplit(false);
|
||||||
|
westData.setFloatable(false);
|
||||||
|
westData.setCollapseMini(true);
|
||||||
|
westData.setMargins(new Margins(2, 7, 2, 7));
|
||||||
|
westData.setCollapseHidden(true);
|
||||||
|
mainPanelLayout.setWestWidget(filtersPanel, westData);
|
||||||
|
filtersPanel.expand();
|
||||||
|
filtersPanel.enable();
|
||||||
|
|
||||||
|
bind(mainPanelLayout);
|
||||||
|
controller.setMainPanelLayout(mainPanelLayout);
|
||||||
|
controller.restoreUISession();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bind(BorderLayoutContainer mainWidget) {
|
||||||
|
try {
|
||||||
|
RootPanel root = RootPanel.get(JSP_TAG_ID);
|
||||||
|
Log.info("Root Panel: " + root);
|
||||||
|
if (root == null) {
|
||||||
|
Log.info("Div with id " + JSP_TAG_ID
|
||||||
|
+ " not found, starting in dev mode");
|
||||||
|
Viewport viewport = new Viewport();
|
||||||
|
viewport.setWidget(mainWidget);
|
||||||
|
viewport.onResize();
|
||||||
|
RootPanel.get().add(viewport);
|
||||||
|
} else {
|
||||||
|
Log.info("Application div with id " + JSP_TAG_ID
|
||||||
|
+ " found, starting in portal mode");
|
||||||
|
PortalViewport viewport = new PortalViewport();
|
||||||
|
Log.info("Created Viewport");
|
||||||
|
viewport.setEnableScroll(false);
|
||||||
|
viewport.setWidget(mainWidget);
|
||||||
|
Log.info("Set Widget");
|
||||||
|
Log.info("getOffsetWidth(): " + viewport.getOffsetWidth());
|
||||||
|
Log.info("getOffsetHeight(): " + viewport.getOffsetHeight());
|
||||||
|
viewport.onResize();
|
||||||
|
root.add(viewport);
|
||||||
|
Log.info("Added viewport to root");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.error("Error in attach viewport:" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,304 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.AccountingMenuEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.FiltersChangeEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.SessionExpiredEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.StateChangeEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.UIStateEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.monitor.AccountingMonitor;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingState;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.SessionExpiredType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.StateChangeType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.UIStateType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
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.exception.AccountingManagerSessionExpiredException;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||||
|
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
|
import com.google.gwt.i18n.client.LocaleInfo;
|
||||||
|
import com.google.gwt.user.client.Cookies;
|
||||||
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingManagerController {
|
||||||
|
|
||||||
|
private SimpleEventBus eventBus;
|
||||||
|
private UserInfo userInfo;
|
||||||
|
private AccountingState accountingState;
|
||||||
|
private AccountingType accountingType;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private BorderLayoutContainer mainPanel;
|
||||||
|
private AccountingMonitor accountingMonitor;
|
||||||
|
|
||||||
|
public AccountingManagerController() {
|
||||||
|
eventBus = new SimpleEventBus();
|
||||||
|
accountingType = AccountingType.STORAGE;
|
||||||
|
accountingState = new AccountingState();
|
||||||
|
AccountingStateData accountingStateData = new AccountingStateData(
|
||||||
|
accountingType, null, null);
|
||||||
|
accountingState.setState(accountingType, accountingStateData);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
callHello();
|
||||||
|
checkSession();
|
||||||
|
bindToEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkSession() {
|
||||||
|
// if you do not need to something when the session expire
|
||||||
|
CheckSession.getInstance().startPolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sessionExpiredShow() {
|
||||||
|
CheckSession.showLogoutDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the eventBus
|
||||||
|
*/
|
||||||
|
public EventBus getEventBus() {
|
||||||
|
return eventBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainPanelLayout(BorderLayoutContainer mainPanel) {
|
||||||
|
this.mainPanel = mainPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void callHello() {
|
||||||
|
AccountingManagerServiceAsync.INSTANCE
|
||||||
|
.hello(new AsyncCallback<UserInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Log.info("No valid user found: " + caught.getMessage());
|
||||||
|
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||||
|
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());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sessionExpiredShowDelayed() {
|
||||||
|
Timer timeoutTimer = new Timer() {
|
||||||
|
public void run() {
|
||||||
|
sessionExpiredShow();
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
int TIMEOUT = 3; // 3 second timeout
|
||||||
|
|
||||||
|
timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkLocale() {
|
||||||
|
String[] locales = LocaleInfo.getAvailableLocaleNames();
|
||||||
|
|
||||||
|
for (String locale : locales) {
|
||||||
|
Log.debug("Locale avaible:" + locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
||||||
|
.getLocaleCookieName());
|
||||||
|
Log.debug(Constants.AM_LANG_COOKIE + ":" + currentLocaleCookie);
|
||||||
|
|
||||||
|
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
||||||
|
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void changeLanguage(String localeName) {
|
||||||
|
Date now = new Date();
|
||||||
|
long nowLong = now.getTime();
|
||||||
|
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
||||||
|
now.setTime(nowLong);
|
||||||
|
String cookieLang = Cookies.getCookie(Constants.AM_LANG_COOKIE);
|
||||||
|
if (cookieLang != null) {
|
||||||
|
Cookies.removeCookie(Constants.AM_LANG_COOKIE);
|
||||||
|
}
|
||||||
|
Cookies.setCookie(Constants.AM_LANG_COOKIE, localeName, now);
|
||||||
|
com.google.gwt.user.client.Window.Location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
public void restoreUISession() {
|
||||||
|
checkLocale();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind Controller to events on bus
|
||||||
|
private void bindToEvents() {
|
||||||
|
eventBus.addHandler(SessionExpiredEvent.TYPE,
|
||||||
|
new SessionExpiredEvent.SessionExpiredEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionExpired(SessionExpiredEvent event) {
|
||||||
|
Log.debug("Catch Event SessionExpiredEvent");
|
||||||
|
doSessionExpiredCommand(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(AccountingMenuEvent.TYPE,
|
||||||
|
new AccountingMenuEvent.AccountingMenuEventHandler() {
|
||||||
|
|
||||||
|
public void onMenu(AccountingMenuEvent event) {
|
||||||
|
Log.debug("Catch Event AccountingMenuEvent");
|
||||||
|
doMenuCommand(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(FiltersChangeEvent.TYPE,
|
||||||
|
new FiltersChangeEvent.FiltersChangeEventHandler() {
|
||||||
|
|
||||||
|
public void onFiltersChange(FiltersChangeEvent event) {
|
||||||
|
Log.debug("Catch Event FiltersChangeEvent");
|
||||||
|
doFiltersChangeCommand(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doMenuCommand(AccountingMenuEvent event) {
|
||||||
|
AccountingStateData accountingStateData = null;
|
||||||
|
if (event == null || event.getAccountingType() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.getAccountingType()) {
|
||||||
|
case PORTLET:
|
||||||
|
case SERVICE:
|
||||||
|
case STORAGE:
|
||||||
|
case TASK:
|
||||||
|
case JOB:
|
||||||
|
Log.debug("AccountingType: "+event.getAccountingType());
|
||||||
|
accountingType = event.getAccountingType();
|
||||||
|
accountingStateData = accountingState.getState(event
|
||||||
|
.getAccountingType());
|
||||||
|
if (accountingStateData == null) {
|
||||||
|
accountingStateData = new AccountingStateData(
|
||||||
|
event.getAccountingType(), null, null);
|
||||||
|
accountingState.setState(event.getAccountingType(),
|
||||||
|
accountingStateData);
|
||||||
|
}
|
||||||
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||||
|
StateChangeType.Restore, accountingStateData);
|
||||||
|
eventBus.fireEvent(stateChangeEvent);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doFiltersChangeCommand(FiltersChangeEvent event) {
|
||||||
|
if (event == null || event.getFiltersChangeType() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.getFiltersChangeType()) {
|
||||||
|
case Update:
|
||||||
|
SeriesRequest seriesRequest = event.getSeriesRequest();
|
||||||
|
AccountingStateData accountingStateData = accountingState
|
||||||
|
.getState(accountingType);
|
||||||
|
if (accountingStateData != null) {
|
||||||
|
accountingMonitor=new AccountingMonitor();
|
||||||
|
accountingStateData.setSeriesRequest(seriesRequest);
|
||||||
|
accountingState.setState(accountingType, accountingStateData);
|
||||||
|
callSeriesRequest(accountingStateData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void callSeriesRequest(final AccountingStateData accountingStateData) {
|
||||||
|
|
||||||
|
AccountingManagerServiceAsync.INSTANCE.getSeries(
|
||||||
|
accountingStateData.getAccountingType(),
|
||||||
|
accountingStateData.getSeriesRequest(),
|
||||||
|
new AsyncCallback<SeriesResponse>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(SeriesResponse seriesResponse) {
|
||||||
|
Log.debug("SeriesResponse: " + seriesResponse);
|
||||||
|
accountingStateData.setSeriesResponse(seriesResponse);
|
||||||
|
accountingState.setState(accountingType,
|
||||||
|
accountingStateData);
|
||||||
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||||
|
StateChangeType.Update, accountingStateData);
|
||||||
|
eventBus.fireEvent(stateChangeEvent);
|
||||||
|
accountingMonitor.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
accountingMonitor.hide();
|
||||||
|
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error("Error:" + caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doSessionExpiredCommand(SessionExpiredEvent event) {
|
||||||
|
Log.debug("Session Expired Event: " + event.getSessionExpiredType());
|
||||||
|
sessionExpiredShow();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private void asyncCodeLoadingFailed(Throwable reason) {
|
||||||
|
Log.error("Async code loading failed", reason);
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,179 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.sencha.gxt.core.client.dom.XDOM;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.Viewport.ViewportAppearance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PortalViewport extends SimpleContainer {
|
||||||
|
|
||||||
|
protected int rightScrollBarSize = 17;
|
||||||
|
|
||||||
|
protected boolean enableScroll;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a viewport layout container with the default appearance.
|
||||||
|
*/
|
||||||
|
public PortalViewport() {
|
||||||
|
this(GWT.<ViewportAppearance> create(ViewportAppearance.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a viewport layout container with the specified appearance.
|
||||||
|
*
|
||||||
|
* @param appearance
|
||||||
|
* the appearance of the viewport layout container
|
||||||
|
*/
|
||||||
|
public PortalViewport(ViewportAppearance appearance) {
|
||||||
|
super(true);
|
||||||
|
try {
|
||||||
|
|
||||||
|
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||||
|
appearance.render(sb);
|
||||||
|
XElement element=XDOM.create(sb.toSafeHtml());
|
||||||
|
setElement((Element)element);
|
||||||
|
monitorWindowResize = true;
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
getFocusSupport().setIgnore(false);
|
||||||
|
resize();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("PortalViewport: constructor error "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if window scrolling is enabled.
|
||||||
|
*
|
||||||
|
* @return true if window scrolling is enabled
|
||||||
|
*/
|
||||||
|
public boolean isEnableScroll() {
|
||||||
|
return enableScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether window scrolling is enabled.
|
||||||
|
*
|
||||||
|
* @param enableScroll
|
||||||
|
* true to enable window scrolling
|
||||||
|
*/
|
||||||
|
public void setEnableScroll(boolean enableScroll) {
|
||||||
|
this.enableScroll = enableScroll;
|
||||||
|
Window.enableScrolling(enableScroll);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the rightScrollBarSize
|
||||||
|
*/
|
||||||
|
public int getRightScrollBarSize() {
|
||||||
|
return rightScrollBarSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rightScrollBarSize
|
||||||
|
* the rightScrollBarSize to set
|
||||||
|
*/
|
||||||
|
public void setRightScrollBarSize(int rightScrollBarSize) {
|
||||||
|
this.rightScrollBarSize = rightScrollBarSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttach() {
|
||||||
|
super.onAttach();
|
||||||
|
setEnableScroll(enableScroll);
|
||||||
|
resize();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void resize() {
|
||||||
|
int viewWidth;
|
||||||
|
if(enableScroll){
|
||||||
|
viewWidth= calculateWidth() - rightScrollBarSize;
|
||||||
|
} else {
|
||||||
|
viewWidth = calculateWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
int viewHeight = calculateHeight();
|
||||||
|
Log.info("AM resize viewWidth: " + viewWidth + " viewHeight: "
|
||||||
|
+ viewHeight + " clientWidth: " + Window.getClientWidth()
|
||||||
|
+ " clientHeight: " + Window.getClientHeight());
|
||||||
|
try {
|
||||||
|
setPixelSize(viewWidth, viewHeight);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("PortalViewport: error in resize() at setPixelSize "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onWindowResize(int width, int height) {
|
||||||
|
int viewWidth = calculateWidth();
|
||||||
|
int viewHeight = calculateHeight();
|
||||||
|
Log.trace("AM onWindowResize viewWidth: " + viewWidth
|
||||||
|
+ " viewHeight: " + viewHeight + " clientWidth: "
|
||||||
|
+ Window.getClientWidth() + " clientHeight: "
|
||||||
|
+ Window.getClientHeight());
|
||||||
|
setPixelSize(viewWidth, viewHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update window size
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* public void resize(){
|
||||||
|
*
|
||||||
|
* RootPanel workspace = RootPanel.get("tdp");
|
||||||
|
*
|
||||||
|
* int topBorder = workspace.getAbsoluteTop();
|
||||||
|
*
|
||||||
|
* int leftBorder = workspace.getAbsoluteLeft();
|
||||||
|
*
|
||||||
|
* int footer = 85;
|
||||||
|
*
|
||||||
|
* int rootHeight = (Window.getClientHeight() - topBorder - 4 - footer);// -
|
||||||
|
* ((footer == null)?0:(footer.getOffsetHeight()-15));
|
||||||
|
*
|
||||||
|
* if (rootHeight < 550) rootHeight = 550;
|
||||||
|
*
|
||||||
|
* int rootWidth = Window.getClientWidth() - 2* leftBorder; //-
|
||||||
|
* rightScrollBar;
|
||||||
|
*
|
||||||
|
* System.out.println("New workspace dimension Height: "+rootHeight+" Width: "
|
||||||
|
* +rootWidth);
|
||||||
|
*
|
||||||
|
* this.setHeight(rootHeight); this.setWidth(rootWidth); }
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected int calculateWidth() {
|
||||||
|
int leftBorder = getAbsoluteLeft();
|
||||||
|
Log.info("AM width: "
|
||||||
|
+ String.valueOf(Window.getClientWidth() - 2 * leftBorder));
|
||||||
|
return Window.getClientWidth() - 2 * leftBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int calculateHeight() {
|
||||||
|
int topBorder = getAbsoluteTop();
|
||||||
|
Log.info("AM height: "
|
||||||
|
+ String.valueOf(Window.getClientHeight() - topBorder - 34));
|
||||||
|
return Window.getClientHeight() - topBorder - 34;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,284 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.carousel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.graphics.Vector2D;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.event.dom.client.MouseUpEvent;
|
||||||
|
import com.google.gwt.event.dom.client.MouseUpHandler;
|
||||||
|
import com.google.gwt.event.dom.client.MouseWheelEvent;
|
||||||
|
import com.google.gwt.event.dom.client.MouseWheelHandler;
|
||||||
|
import com.google.gwt.user.client.Event;
|
||||||
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.sencha.gxt.chart.client.draw.DrawComponent;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.ImageSprite;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.Sprite;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteOutEvent;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteOutEvent.SpriteOutHandler;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteOverEvent;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteOverEvent.SpriteOverHandler;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteSelectionEvent;
|
||||||
|
import com.sencha.gxt.chart.client.draw.sprite.SpriteSelectionEvent.SpriteSelectionHandler;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CarouselPanel extends FramedPanel {
|
||||||
|
private static final int WIDTH = 1024;
|
||||||
|
private static final int HEIGHT = 768;
|
||||||
|
private DrawComponent paint;
|
||||||
|
private ArrayList<ImageSprite> sprites;
|
||||||
|
private Timer mouseTimer;
|
||||||
|
private Sprite currentSprite;
|
||||||
|
private Sprite activeSprite;
|
||||||
|
|
||||||
|
private Vector2D startPosition;
|
||||||
|
private Vector2D currentPosition;
|
||||||
|
private Vector2D endPosition;
|
||||||
|
private Vector2D displacement;
|
||||||
|
|
||||||
|
public CarouselPanel() {
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
unmask();
|
||||||
|
drawInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setResize(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create() {
|
||||||
|
VerticalLayoutContainer layout = new VerticalLayoutContainer();
|
||||||
|
add(layout);
|
||||||
|
|
||||||
|
// Paint
|
||||||
|
paint = new DrawComponent();
|
||||||
|
|
||||||
|
paint.setLayoutData(new VerticalLayoutData(1, 1));
|
||||||
|
|
||||||
|
paint.addSpriteSelectionHandler(new SpriteSelectionHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpriteSelect(SpriteSelectionEvent event) {
|
||||||
|
activeSprite(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
paint.addSpriteOverHandler(new SpriteOverHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpriteOver(SpriteOverEvent event) {
|
||||||
|
spriteOver(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
paint.addSpriteOutHandler(new SpriteOutHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpriteLeave(SpriteOutEvent event) {
|
||||||
|
spriteLeave(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
paint.addDomHandler(new MouseUpHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMouseUp(MouseUpEvent event) {
|
||||||
|
spriteMouseUp(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
}, MouseUpEvent.getType());
|
||||||
|
|
||||||
|
paint.addDomHandler(new MouseWheelHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMouseWheel(MouseWheelEvent event) {
|
||||||
|
spriteMouseWheel(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
}, MouseWheelEvent.getType());
|
||||||
|
|
||||||
|
layout.add(paint, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawInit() {
|
||||||
|
|
||||||
|
addSprites();
|
||||||
|
|
||||||
|
// chartSprite.setX(0);
|
||||||
|
// chartSprite.setY(0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Log.debug("chartImageResource width:" + chartImageResource.getWidth()
|
||||||
|
* + " height:" + chartImageResource.getHeight()); fitScale = new
|
||||||
|
* Vector2D(new Double(DRAW_WIDTH_INT) / chartImageResource.getWidth(),
|
||||||
|
* new Double(DRAW_HEIGHT_INT) / chartImageResource.getHeight());
|
||||||
|
* chartDimension = new Vector2D(chartImageResource.getWidth(),
|
||||||
|
* chartImageResource.getHeight());
|
||||||
|
*
|
||||||
|
* Log.debug("Offset width:" + DRAW_WIDTH_INT + " height:" +
|
||||||
|
* DRAW_HEIGHT_INT); Log.debug("Fit Scale: " + fitScale);
|
||||||
|
* Log.debug("Chart Dimension: " + chartDimension);
|
||||||
|
* chartSprite.setScaling(new Scaling(fitScale.getX(),
|
||||||
|
* fitScale.getY()));
|
||||||
|
*
|
||||||
|
* chartScale = fitScale.copy(); chartTranslation = new Vector2D();
|
||||||
|
*/
|
||||||
|
paint.redrawSurfaceForced();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSprites() {
|
||||||
|
sprites = new ArrayList<ImageSprite>();
|
||||||
|
sprites.add(new ImageSprite(AccountingManagerResources.INSTANCE
|
||||||
|
.accountingStorage128()));
|
||||||
|
|
||||||
|
for (ImageSprite sprite : sprites) {
|
||||||
|
paint.addSprite(sprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createMouseTimer() {
|
||||||
|
mouseTimer = new Timer() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// if (activeSprite != null) {
|
||||||
|
// if (activeSprite == chartSprite) {
|
||||||
|
// actionOnChartSpriteWhenMouseLeftDown();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Schedule the timer to run once in 300 milliseconds.
|
||||||
|
mouseTimer.scheduleRepeating(200);
|
||||||
|
Log.debug("MouseTimer Start");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void activeSprite(SpriteSelectionEvent event) {
|
||||||
|
Event browseEvent = event.getBrowserEvent();
|
||||||
|
browseEvent.preventDefault();
|
||||||
|
Log.debug("Active Position: " + browseEvent.getClientX() + ", "
|
||||||
|
+ browseEvent.getClientY());
|
||||||
|
activeSprite = event.getSprite();
|
||||||
|
startPosition = new Vector2D(browseEvent.getClientX(),
|
||||||
|
browseEvent.getClientY());
|
||||||
|
if (activeSprite != null) {
|
||||||
|
for (ImageSprite sprite : sprites) {
|
||||||
|
if (activeSprite == sprite) {
|
||||||
|
/*
|
||||||
|
* if (activeOperation.compareTo(Operation.ZOOMIN) == 0 ||
|
||||||
|
* activeOperation.compareTo(Operation.ZOOMOUT) == 0) {
|
||||||
|
* actionOnChartSpriteWhenMouseLeftDown();
|
||||||
|
* comboZoomLevel.reset(); comboZoomLevel.redraw();
|
||||||
|
* createMouseTimer(); }
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void spriteMouseUp(MouseUpEvent event) {
|
||||||
|
Log.debug("Deactive Position: " + event.getClientX() + ", "
|
||||||
|
+ event.getClientY());
|
||||||
|
endPosition = new Vector2D(event.getClientX(), event.getClientY());
|
||||||
|
displacement = startPosition.sub(endPosition);
|
||||||
|
activeSprite = null;
|
||||||
|
|
||||||
|
if (mouseTimer != null) {
|
||||||
|
mouseTimer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void spriteLeave(SpriteOutEvent event) {
|
||||||
|
Event browseEvent = event.getBrowserEvent();
|
||||||
|
Log.debug("Leave Position: " + browseEvent.getClientX() + ", "
|
||||||
|
+ browseEvent.getClientY());
|
||||||
|
activeSprite = null;
|
||||||
|
if (mouseTimer != null) {
|
||||||
|
mouseTimer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void spriteOver(SpriteOverEvent event) {
|
||||||
|
Event browseEvent = event.getBrowserEvent();
|
||||||
|
Log.debug("Over Position: " + browseEvent.getClientX() + ", "
|
||||||
|
+ browseEvent.getClientY());
|
||||||
|
currentPosition = new Vector2D(browseEvent.getClientX(),
|
||||||
|
browseEvent.getClientY());
|
||||||
|
if (activeSprite != null) {
|
||||||
|
currentSprite = event.getSprite();
|
||||||
|
for (ImageSprite sprite : sprites) {
|
||||||
|
if (currentSprite == sprite) {
|
||||||
|
displacement = startPosition.sub(currentPosition);
|
||||||
|
Log.debug("Chart Sprite Selected");
|
||||||
|
actionOnChartSpriteWhenMove();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void spriteMouseWheel(MouseWheelEvent event) {
|
||||||
|
int deltaY = event.getDeltaY();
|
||||||
|
Log.debug("Wheel: " + deltaY);
|
||||||
|
/*
|
||||||
|
* if (deltaY < 0) { zoomIn(); } else { zoomOut(); }
|
||||||
|
*/
|
||||||
|
draw();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionOnChartSpriteWhenMove() {
|
||||||
|
/*
|
||||||
|
* Log.debug("Operation:" + activeOperation); switch (activeOperation) {
|
||||||
|
* case ZOOMIN: break; case ZOOMOUT: break; case MOVE: moveChart();
|
||||||
|
* break; default: break; }
|
||||||
|
*/
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionOnChartSpriteWhenMouseLeftDown() {
|
||||||
|
/*
|
||||||
|
* Log.debug("Operation:" + activeOperation); switch (activeOperation) {
|
||||||
|
* case MOVE: break; case ZOOMIN: zoomIn(); break; case ZOOMOUT:
|
||||||
|
* zoomOut(); break; default: break;
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void draw() {
|
||||||
|
|
||||||
|
paint.redrawSurfaceForced();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.custom;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
import com.sencha.gxt.chart.client.chart.axis.CategoryAxis;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.SortDir;
|
||||||
|
import com.sencha.gxt.data.shared.Store;
|
||||||
|
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||||
|
import com.sencha.gxt.data.shared.Store.StoreSortInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
* @param <M>
|
||||||
|
*/
|
||||||
|
public class FormatedTimeAxis<M> extends CategoryAxis<M, String> {
|
||||||
|
private Date startDate;
|
||||||
|
private Date endDate;
|
||||||
|
private ListStore<M> substore;
|
||||||
|
private StoreSortInfo<M> sort;
|
||||||
|
private StoreFilter<M> filter;
|
||||||
|
private DateTimeFormat dateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a time axis.
|
||||||
|
*/
|
||||||
|
public FormatedTimeAxis(DateTimeFormat dateTimeFormat) {
|
||||||
|
super();
|
||||||
|
this.dateTimeFormat = dateTimeFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ending date of the axis.
|
||||||
|
*
|
||||||
|
* @return the ending date of the axis
|
||||||
|
*/
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the starting date of the axis.
|
||||||
|
*
|
||||||
|
* @return the starting date of the axis
|
||||||
|
*/
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ending date of the axis.
|
||||||
|
*
|
||||||
|
* @param endDate
|
||||||
|
* the ending date of the axis
|
||||||
|
*/
|
||||||
|
public void setEndDate(Date endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the starting date of the axis.
|
||||||
|
*
|
||||||
|
* @param startDate
|
||||||
|
* the starting date of the axis
|
||||||
|
*/
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyData() {
|
||||||
|
if (sort == null) {
|
||||||
|
sort = new StoreSortInfo<M>(field, SortDir.ASC);
|
||||||
|
filter = new StoreFilter<M>() {
|
||||||
|
@Override
|
||||||
|
public boolean select(Store<M> store, M parent, M item) {
|
||||||
|
String stringValue = field.getValue(item);
|
||||||
|
Date value = dateTimeFormat.parse(stringValue);
|
||||||
|
boolean result = value.after(startDate)
|
||||||
|
&& value.before(endDate) || value.equals(startDate)
|
||||||
|
|| value.equals(endDate);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
ListStore<M> store = chart.getStore();
|
||||||
|
substore = new ListStore<M>(store.getKeyProvider());
|
||||||
|
substore.addSortInfo(sort);
|
||||||
|
substore.addFilter(filter);
|
||||||
|
substore.setEnableFilters(true);
|
||||||
|
substore.addAll(store.getAll());
|
||||||
|
chart.setSubstore(substore);
|
||||||
|
super.applyData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createLabels() {
|
||||||
|
labelNames.clear();
|
||||||
|
for (int i = 0; i < substore.size(); i++) {
|
||||||
|
labelNames.add(field.getValue(substore.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingMenuEvent extends
|
||||||
|
GwtEvent<AccountingMenuEvent.AccountingMenuEventHandler> {
|
||||||
|
|
||||||
|
public static Type<AccountingMenuEventHandler> TYPE = new Type<AccountingMenuEventHandler>();
|
||||||
|
private AccountingType accountingType;
|
||||||
|
|
||||||
|
public interface AccountingMenuEventHandler extends EventHandler {
|
||||||
|
void onMenu(AccountingMenuEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasAccountingMenuEventHandler extends HasHandlers {
|
||||||
|
public HandlerRegistration addAccountingMenuEventHandler(
|
||||||
|
AccountingMenuEventHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingMenuEvent(AccountingType accountingType) {
|
||||||
|
this.accountingType = accountingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(AccountingMenuEventHandler handler) {
|
||||||
|
handler.onMenu(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<AccountingMenuEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<AccountingMenuEventHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source,
|
||||||
|
AccountingMenuEvent accountingMenuEvent) {
|
||||||
|
source.fireEvent(accountingMenuEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingType getAccountingType() {
|
||||||
|
return accountingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AccountingMenuEvent [accountingType=" + accountingType + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.FiltersChangeType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FiltersChangeEvent extends
|
||||||
|
GwtEvent<FiltersChangeEvent.FiltersChangeEventHandler> {
|
||||||
|
|
||||||
|
public static Type<FiltersChangeEventHandler> TYPE = new Type<FiltersChangeEventHandler>();
|
||||||
|
private FiltersChangeType filtersChangeType;
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public interface FiltersChangeEventHandler extends EventHandler {
|
||||||
|
void onFiltersChange(FiltersChangeEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasFiltersChangeEventHandler extends HasHandlers {
|
||||||
|
public HandlerRegistration addFiltersChangeEventHandler(
|
||||||
|
FiltersChangeEventHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FiltersChangeEvent(FiltersChangeType filtersChangeType, SeriesRequest seriesRequest) {
|
||||||
|
this.filtersChangeType = filtersChangeType;
|
||||||
|
this.seriesRequest=seriesRequest;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(FiltersChangeEventHandler handler) {
|
||||||
|
handler.onFiltersChange(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<FiltersChangeEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<FiltersChangeEventHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source,
|
||||||
|
FiltersChangeEvent filtersChangeEvent) {
|
||||||
|
source.fireEvent(filtersChangeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FiltersChangeType getFiltersChangeType() {
|
||||||
|
return filtersChangeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesRequest getSeriesRequest() {
|
||||||
|
return seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FiltersChangeEvent [filtersChangeType=" + filtersChangeType
|
||||||
|
+ ", seriesRequest=" + seriesRequest + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.event;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.SessionExpiredType;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SessionExpiredEvent extends GwtEvent<SessionExpiredEvent.SessionExpiredEventHandler> {
|
||||||
|
|
||||||
|
public static Type<SessionExpiredEventHandler> TYPE = new Type<SessionExpiredEventHandler>();
|
||||||
|
private SessionExpiredType sessionExpiredType;
|
||||||
|
|
||||||
|
public interface SessionExpiredEventHandler extends EventHandler {
|
||||||
|
void onSessionExpired(SessionExpiredEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasSessionExpiredEventHandler extends HasHandlers{
|
||||||
|
public HandlerRegistration addSessionExpiredEventHandler(SessionExpiredEventHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SessionExpiredEvent(SessionExpiredType sessionExpiredType) {
|
||||||
|
this.sessionExpiredType = sessionExpiredType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(SessionExpiredEventHandler handler) {
|
||||||
|
handler.onSessionExpired(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<SessionExpiredEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<SessionExpiredEventHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source, SessionExpiredType sessionExpiredType) {
|
||||||
|
source.fireEvent(new SessionExpiredEvent(sessionExpiredType));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SessionExpiredType getSessionExpiredType() {
|
||||||
|
return sessionExpiredType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SessionExpiredEvent [sessionExpiredType=" + sessionExpiredType
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.StateChangeType;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StateChangeEvent extends
|
||||||
|
GwtEvent<StateChangeEvent.StateChangeEventHandler> {
|
||||||
|
|
||||||
|
public static Type<StateChangeEventHandler> TYPE = new Type<StateChangeEventHandler>();
|
||||||
|
private StateChangeType stateChangeType;
|
||||||
|
private AccountingStateData accountingStateData;
|
||||||
|
|
||||||
|
public interface StateChangeEventHandler extends EventHandler {
|
||||||
|
void onStateChange(StateChangeEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasStateChangeEventHandler extends HasHandlers {
|
||||||
|
public HandlerRegistration addStateChangeEventHandler(
|
||||||
|
StateChangeEventHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StateChangeEvent(StateChangeType stateChangeType,
|
||||||
|
AccountingStateData accountingStateData) {
|
||||||
|
this.stateChangeType = stateChangeType;
|
||||||
|
this.accountingStateData = accountingStateData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(StateChangeEventHandler handler) {
|
||||||
|
handler.onStateChange(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<StateChangeEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<StateChangeEventHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source,
|
||||||
|
StateChangeEvent stateChangeEvent) {
|
||||||
|
source.fireEvent(stateChangeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StateChangeType getStateChangeType() {
|
||||||
|
return stateChangeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingStateData getAccountingStateData() {
|
||||||
|
return accountingStateData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "StateChangeEvent [stateChangeType=" + stateChangeType
|
||||||
|
+ ", accountingStateData=" + accountingStateData + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.event;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.UIStateType;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> {
|
||||||
|
|
||||||
|
public static Type<UIStateHandler> TYPE = new Type<UIStateHandler>();
|
||||||
|
private UIStateType uiStateType;
|
||||||
|
|
||||||
|
public interface UIStateHandler extends EventHandler {
|
||||||
|
void onUIState(UIStateEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasUIStateHandler extends HasHandlers {
|
||||||
|
public HandlerRegistration addUIStateHandler(UIStateHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UIStateEvent(UIStateType uiStateType) {
|
||||||
|
this.uiStateType = uiStateType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(UIStateHandler handler) {
|
||||||
|
handler.onUIState(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<UIStateHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<UIStateHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source, UIStateEvent uiStateEvent) {
|
||||||
|
source.fireEvent(uiStateEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UIStateType getUiStateType() {
|
||||||
|
return uiStateType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UIStateEvent [uiStateType=" + uiStateType + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,243 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.filters;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.StateChangeEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.properties.AccountingPeriodModePropertiesCombo;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriodMode;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
|
||||||
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.ParseErrorEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.DateField;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.validator.MaxDateValidator;
|
||||||
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingPeriodPanel extends SimpleContainer {
|
||||||
|
|
||||||
|
private EventBus eventBus;
|
||||||
|
private DateField startDate;
|
||||||
|
private DateField endDate;
|
||||||
|
private ListStore<AccountingPeriodMode> storeCombo;
|
||||||
|
private ComboBox<AccountingPeriodMode> comboPeriodMode;
|
||||||
|
|
||||||
|
public AccountingPeriodPanel(EventBus eventBus) {
|
||||||
|
super();
|
||||||
|
Log.debug("AccountingPeriodPanel");
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
bindToEvents();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create() {
|
||||||
|
startDate = new DateField();
|
||||||
|
startDate.addValidator(new MaxDateValidator(new Date()));
|
||||||
|
startDate.addValidator(new EmptyValidator<Date>());
|
||||||
|
startDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onParseError(ParseErrorEvent event) {
|
||||||
|
Info.display("Parse Error", event.getErrorValue()
|
||||||
|
+ " could not be parsed as a date");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
startDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||||
|
String v = event.getValue() == null ? "Nothing"
|
||||||
|
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||||
|
.format(event.getValue());
|
||||||
|
Info.display("Start Date Selected", v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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) {
|
||||||
|
Info.display("Parse Error", event.getErrorValue()
|
||||||
|
+ " could not be parsed as a date");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
endDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||||
|
String v = event.getValue() == null ? "Nothing"
|
||||||
|
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||||
|
.format(event.getValue());
|
||||||
|
Info.display("End Date Selected", v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FieldLabel endDateLabel = new FieldLabel(endDate, "End Date");
|
||||||
|
|
||||||
|
// Aggreagation Mode
|
||||||
|
AccountingPeriodModePropertiesCombo props = GWT
|
||||||
|
.create(AccountingPeriodModePropertiesCombo.class);
|
||||||
|
storeCombo = new ListStore<AccountingPeriodMode>(props.id());
|
||||||
|
storeCombo.addAll(AccountingPeriodMode.asList());
|
||||||
|
|
||||||
|
comboPeriodMode = new ComboBox<AccountingPeriodMode>(storeCombo,
|
||||||
|
props.label());
|
||||||
|
comboPeriodMode.setMinListWidth(250);
|
||||||
|
comboPeriodMode.setEditable(false);
|
||||||
|
comboPeriodMode.setTypeAhead(false);
|
||||||
|
comboPeriodMode.setAllowBlank(false);
|
||||||
|
comboPeriodMode.setTriggerAction(TriggerAction.ALL);
|
||||||
|
comboPeriodMode.setValue(AccountingPeriodMode.DAILY);
|
||||||
|
addHandlersForComboPeriodMode(props.label());
|
||||||
|
|
||||||
|
Log.debug("ComboPeriodMode created");
|
||||||
|
|
||||||
|
FieldLabel periodModeLabel = new FieldLabel(comboPeriodMode,
|
||||||
|
"Aggregation");
|
||||||
|
|
||||||
|
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||||
|
vlc.add(startDateLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
vlc.add(endDateLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
vlc.add(periodModeLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
FieldSet fieldSet = new FieldSet();
|
||||||
|
fieldSet.setHeadingHtml("<b>Temporal Constraint</b>");
|
||||||
|
fieldSet.setCollapsible(false);
|
||||||
|
fieldSet.add(vlc);
|
||||||
|
|
||||||
|
add(fieldSet, new MarginData(0));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind to Events
|
||||||
|
private void bindToEvents() {
|
||||||
|
eventBus.addHandler(StateChangeEvent.TYPE,
|
||||||
|
new StateChangeEvent.StateChangeEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateChange(StateChangeEvent event) {
|
||||||
|
Log.debug("Catch Event State Change");
|
||||||
|
doStateChangeCommand(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doStateChangeCommand(StateChangeEvent event) {
|
||||||
|
if (event.getStateChangeType() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.getStateChangeType()) {
|
||||||
|
case Restore:
|
||||||
|
onRestoreStateChange(event);
|
||||||
|
break;
|
||||||
|
case Update:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onRestoreStateChange(StateChangeEvent event) {
|
||||||
|
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();
|
||||||
|
endDate.reset();
|
||||||
|
comboPeriodMode.reset();
|
||||||
|
comboPeriodMode.setValue(AccountingPeriodMode.DAILY);
|
||||||
|
}
|
||||||
|
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingPeriod getAccountingPeriod() {
|
||||||
|
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;
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.alert("Attention",
|
||||||
|
"Select a valid aggregation mode!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Attention",
|
||||||
|
"The start date must be less than or equal to the end date!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.filters;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.FiltersChangeEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.type.FiltersChangeType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FiltersPanel extends FramedPanel {
|
||||||
|
private EventBus eventBus;
|
||||||
|
private AccountingPeriodPanel accountPeriodPanel;
|
||||||
|
private TextButton updateCharts;
|
||||||
|
|
||||||
|
public FiltersPanel(EventBus eventBus) {
|
||||||
|
super();
|
||||||
|
Log.debug("FiltersPanel");
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create() {
|
||||||
|
accountPeriodPanel = new AccountingPeriodPanel(eventBus);
|
||||||
|
|
||||||
|
updateCharts = new TextButton("Update Chart");
|
||||||
|
updateCharts.setIcon(AccountingManagerResources.INSTANCE
|
||||||
|
.accountingReload24());
|
||||||
|
updateCharts.setIconAlign(IconAlign.RIGHT);
|
||||||
|
updateCharts.setToolTip("Update Chart");
|
||||||
|
|
||||||
|
updateCharts.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
updateChart();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
||||||
|
hBox.setPack(BoxLayoutPack.START);
|
||||||
|
hBox.add(updateCharts, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||||
|
|
||||||
|
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||||
|
vlc.setScrollMode(ScrollMode.AUTO);
|
||||||
|
vlc.add(accountPeriodPanel, new VerticalLayoutData(1, -1, new Margins(
|
||||||
|
4, 0, 2, 4)));
|
||||||
|
vlc.add(hBox, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
add(vlc);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateChart() {
|
||||||
|
AccountingPeriod accountingPeriod = accountPeriodPanel
|
||||||
|
.getAccountingPeriod();
|
||||||
|
if (accountingPeriod != null) {
|
||||||
|
SeriesRequest seriesRequest = new SeriesRequest(accountingPeriod);
|
||||||
|
FiltersChangeEvent filtersChangeEvent = new FiltersChangeEvent(
|
||||||
|
FiltersChangeType.Update, seriesRequest);
|
||||||
|
eventBus.fireEvent(filtersChangeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.graphics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Basic Vector 2D
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Vector2D {
|
||||||
|
|
||||||
|
public static Vector2D Vector2DNull = new Vector2D(0, 0);
|
||||||
|
|
||||||
|
protected double x;
|
||||||
|
protected double y;
|
||||||
|
|
||||||
|
public Vector2D() {
|
||||||
|
x = y = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2D(double x, double y) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(double x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(double y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute magnitude of vector ....
|
||||||
|
public double length() {
|
||||||
|
return Math.sqrt(x * x + y * y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sum of two vectors ....
|
||||||
|
public Vector2D add(Vector2D v) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x + v.x, this.y + v.y);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add scalar
|
||||||
|
public Vector2D add(double s) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x + s, this.y + s);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subtract vector v1 from v .....
|
||||||
|
public Vector2D sub(Vector2D v) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x - v.x, this.y - v.y);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subtract scalar
|
||||||
|
public Vector2D sub(double s) {
|
||||||
|
Vector2D v2 = new Vector2D(this.x - s, this.y - s);
|
||||||
|
return v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scale vector by a constant ...
|
||||||
|
public Vector2D scale(double scaleFactor) {
|
||||||
|
Vector2D v2 = new Vector2D(this.x * scaleFactor, this.y * scaleFactor);
|
||||||
|
return v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize a vectors length....
|
||||||
|
public Vector2D normalize() {
|
||||||
|
Vector2D v2 = new Vector2D();
|
||||||
|
|
||||||
|
double length = Math.sqrt(this.x * this.x + this.y * this.y);
|
||||||
|
if (length != 0) {
|
||||||
|
v2.x = this.x / length;
|
||||||
|
v2.y = this.y / length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dot product of two vectors .....
|
||||||
|
public double dot(Vector2D v) {
|
||||||
|
return this.x * v.x + this.y * v.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Multiply
|
||||||
|
public Vector2D multiply(Vector2D v) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x * v.getX(), this.y * v.getY());
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2D multiply(double s) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x * s, this.y * s);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Divide
|
||||||
|
public Vector2D divide(Vector2D v) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x / v.getX(), this.y / v.getY());
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2D divide(double s) {
|
||||||
|
if (s != 0) {
|
||||||
|
Vector2D v1 = new Vector2D(this.x / s, this.y / s);
|
||||||
|
return v1;
|
||||||
|
} else {
|
||||||
|
return Vector2DNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Distance To Squared
|
||||||
|
public double distanceToSquared(Vector2D v) {
|
||||||
|
double dx = this.x - v.x, dy = this.y - v.y;
|
||||||
|
return dx * dx + dy * dy;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Distance
|
||||||
|
public double distance(Vector2D v) {
|
||||||
|
return Math.sqrt(this.distanceToSquared(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Negate
|
||||||
|
public Vector2D negate() {
|
||||||
|
Vector2D v1 = new Vector2D(-x, -y);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Vector2D v) {
|
||||||
|
return v.getX() == x && v.getY() == y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2D copy() {
|
||||||
|
return new Vector2D(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Floor
|
||||||
|
public Vector2D floor() {
|
||||||
|
Vector2D v1 = new Vector2D(Math.floor(this.x), Math.floor(this.y));
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ceil
|
||||||
|
public Vector2D ceil() {
|
||||||
|
Vector2D v1 = new Vector2D(Math.ceil(this.x), Math.ceil(this.y));
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Round
|
||||||
|
public Vector2D round() {
|
||||||
|
Vector2D v1 = new Vector2D(Math.round(this.x), Math.round(this.y));
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Round To Zero
|
||||||
|
public Vector2D roundToZero() {
|
||||||
|
double dx=x<0?Math.ceil( this.x ):Math.floor( this.x );
|
||||||
|
double dy=y<0?Math.ceil( this.y ):Math.floor( this.y );
|
||||||
|
Vector2D v1 = new Vector2D(dx,dy);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Vector2D [x=" + x + ", y=" + y + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,981 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.maindata;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.event.StateChangeEvent;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesPortlet;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesServiceData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorageData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.github.highcharts4gwt.client.view.widget.HighchartsLayoutPanel;
|
||||||
|
import com.github.highcharts4gwt.model.array.api.ArrayNumber;
|
||||||
|
import com.github.highcharts4gwt.model.array.api.ArrayString;
|
||||||
|
import com.github.highcharts4gwt.model.factory.api.HighchartsOptionFactory;
|
||||||
|
import com.github.highcharts4gwt.model.factory.jso.JsoHighchartsOptionFactory;
|
||||||
|
import com.github.highcharts4gwt.model.highcharts.option.api.ChartOptions;
|
||||||
|
import com.github.highcharts4gwt.model.highcharts.option.api.SeriesArea;
|
||||||
|
import com.github.highcharts4gwt.model.highcharts.option.api.SeriesColumn;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
public HightChartPanel(EventBus eventBus) {
|
||||||
|
super();
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
bindToEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setResize(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void create() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Bind to Events
|
||||||
|
private void bindToEvents() {
|
||||||
|
eventBus.addHandler(StateChangeEvent.TYPE,
|
||||||
|
new StateChangeEvent.StateChangeEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateChange(StateChangeEvent event) {
|
||||||
|
Log.debug("Catch Event State Change");
|
||||||
|
doStateChangeCommand(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doStateChangeCommand(StateChangeEvent event) {
|
||||||
|
if (event.getStateChangeType() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.getStateChangeType()) {
|
||||||
|
case Restore:
|
||||||
|
case Update:
|
||||||
|
onStateChange(event);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onStateChange(StateChangeEvent event) {
|
||||||
|
if (event.getAccountingStateData() == null
|
||||||
|
|| event.getAccountingStateData().getAccountingType() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event.getAccountingStateData().getAccountingType()) {
|
||||||
|
case JOB:
|
||||||
|
createJobChart(event.getAccountingStateData());
|
||||||
|
break;
|
||||||
|
case PORTLET:
|
||||||
|
createPortletChart(event.getAccountingStateData());
|
||||||
|
break;
|
||||||
|
case SERVICE:
|
||||||
|
createServiceChart(event.getAccountingStateData());
|
||||||
|
break;
|
||||||
|
case STORAGE:
|
||||||
|
createStorageChart(event.getAccountingStateData());
|
||||||
|
break;
|
||||||
|
case TASK:
|
||||||
|
createTaskChart(event.getAccountingStateData());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private double calculateMinRange(AccountingPeriod accountingPeriod) {
|
||||||
|
if (accountingPeriod.getPeriod() == null) {
|
||||||
|
Log.error("AccountingPeriodMode is null");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (accountingPeriod.getPeriod()) {
|
||||||
|
case DAILY:
|
||||||
|
// 1 day=24hour * 60min *60sec * 1000 millisec
|
||||||
|
return 14 * 24 * 3600 * 1000;
|
||||||
|
case HOURLY:
|
||||||
|
return 24 * 3600 * 1000;
|
||||||
|
case MILLISECONDLY:
|
||||||
|
return 10 * 100;
|
||||||
|
case MINUTELY:
|
||||||
|
return 10 * 60 * 1000;
|
||||||
|
case MONTHLY:
|
||||||
|
return 6 * 28 * 24 * 3600 * 1000;
|
||||||
|
case SECONDLY:
|
||||||
|
return 30 * 1000;
|
||||||
|
case YEARLY:
|
||||||
|
return 5 * 12 * 28 * 24 * 3600 * 1000;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private double calculateInterval(AccountingPeriod accountingPeriod) {
|
||||||
|
if (accountingPeriod.getPeriod() == null) {
|
||||||
|
Log.error("AccountingPeriodMode is null");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (accountingPeriod.getPeriod()) {
|
||||||
|
case DAILY:
|
||||||
|
return 24 * 3600 * 1000;
|
||||||
|
case HOURLY:
|
||||||
|
return 3600 * 1000;
|
||||||
|
case MILLISECONDLY:
|
||||||
|
return 100;
|
||||||
|
case MINUTELY:
|
||||||
|
return 60 * 1000;
|
||||||
|
case MONTHLY:
|
||||||
|
return 28 * 24 * 3600 * 1000;
|
||||||
|
case SECONDLY:
|
||||||
|
return 1000;
|
||||||
|
case YEARLY:
|
||||||
|
return 12 * 28 * 24 * 3600 * 1000;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createStorageChart(AccountingStateData accountingStateData) {
|
||||||
|
clear();
|
||||||
|
if (accountingStateData == null
|
||||||
|
|| accountingStateData.getAccountingType() == null
|
||||||
|
|| accountingStateData.getSeriesRequest() == null
|
||||||
|
|| accountingStateData.getSeriesResponse() == null) {
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(accountingStateData
|
||||||
|
.getSeriesResponse() instanceof SeriesStorage)){
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
double minRange = calculateMinRange(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
double interval=calculateInterval(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
Date dateStart=accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate();
|
||||||
|
|
||||||
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
|
options.chart().zoomType("x");
|
||||||
|
|
||||||
|
options.title().text("Accounting Storage");
|
||||||
|
|
||||||
|
options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||||
|
|
||||||
|
ArrayString colors = options.colors();
|
||||||
|
// colors.setValue(0, "#cc0038");
|
||||||
|
// colors.setValue(1, "#32cd32");
|
||||||
|
|
||||||
|
|
||||||
|
// xAxis
|
||||||
|
options.xAxis().type("datetime").minRange(minRange);
|
||||||
|
|
||||||
|
// yAxis
|
||||||
|
// options.yAxis().title().text("Exchange rate");
|
||||||
|
// Highcharts.getOptions().colors[0]
|
||||||
|
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"DataVolume\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Data Volume\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value} kB\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\"" + "}]";
|
||||||
|
|
||||||
|
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||||
|
|
||||||
|
// TODO does not seem to be working
|
||||||
|
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||||
|
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||||
|
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||||
|
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||||
|
|
||||||
|
options.plotOptions().area()
|
||||||
|
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||||
|
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SeriesColumn seriesOperationCount = highchartsFactory.createSeriesColumn();
|
||||||
|
seriesOperationCount.name("Operation Count");
|
||||||
|
seriesOperationCount.color(colors.get(1));
|
||||||
|
seriesOperationCount.type("column");
|
||||||
|
|
||||||
|
ArrayNumber dataOperationCount = seriesOperationCount
|
||||||
|
.dataAsArrayNumber();
|
||||||
|
|
||||||
|
seriesOperationCount.pointInterval(interval).pointStart(dateStart.getTime());
|
||||||
|
|
||||||
|
SeriesArea seriesDataVolume = highchartsFactory.createSeriesArea();
|
||||||
|
seriesDataVolume.name("Data Volume");
|
||||||
|
seriesDataVolume.color(colors.get(0));
|
||||||
|
seriesDataVolume.yAxisAsString("DataVolume");
|
||||||
|
|
||||||
|
|
||||||
|
ArrayNumber dataDataVolume = seriesDataVolume.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesDataVolume.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
for (SeriesStorageData seriesStorageData : seriesStorage.getSeries()) {
|
||||||
|
dataOperationCount.push(seriesStorageData.getOperationCount());
|
||||||
|
dataDataVolume.push(seriesStorageData.getDataVolume());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
options.series().addToEnd(seriesOperationCount);
|
||||||
|
options.series().addToEnd(seriesDataVolume);
|
||||||
|
|
||||||
|
options.chart().showAxes(true);
|
||||||
|
|
||||||
|
options.legend().enabled(true);
|
||||||
|
// options.legend().layout("vertical");
|
||||||
|
// options.legend().align("left");
|
||||||
|
// options.legend().x(120);
|
||||||
|
// options.legend().verticalAlign("top");
|
||||||
|
// options.legend().y(100);
|
||||||
|
// options.legend().floating(true);
|
||||||
|
// options.legend()
|
||||||
|
// .backgroundColor(
|
||||||
|
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||||
|
|
||||||
|
HighchartsLayoutPanel highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||||
|
|
||||||
|
highchartsLayoutPanel.renderChart(options);
|
||||||
|
|
||||||
|
add(highchartsLayoutPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createServiceChart(AccountingStateData accountingStateData) {
|
||||||
|
clear();
|
||||||
|
if (accountingStateData == null
|
||||||
|
|| accountingStateData.getAccountingType() == null
|
||||||
|
|| accountingStateData.getSeriesRequest() == null
|
||||||
|
|| accountingStateData.getSeriesResponse() == null) {
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(accountingStateData
|
||||||
|
.getSeriesResponse() instanceof SeriesService)){
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SeriesService seriesService = (SeriesService) accountingStateData
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
double minRange = calculateMinRange(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
double interval=calculateInterval(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
Date dateStart=accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate();
|
||||||
|
|
||||||
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
|
options.chart().zoomType("x");
|
||||||
|
|
||||||
|
options.title().text("Accounting Service");
|
||||||
|
|
||||||
|
options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||||
|
|
||||||
|
ArrayString colors = options.colors();
|
||||||
|
// colors.setValue(0, "#cc0038");
|
||||||
|
// colors.setValue(1, "#32cd32");
|
||||||
|
|
||||||
|
|
||||||
|
// xAxis
|
||||||
|
options.xAxis().type("datetime").minRange(minRange);
|
||||||
|
|
||||||
|
// yAxis
|
||||||
|
// options.yAxis().title().text("Exchange rate");
|
||||||
|
// Highcharts.getOptions().colors[0]
|
||||||
|
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"Duration\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Duration\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value} ms\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"MaxInvocationTime\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Max Invocation Time\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(2)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value} ms\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(2)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"MinInvocationTime\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Min Invocation Time\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(3)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value} ms\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(3)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\"" + "}]"
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||||
|
|
||||||
|
// TODO does not seem to be working
|
||||||
|
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||||
|
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||||
|
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||||
|
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||||
|
|
||||||
|
options.plotOptions().area()
|
||||||
|
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||||
|
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SeriesColumn seriesOperationCount = highchartsFactory.createSeriesColumn();
|
||||||
|
seriesOperationCount.name("Operation Count");
|
||||||
|
seriesOperationCount.color(colors.get(1));
|
||||||
|
seriesOperationCount.type("column");
|
||||||
|
|
||||||
|
ArrayNumber dataOperationCount = seriesOperationCount
|
||||||
|
.dataAsArrayNumber();
|
||||||
|
|
||||||
|
seriesOperationCount.pointInterval(interval).pointStart(dateStart.getTime());
|
||||||
|
|
||||||
|
SeriesArea seriesDuration = highchartsFactory.createSeriesArea();
|
||||||
|
seriesDuration.name("Duration");
|
||||||
|
seriesDuration.color(colors.get(0));
|
||||||
|
seriesDuration.yAxisAsString("Duration");
|
||||||
|
|
||||||
|
|
||||||
|
ArrayNumber dataDuration = seriesDuration.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesDuration.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
SeriesArea seriesMaxInvocationTime = highchartsFactory.createSeriesArea();
|
||||||
|
seriesMaxInvocationTime.name("Max Invocation Time");
|
||||||
|
seriesMaxInvocationTime.color(colors.get(2));
|
||||||
|
seriesMaxInvocationTime.yAxisAsString("MaxInvocationTime");
|
||||||
|
|
||||||
|
|
||||||
|
ArrayNumber dataMaxInvocationTime = seriesMaxInvocationTime.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesMaxInvocationTime.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
SeriesArea seriesMinInvocationTime = highchartsFactory.createSeriesArea();
|
||||||
|
seriesMinInvocationTime.name("Min Invocation Time");
|
||||||
|
seriesMinInvocationTime.color(colors.get(3));
|
||||||
|
seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||||
|
|
||||||
|
|
||||||
|
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesMinInvocationTime.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (SeriesServiceData seriesServiceData : seriesService.getSeries()) {
|
||||||
|
dataOperationCount.push(seriesServiceData.getOperationCount());
|
||||||
|
dataDuration.push(seriesServiceData.getDuration());
|
||||||
|
dataMaxInvocationTime.push(seriesServiceData.getMaxInvocationTime());
|
||||||
|
dataMinInvocationTime.push(seriesServiceData.getMinInvocationTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
options.series().addToEnd(seriesOperationCount);
|
||||||
|
options.series().addToEnd(seriesDuration);
|
||||||
|
options.series().addToEnd(seriesMaxInvocationTime);
|
||||||
|
options.series().addToEnd(seriesMinInvocationTime);
|
||||||
|
|
||||||
|
options.chart().showAxes(true);
|
||||||
|
|
||||||
|
options.legend().enabled(true);
|
||||||
|
// options.legend().layout("vertical");
|
||||||
|
// options.legend().align("left");
|
||||||
|
// options.legend().x(120);
|
||||||
|
// options.legend().verticalAlign("top");
|
||||||
|
// options.legend().y(100);
|
||||||
|
// options.legend().floating(true);
|
||||||
|
// options.legend()
|
||||||
|
// .backgroundColor(
|
||||||
|
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||||
|
|
||||||
|
HighchartsLayoutPanel highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||||
|
|
||||||
|
highchartsLayoutPanel.renderChart(options);
|
||||||
|
|
||||||
|
add(highchartsLayoutPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPortletChart(AccountingStateData accountingStateData) {
|
||||||
|
clear();
|
||||||
|
if (accountingStateData == null
|
||||||
|
|| accountingStateData.getAccountingType() == null
|
||||||
|
|| accountingStateData.getSeriesRequest() == null
|
||||||
|
|| accountingStateData.getSeriesResponse() == null) {
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(accountingStateData
|
||||||
|
.getSeriesResponse() instanceof SeriesPortlet)){
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
double minRange = calculateMinRange(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
double interval=calculateInterval(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
Date dateStart=accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate();
|
||||||
|
|
||||||
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
|
options.chart().zoomType("x");
|
||||||
|
|
||||||
|
options.title().text("Accounting Portlet");
|
||||||
|
|
||||||
|
options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||||
|
|
||||||
|
ArrayString colors = options.colors();
|
||||||
|
// colors.setValue(0, "#cc0038");
|
||||||
|
// colors.setValue(1, "#32cd32");
|
||||||
|
|
||||||
|
|
||||||
|
// xAxis
|
||||||
|
options.xAxis().type("datetime").minRange(minRange);
|
||||||
|
|
||||||
|
// yAxis
|
||||||
|
// options.yAxis().title().text("Exchange rate");
|
||||||
|
// Highcharts.getOptions().colors[0]
|
||||||
|
String multiAxis = "[{" + " \"id\": \"DataVolume\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Data Volume\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"OperationCount\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\"" + "}]";
|
||||||
|
|
||||||
|
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||||
|
|
||||||
|
// TODO does not seem to be working
|
||||||
|
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||||
|
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||||
|
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||||
|
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||||
|
|
||||||
|
options.plotOptions().area()
|
||||||
|
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||||
|
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||||
|
|
||||||
|
SeriesColumn seriesDataVolume = highchartsFactory.createSeriesColumn();
|
||||||
|
seriesDataVolume.name("Data Volume");
|
||||||
|
seriesDataVolume.color(colors.get(1));
|
||||||
|
seriesDataVolume.type("column");
|
||||||
|
|
||||||
|
ArrayNumber dataDataVolume = seriesDataVolume.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesDataVolume.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
SeriesArea seriesOperationCount = highchartsFactory.createSeriesArea();
|
||||||
|
seriesOperationCount.name("Operation Count");
|
||||||
|
seriesOperationCount.yAxisAsString("OperationCount");
|
||||||
|
seriesOperationCount.color(colors.get(0));
|
||||||
|
|
||||||
|
ArrayNumber dataOperationCount = seriesOperationCount
|
||||||
|
.dataAsArrayNumber();
|
||||||
|
|
||||||
|
seriesOperationCount.pointInterval(interval).pointStart(dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (SeriesStorageData seriesStorageData : seriesStorage.getSeries()) {
|
||||||
|
dataDataVolume.push(seriesStorageData.getDataVolume());
|
||||||
|
dataOperationCount.push(seriesStorageData.getOperationCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
options.series().addToEnd(seriesDataVolume);
|
||||||
|
options.series().addToEnd(seriesOperationCount);
|
||||||
|
|
||||||
|
options.chart().showAxes(true);
|
||||||
|
|
||||||
|
options.legend().enabled(true);
|
||||||
|
// options.legend().layout("vertical");
|
||||||
|
// options.legend().align("left");
|
||||||
|
// options.legend().x(120);
|
||||||
|
// options.legend().verticalAlign("top");
|
||||||
|
// options.legend().y(100);
|
||||||
|
// options.legend().floating(true);
|
||||||
|
// options.legend()
|
||||||
|
// .backgroundColor(
|
||||||
|
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||||
|
|
||||||
|
HighchartsLayoutPanel highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||||
|
|
||||||
|
highchartsLayoutPanel.renderChart(options);
|
||||||
|
|
||||||
|
add(highchartsLayoutPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTaskChart(AccountingStateData accountingStateData) {
|
||||||
|
clear();
|
||||||
|
if (accountingStateData == null
|
||||||
|
|| accountingStateData.getAccountingType() == null
|
||||||
|
|| accountingStateData.getSeriesRequest() == null
|
||||||
|
|| accountingStateData.getSeriesResponse() == null) {
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(accountingStateData
|
||||||
|
.getSeriesResponse() instanceof SeriesTask)){
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
double minRange = calculateMinRange(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
double interval=calculateInterval(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
Date dateStart=accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate();
|
||||||
|
|
||||||
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
|
options.chart().zoomType("x");
|
||||||
|
|
||||||
|
options.title().text("Accounting Task");
|
||||||
|
|
||||||
|
options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||||
|
|
||||||
|
ArrayString colors = options.colors();
|
||||||
|
// colors.setValue(0, "#cc0038");
|
||||||
|
// colors.setValue(1, "#32cd32");
|
||||||
|
|
||||||
|
|
||||||
|
// xAxis
|
||||||
|
options.xAxis().type("datetime").minRange(minRange);
|
||||||
|
|
||||||
|
// yAxis
|
||||||
|
// options.yAxis().title().text("Exchange rate");
|
||||||
|
// Highcharts.getOptions().colors[0]
|
||||||
|
String multiAxis = "[{" + " \"id\": \"DataVolume\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Data Volume\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"OperationCount\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\"" + "}]";
|
||||||
|
|
||||||
|
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||||
|
|
||||||
|
// TODO does not seem to be working
|
||||||
|
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||||
|
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||||
|
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||||
|
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||||
|
|
||||||
|
options.plotOptions().area()
|
||||||
|
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||||
|
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||||
|
|
||||||
|
SeriesColumn seriesDataVolume = highchartsFactory.createSeriesColumn();
|
||||||
|
seriesDataVolume.name("Data Volume");
|
||||||
|
seriesDataVolume.color(colors.get(1));
|
||||||
|
seriesDataVolume.type("column");
|
||||||
|
|
||||||
|
ArrayNumber dataDataVolume = seriesDataVolume.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesDataVolume.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
SeriesArea seriesOperationCount = highchartsFactory.createSeriesArea();
|
||||||
|
seriesOperationCount.name("Operation Count");
|
||||||
|
seriesOperationCount.yAxisAsString("OperationCount");
|
||||||
|
seriesOperationCount.color(colors.get(0));
|
||||||
|
|
||||||
|
ArrayNumber dataOperationCount = seriesOperationCount
|
||||||
|
.dataAsArrayNumber();
|
||||||
|
|
||||||
|
seriesOperationCount.pointInterval(interval).pointStart(dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (SeriesStorageData seriesStorageData : seriesStorage.getSeries()) {
|
||||||
|
dataDataVolume.push(seriesStorageData.getDataVolume());
|
||||||
|
dataOperationCount.push(seriesStorageData.getOperationCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
options.series().addToEnd(seriesDataVolume);
|
||||||
|
options.series().addToEnd(seriesOperationCount);
|
||||||
|
|
||||||
|
options.chart().showAxes(true);
|
||||||
|
|
||||||
|
options.legend().enabled(true);
|
||||||
|
// options.legend().layout("vertical");
|
||||||
|
// options.legend().align("left");
|
||||||
|
// options.legend().x(120);
|
||||||
|
// options.legend().verticalAlign("top");
|
||||||
|
// options.legend().y(100);
|
||||||
|
// options.legend().floating(true);
|
||||||
|
// options.legend()
|
||||||
|
// .backgroundColor(
|
||||||
|
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||||
|
|
||||||
|
HighchartsLayoutPanel highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||||
|
|
||||||
|
highchartsLayoutPanel.renderChart(options);
|
||||||
|
|
||||||
|
add(highchartsLayoutPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createJobChart(AccountingStateData accountingStateData) {
|
||||||
|
clear();
|
||||||
|
if (accountingStateData == null
|
||||||
|
|| accountingStateData.getAccountingType() == null
|
||||||
|
|| accountingStateData.getSeriesRequest() == null
|
||||||
|
|| accountingStateData.getSeriesResponse() == null) {
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(accountingStateData
|
||||||
|
.getSeriesResponse() instanceof SeriesJob)){
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
double minRange = calculateMinRange(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
double interval=calculateInterval(accountingStateData
|
||||||
|
.getSeriesRequest().getAccountingPeriod());
|
||||||
|
|
||||||
|
Date dateStart=accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate();
|
||||||
|
|
||||||
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
|
options.chart().zoomType("x");
|
||||||
|
|
||||||
|
options.title().text("Accounting Job");
|
||||||
|
|
||||||
|
options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||||
|
|
||||||
|
ArrayString colors = options.colors();
|
||||||
|
// colors.setValue(0, "#cc0038");
|
||||||
|
// colors.setValue(1, "#32cd32");
|
||||||
|
|
||||||
|
|
||||||
|
// xAxis
|
||||||
|
options.xAxis().type("datetime").minRange(minRange);
|
||||||
|
|
||||||
|
// yAxis
|
||||||
|
// options.yAxis().title().text("Exchange rate");
|
||||||
|
// Highcharts.getOptions().colors[0]
|
||||||
|
String multiAxis = "[{" + " \"id\": \"DataVolume\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Data Volume\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"OperationCount\", "
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(0)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\"" + "}]";
|
||||||
|
|
||||||
|
options.setFieldAsJsonObject("yAxis", multiAxis);
|
||||||
|
|
||||||
|
// TODO does not seem to be working
|
||||||
|
String fillcolor = "{" + "\"linearGradient\": {" + "\"x1\": 0,"
|
||||||
|
+ "\"y1\": 0," + "\"x2\": 0," + "\"y2\": 1" + "},"
|
||||||
|
+ "\"stops\": [" + "[" + "0, \"#058DC7\"" + "]," + "["
|
||||||
|
+ "1, \"#FFFFFF\"" + "]" + "]" + "}";
|
||||||
|
|
||||||
|
options.plotOptions().area()
|
||||||
|
.setFieldAsJsonObject("fillColor", fillcolor).marker()
|
||||||
|
.radius(2).lineWidth(1).states().hover().lineWidth(1);
|
||||||
|
|
||||||
|
SeriesColumn seriesDataVolume = highchartsFactory.createSeriesColumn();
|
||||||
|
seriesDataVolume.name("Data Volume");
|
||||||
|
seriesDataVolume.color(colors.get(1));
|
||||||
|
seriesDataVolume.type("column");
|
||||||
|
|
||||||
|
ArrayNumber dataDataVolume = seriesDataVolume.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
seriesDataVolume.pointInterval(interval).pointStart(
|
||||||
|
dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
SeriesArea seriesOperationCount = highchartsFactory.createSeriesArea();
|
||||||
|
seriesOperationCount.name("Operation Count");
|
||||||
|
seriesOperationCount.yAxisAsString("OperationCount");
|
||||||
|
seriesOperationCount.color(colors.get(0));
|
||||||
|
|
||||||
|
ArrayNumber dataOperationCount = seriesOperationCount
|
||||||
|
.dataAsArrayNumber();
|
||||||
|
|
||||||
|
seriesOperationCount.pointInterval(interval).pointStart(dateStart.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (SeriesStorageData seriesStorageData : seriesStorage.getSeries()) {
|
||||||
|
dataDataVolume.push(seriesStorageData.getDataVolume());
|
||||||
|
dataOperationCount.push(seriesStorageData.getOperationCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
options.series().addToEnd(seriesDataVolume);
|
||||||
|
options.series().addToEnd(seriesOperationCount);
|
||||||
|
|
||||||
|
options.chart().showAxes(true);
|
||||||
|
|
||||||
|
options.legend().enabled(true);
|
||||||
|
// options.legend().layout("vertical");
|
||||||
|
// options.legend().align("left");
|
||||||
|
// options.legend().x(120);
|
||||||
|
// options.legend().verticalAlign("top");
|
||||||
|
// options.legend().y(100);
|
||||||
|
// options.legend().floating(true);
|
||||||
|
// options.legend()
|
||||||
|
// .backgroundColor(
|
||||||
|
// "(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'white'");
|
||||||
|
|
||||||
|
HighchartsLayoutPanel highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||||
|
|
||||||
|
highchartsLayoutPanel.renderChart(options);
|
||||||
|
|
||||||
|
add(highchartsLayoutPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.maindata;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MainDataPanel extends FramedPanel {
|
||||||
|
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
public MainDataPanel(EventBus eventBus) {
|
||||||
|
super();
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create() {
|
||||||
|
/*ChartPanel chartPanel = new ChartPanel(eventBus);
|
||||||
|
add(chartPanel);*/
|
||||||
|
HightChartPanel hightChartPanel= new HightChartPanel(eventBus);
|
||||||
|
add(hightChartPanel);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.menu;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
import com.sencha.gxt.theme.neptune.client.base.tabs.Css3BigTabPanelAppearance;
|
||||||
|
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
||||||
|
import com.sencha.gxt.widget.core.client.TabPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingManagerMenu extends TabPanel {
|
||||||
|
//private AccountingManagerMenuMessages msgs;
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
|
||||||
|
public AccountingManagerMenu(EventBus eventBus) {
|
||||||
|
super(GWT.<TabPanelAppearance>create(Css3BigTabPanelAppearance.class));
|
||||||
|
Log.debug("Create AccountingManagerMenu");
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
//this.msgs = GWT.create(AccountingManagerMenuMessages.class);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
setAnimScroll(false);
|
||||||
|
setTabScroll(false);
|
||||||
|
setCloseContextMenu(true);
|
||||||
|
addTabs();
|
||||||
|
setHeight(60);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addTabs() {
|
||||||
|
TabItemConfig storageItemConf = new TabItemConfig("Storage", false);
|
||||||
|
storageItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingStorage48());
|
||||||
|
EmptyPanel storageCategory=new EmptyPanel(AccountingType.STORAGE.name());
|
||||||
|
add(storageCategory, storageItemConf);
|
||||||
|
|
||||||
|
TabItemConfig serviceItemConf = new TabItemConfig("Service", false);
|
||||||
|
serviceItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingService48());
|
||||||
|
EmptyPanel serviceCategory=new EmptyPanel(AccountingType.SERVICE.name());
|
||||||
|
add(serviceCategory, serviceItemConf);
|
||||||
|
|
||||||
|
TabItemConfig portletItemConf = new TabItemConfig("Portlet", false);
|
||||||
|
portletItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingPortlet48());
|
||||||
|
EmptyPanel portletCategory=new EmptyPanel(AccountingType.PORTLET.name());
|
||||||
|
add(portletCategory, portletItemConf);
|
||||||
|
|
||||||
|
TabItemConfig taskItemConf = new TabItemConfig("Task", false);
|
||||||
|
taskItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingTask48());
|
||||||
|
EmptyPanel taskCategory=new EmptyPanel(AccountingType.TASK.name());
|
||||||
|
add(taskCategory, taskItemConf);
|
||||||
|
|
||||||
|
TabItemConfig jobItemConf = new TabItemConfig("Job", false);
|
||||||
|
jobItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingJob48());
|
||||||
|
EmptyPanel jobCategory=new EmptyPanel(AccountingType.JOB.name());
|
||||||
|
add(jobCategory, jobItemConf);
|
||||||
|
|
||||||
|
|
||||||
|
setActiveWidget(getWidget(0));
|
||||||
|
|
||||||
|
|
||||||
|
addSelectionHandler(new SelectionHandler<Widget>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<Widget> event) {
|
||||||
|
Widget widget = event.getSelectedItem();
|
||||||
|
if (widget instanceof EmptyPanel) {
|
||||||
|
EmptyPanel p=(EmptyPanel) widget;
|
||||||
|
AccountingMenuEvent accountMenuEvent=new AccountingMenuEvent(AccountingType.valueOf(p.getId()));
|
||||||
|
eventBus.fireEvent(accountMenuEvent);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.menu;
|
||||||
|
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class EmptyPanel extends ContentPanel {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
public EmptyPanel(String id){
|
||||||
|
this.id=id;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
setId(id);
|
||||||
|
setWidth(0);
|
||||||
|
setHeight(0);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setVisible(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.monitor;
|
||||||
|
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
|
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingMonitor extends AutoProgressMessageBox {
|
||||||
|
|
||||||
|
public AccountingMonitor(){
|
||||||
|
super("Waiting", "Please wait...");
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public AccountingMonitor(SafeHtml headingHtml, SafeHtml messageHtml) {
|
||||||
|
super(headingHtml, messageHtml);
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public AccountingMonitor(SafeHtml headingHtml) {
|
||||||
|
super(headingHtml);
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public AccountingMonitor(String headingHtml, String messageHtml) {
|
||||||
|
super(headingHtml, messageHtml);
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public AccountingMonitor(String headingHtml) {
|
||||||
|
super(headingHtml);
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create() {
|
||||||
|
setProgressText("Updating...");
|
||||||
|
auto();
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.properties;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriodMode;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface AccountingPeriodModePropertiesCombo extends
|
||||||
|
PropertyAccess<AccountingPeriodMode> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<AccountingPeriodMode> id();
|
||||||
|
|
||||||
|
LabelProvider<AccountingPeriodMode> label();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
|
||||||
|
.ribbon {
|
||||||
|
line-height: 13px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.resource;
|
||||||
|
|
||||||
|
import com.google.gwt.resources.client.CssResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface AccountingManagerCSS extends CssResource {
|
||||||
|
|
||||||
|
@ClassName("ribbon")
|
||||||
|
public String getRibbon();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.resource;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface AccountingManagerResources extends ClientBundle {
|
||||||
|
|
||||||
|
public static final AccountingManagerResources INSTANCE = GWT
|
||||||
|
.create(AccountingManagerResources.class);
|
||||||
|
|
||||||
|
@Source("AccountingManager.css")
|
||||||
|
AccountingManagerCSS accountingManagerCSS();
|
||||||
|
|
||||||
|
|
||||||
|
@Source("accounting-manager_128.png")
|
||||||
|
ImageResource accountingManager128();
|
||||||
|
|
||||||
|
@Source("accounting-storage_128.png")
|
||||||
|
ImageResource accountingStorage128();
|
||||||
|
|
||||||
|
@Source("accounting-service_128.png")
|
||||||
|
ImageResource accountingService128();
|
||||||
|
|
||||||
|
@Source("accounting-portlet_128.png")
|
||||||
|
ImageResource accountingPortlet128();
|
||||||
|
|
||||||
|
@Source("accounting-task_128.png")
|
||||||
|
ImageResource accountingTask128();
|
||||||
|
|
||||||
|
@Source("accounting-job_128.png")
|
||||||
|
ImageResource accountingJob128();
|
||||||
|
|
||||||
|
@Source("accounting-manager_48.png")
|
||||||
|
ImageResource accountingManager48();
|
||||||
|
|
||||||
|
@Source("accounting-storage_48.png")
|
||||||
|
ImageResource accountingStorage48();
|
||||||
|
|
||||||
|
@Source("accounting-service_48.png")
|
||||||
|
ImageResource accountingService48();
|
||||||
|
|
||||||
|
@Source("accounting-portlet_48.png")
|
||||||
|
ImageResource accountingPortlet48();
|
||||||
|
|
||||||
|
@Source("accounting-task_48.png")
|
||||||
|
ImageResource accountingTask48();
|
||||||
|
|
||||||
|
@Source("accounting-job_48.png")
|
||||||
|
ImageResource accountingJob48();
|
||||||
|
|
||||||
|
@Source("accounting-manager_32.png")
|
||||||
|
ImageResource accountingManager32();
|
||||||
|
|
||||||
|
@Source("accounting-storage_32.png")
|
||||||
|
ImageResource accountingStorage32();
|
||||||
|
|
||||||
|
@Source("accounting-service_32.png")
|
||||||
|
ImageResource accountingService32();
|
||||||
|
|
||||||
|
@Source("accounting-portlet_32.png")
|
||||||
|
ImageResource accountingPortlet32();
|
||||||
|
|
||||||
|
@Source("accounting-task_32.png")
|
||||||
|
ImageResource accountingTask32();
|
||||||
|
|
||||||
|
@Source("accounting-job_32.png")
|
||||||
|
ImageResource accountingJob32();
|
||||||
|
|
||||||
|
@Source("accounting-reload_16.png")
|
||||||
|
ImageResource accountingReload16();
|
||||||
|
|
||||||
|
@Source("accounting-reload_24.png")
|
||||||
|
ImageResource accountingReload24();
|
||||||
|
|
||||||
|
@Source("accounting-reload_32.png")
|
||||||
|
ImageResource accountingReload32();
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 734 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,39 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.rpc;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
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.exception.AccountingManagerServiceException;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RemoteServiceRelativePath("ams")
|
||||||
|
public interface AccountingManagerService extends RemoteService {
|
||||||
|
/**
|
||||||
|
* Get informations on the current user
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws AccountingManagerServiceException
|
||||||
|
*/
|
||||||
|
public UserInfo hello() throws AccountingManagerServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Accounting Series
|
||||||
|
*
|
||||||
|
* @param accountingType the resource on which to accounting
|
||||||
|
* @param seriesRequest filters and constraints descriptions
|
||||||
|
* @return
|
||||||
|
* @throws AccountingManagerServiceException
|
||||||
|
*/
|
||||||
|
public SeriesResponse getSeries(AccountingType accountingType, SeriesRequest seriesRequest) throws AccountingManagerServiceException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.rpc;
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
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 com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface AccountingManagerServiceAsync {
|
||||||
|
|
||||||
|
public static AccountingManagerServiceAsync INSTANCE = (AccountingManagerServiceAsync) GWT
|
||||||
|
.create(AccountingManagerService.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
void hello(AsyncCallback<UserInfo> callback);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Accounting Series
|
||||||
|
*
|
||||||
|
* @param accountingType the resource on which to accounting
|
||||||
|
* @param seriesRequest filters and constraints descriptions
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
void getSeries(AccountingType accountingType, SeriesRequest seriesRequest,AsyncCallback<SeriesResponse> callback);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.state;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
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>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingState implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5993049979009321365L;
|
||||||
|
private HashMap<AccountingType, AccountingStateData> clientState;
|
||||||
|
|
||||||
|
public AccountingState(){
|
||||||
|
clientState=new HashMap<AccountingType, AccountingStateData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AccountingStateData getState(AccountingType accountingType){
|
||||||
|
return clientState.get(accountingType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(AccountingType accountingType, AccountingStateData accountingStateData){
|
||||||
|
clientState.put(accountingType,accountingStateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AccountingState [clientState=" + clientState + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.state;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingStateData implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4853602427569285252L;
|
||||||
|
private AccountingType accountingType;
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
private SeriesResponse seriesResponse;
|
||||||
|
|
||||||
|
public AccountingStateData() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingStateData(AccountingType accountingType,
|
||||||
|
SeriesRequest seriesRequest, SeriesResponse seriesResponse) {
|
||||||
|
super();
|
||||||
|
this.accountingType = accountingType;
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
this.seriesResponse = seriesResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingType getAccountingType() {
|
||||||
|
return accountingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountingType(AccountingType accountingType) {
|
||||||
|
this.accountingType = accountingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesRequest getSeriesRequest() {
|
||||||
|
return seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeriesRequest(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesResponse getSeriesResponse() {
|
||||||
|
return seriesResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeriesResponse(SeriesResponse seriesResponse) {
|
||||||
|
this.seriesResponse = seriesResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AccountingStateData [accountingType=" + accountingType
|
||||||
|
+ ", seriesRequest=" + seriesRequest + ", seriesResponse="
|
||||||
|
+ seriesResponse + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum FiltersChangeType {
|
||||||
|
Update
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum SessionExpiredType {
|
||||||
|
EXPIRED,
|
||||||
|
EXPIREDONSERVER;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum StateChangeType {
|
||||||
|
Update,
|
||||||
|
Restore;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum UIStateType {
|
||||||
|
START,
|
||||||
|
WAITING;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Format {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a file size into a {@link String} representation adding the misure unit.
|
||||||
|
* @param size the file size.
|
||||||
|
* @return the textual representation.
|
||||||
|
*/
|
||||||
|
public static String fileSize(long size) {
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
if (size < 1024) {
|
||||||
|
text.append(size);
|
||||||
|
text.append(" bytes");
|
||||||
|
} else if (size < 1048576) {
|
||||||
|
text.append(Math.round(((size * 10) / 1024)) / 10);
|
||||||
|
text.append(" KB");
|
||||||
|
} else if (size < 1073741824) {
|
||||||
|
text.append(Math.round(((size * 10) / 1048576)) / 10);
|
||||||
|
text.append(" MB");
|
||||||
|
} else {
|
||||||
|
text.append(Math.round(((size * 10) / 1073741824)) / 10);
|
||||||
|
text.append(" GB");
|
||||||
|
}
|
||||||
|
return text.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.utils;
|
||||||
|
|
||||||
|
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InfoMessageBox extends MessageBox {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a message box with an info icon and the specified title and
|
||||||
|
* message.
|
||||||
|
*
|
||||||
|
* @param title
|
||||||
|
* the message box title
|
||||||
|
* @param message
|
||||||
|
* the message displayed in the message box
|
||||||
|
*/
|
||||||
|
public InfoMessageBox(String title, String message) {
|
||||||
|
super(title, message);
|
||||||
|
|
||||||
|
setIcon(ICONS.info());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.client.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.Callback;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
import com.sencha.gxt.widget.core.client.Component;
|
||||||
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class UtilsGXT3 {
|
||||||
|
public static void mask(Element element) {
|
||||||
|
XElement el = element.<XElement> cast();
|
||||||
|
el.mask("Loading...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void umask(Element element) {
|
||||||
|
element.<XElement> cast().unmask();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void alert(String title, String message) {
|
||||||
|
final AlertMessageBox d = new AlertMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void alert(String title, String message, final Callback<Component, Void> callback) {
|
||||||
|
final AlertMessageBox d = new AlertMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
Component comp=event.getSource();
|
||||||
|
callback.onSuccess(comp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void info(String title, String message) {
|
||||||
|
final InfoMessageBox d = new InfoMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String title, String message, final Callback<Component, Void> callback) {
|
||||||
|
final InfoMessageBox d = new InfoMessageBox(title, message);
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
Component comp=event.getSource();
|
||||||
|
callback.onSuccess(comp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerService;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.AccountingCaller;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
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.exception.AccountingManagerServiceException;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server side implementation of the RPC service.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AccountingManagerServiceImpl extends RemoteServiceServlet implements AccountingManagerService {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(AccountingManagerServiceImpl.class);
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init() throws ServletException {
|
||||||
|
super.init();
|
||||||
|
System.out.println("Fix JAXP: jdk.xml.entityExpansionLimit=0");
|
||||||
|
System.setProperty("jdk.xml.entityExpansionLimit", "0");
|
||||||
|
|
||||||
|
System.out.println("initializing AccountingManager");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public UserInfo hello() throws AccountingManagerServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
UserInfo userInfo = new UserInfo(aslSession.getUsername(),
|
||||||
|
aslSession.getGroupId(), aslSession.getGroupName(),
|
||||||
|
aslSession.getScope(), aslSession.getScopeName(),
|
||||||
|
aslSession.getUserEmailAddress(),
|
||||||
|
aslSession.getUserFullName());
|
||||||
|
return userInfo;
|
||||||
|
} catch (AccountingManagerServiceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("Hello(): " + e.getLocalizedMessage(), e);
|
||||||
|
throw new AccountingManagerServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SeriesResponse getSeries(AccountingType accountingType, SeriesRequest seriesRequest) throws AccountingManagerServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.getAslSession(session);
|
||||||
|
AccountingCaller accountingCaller=new AccountingCaller();
|
||||||
|
SeriesResponse seriesResponse=accountingCaller.getSeries(accountingType,seriesRequest);
|
||||||
|
|
||||||
|
return seriesResponse;
|
||||||
|
|
||||||
|
} catch (AccountingManagerServiceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("Hello(): " + e.getLocalizedMessage(), e);
|
||||||
|
throw new AccountingManagerServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerSessionExpiredException;
|
||||||
|
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>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SessionUtil {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
|
public static ASLSession getAslSession(HttpSession httpSession)
|
||||||
|
throws AccountingManagerSessionExpiredException {
|
||||||
|
String username = (String) httpSession
|
||||||
|
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
|
ASLSession session;
|
||||||
|
if (username == null) {
|
||||||
|
logger.warn("no user found in session, use test user");
|
||||||
|
/*throw new AccountingManagerSessionExpiredException("Session Expired!");*/
|
||||||
|
|
||||||
|
|
||||||
|
// Remove comment for Test
|
||||||
|
username = Constants.DEFAULT_USER;
|
||||||
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
|
||||||
|
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
||||||
|
session = SessionManager.getInstance().getASLSession(
|
||||||
|
httpSession.getId(), username);
|
||||||
|
session.setScope(scope);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
session = SessionManager.getInstance().getASLSession(
|
||||||
|
httpSession.getId(), username);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("SessionUtil: aslSession " + session.getUsername() + " "
|
||||||
|
+ session.getScope());
|
||||||
|
|
||||||
|
return session;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
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.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;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Service;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Storage;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Task;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBuilder;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryDirector;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4Job;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4Portlet;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4Service;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4Storage;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4Task;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseBuilder;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseDirector;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
|
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.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingCaller {
|
||||||
|
private static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingCaller.class);
|
||||||
|
|
||||||
|
public AccountingCaller() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesResponse getSeries(AccountingType accountingType,
|
||||||
|
SeriesRequest seriesRequest)
|
||||||
|
throws AccountingManagerServiceException {
|
||||||
|
try {
|
||||||
|
logger.debug("getSeries(): [AccountingType="+accountingType+" , seriesRequest=" + seriesRequest+"]");
|
||||||
|
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||||
|
.getInstance();
|
||||||
|
|
||||||
|
AccountingQueryBuilder queryBuilder = getAccountQueryBuilder(
|
||||||
|
accountingType, seriesRequest);
|
||||||
|
|
||||||
|
AccountingQueryDirector director = new AccountingQueryDirector();
|
||||||
|
director.setAccountingQueryBuilder(queryBuilder);
|
||||||
|
director.constructAccountingQuery();
|
||||||
|
AccountingQuery query = director.getAccountingQuery();
|
||||||
|
|
||||||
|
if (query == null) {
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error in invocation: Operation not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Info> infos = apq.query(query.getType(),
|
||||||
|
query.getTemporalConstraint(), null);
|
||||||
|
if (infos == null) {
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error retrieving list of info: list is null!");
|
||||||
|
}
|
||||||
|
logger.debug("Retrived Infos");
|
||||||
|
|
||||||
|
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||||
|
accountingType, infos);
|
||||||
|
|
||||||
|
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
|
||||||
|
seriesResponseDirector
|
||||||
|
.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||||
|
seriesResponseDirector.constructSeriesResponse();
|
||||||
|
SeriesResponse seriesResponse = seriesResponseDirector
|
||||||
|
.getSeriesResponse();
|
||||||
|
|
||||||
|
if (seriesResponse == null) {
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error creating series response!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return seriesResponse;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Error in GetSeries(): " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AccountingManagerServiceException(e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AccountingQueryBuilder getAccountQueryBuilder(
|
||||||
|
AccountingType accountingType, SeriesRequest seriesRequest)
|
||||||
|
throws AccountingManagerServiceException {
|
||||||
|
if (accountingType == null) {
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error accounting type is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (accountingType) {
|
||||||
|
case JOB:
|
||||||
|
return new AccountingQuery4Job(seriesRequest);
|
||||||
|
case PORTLET:
|
||||||
|
return new AccountingQuery4Portlet(seriesRequest);
|
||||||
|
case SERVICE:
|
||||||
|
return new AccountingQuery4Service(seriesRequest);
|
||||||
|
case STORAGE:
|
||||||
|
return new AccountingQuery4Storage(seriesRequest);
|
||||||
|
case TASK:
|
||||||
|
return new AccountingQuery4Task(seriesRequest);
|
||||||
|
default:
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error request type is unknow!");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||||
|
AccountingType accountingType, List<Info> infos)
|
||||||
|
throws AccountingManagerServiceException {
|
||||||
|
if (accountingType == null) {
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error accounting type is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (accountingType) {
|
||||||
|
case JOB:
|
||||||
|
return new SeriesResponse4Job(infos);
|
||||||
|
case PORTLET:
|
||||||
|
return new SeriesResponse4Portlet(infos);
|
||||||
|
case SERVICE:
|
||||||
|
return new SeriesResponse4Service(infos);
|
||||||
|
case STORAGE:
|
||||||
|
return new SeriesResponse4Storage(infos);
|
||||||
|
case TASK:
|
||||||
|
return new SeriesResponse4Task(infos);
|
||||||
|
default:
|
||||||
|
throw new AccountingManagerServiceException(
|
||||||
|
"Error request type is unknow!");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint.AggregationMode;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriodMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PeriodModeMap {
|
||||||
|
|
||||||
|
public static AggregationMode getMode(AccountingPeriodMode mode){
|
||||||
|
switch(mode){
|
||||||
|
case DAILY:
|
||||||
|
return AggregationMode.DAILY;
|
||||||
|
case HOURLY:
|
||||||
|
return AggregationMode.HOURLY;
|
||||||
|
case MILLISECONDLY:
|
||||||
|
return AggregationMode.MILLISECONDLY;
|
||||||
|
case MINUTELY:
|
||||||
|
return AggregationMode.MINUTELY;
|
||||||
|
case MONTHLY:
|
||||||
|
return AggregationMode.MONTHLY;
|
||||||
|
case SECONDLY:
|
||||||
|
return AggregationMode.SECONDLY;
|
||||||
|
case YEARLY:
|
||||||
|
return AggregationMode.YEARLY;
|
||||||
|
default:
|
||||||
|
return AggregationMode.YEARLY;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static AccountingPeriodMode getMode(AggregationMode mode){
|
||||||
|
switch(mode){
|
||||||
|
case DAILY:
|
||||||
|
return AccountingPeriodMode.DAILY;
|
||||||
|
case HOURLY:
|
||||||
|
return AccountingPeriodMode.HOURLY;
|
||||||
|
case MILLISECONDLY:
|
||||||
|
return AccountingPeriodMode.MILLISECONDLY;
|
||||||
|
case MINUTELY:
|
||||||
|
return AccountingPeriodMode.MINUTELY;
|
||||||
|
case MONTHLY:
|
||||||
|
return AccountingPeriodMode.MONTHLY;
|
||||||
|
case SECONDLY:
|
||||||
|
return AccountingPeriodMode.SECONDLY;
|
||||||
|
case YEARLY:
|
||||||
|
return AccountingPeriodMode.YEARLY;
|
||||||
|
default:
|
||||||
|
return AccountingPeriodMode.YEARLY;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery {
|
||||||
|
|
||||||
|
private Class<? extends SingleUsageRecord> type;
|
||||||
|
private TemporalConstraint temporalConstraint;
|
||||||
|
|
||||||
|
|
||||||
|
public AccountingQuery(Class<? extends SingleUsageRecord> type, TemporalConstraint temporalConstraint) {
|
||||||
|
super();
|
||||||
|
this.type = type;
|
||||||
|
this.temporalConstraint = temporalConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Class<? extends SingleUsageRecord> getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setType(Class<? extends SingleUsageRecord> type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TemporalConstraint getTemporalConstraint() {
|
||||||
|
return temporalConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||||
|
this.temporalConstraint = temporalConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AccountingQuery [type=" + type + ", temporalConstraint="
|
||||||
|
+ temporalConstraint + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.JobUsageRecord;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query 4 Job
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery4Job extends AccountingQueryBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingQuery4Job.class);
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public AccountingQuery4Job(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws AccountingManagerServiceException {
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||||
|
seriesRequest.getAccountingPeriod().getStartDate().getTime(),
|
||||||
|
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||||
|
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||||
|
.getPeriod()));
|
||||||
|
|
||||||
|
AccountingQuery invocation = new AccountingQuery(
|
||||||
|
JobUsageRecord.class, temporalConstraint);
|
||||||
|
|
||||||
|
accountingQuerySpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query 4 Portlet
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingQuery4Portlet.class);
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public AccountingQuery4Portlet(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws AccountingManagerServiceException {
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||||
|
seriesRequest.getAccountingPeriod().getStartDate().getTime(),
|
||||||
|
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||||
|
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||||
|
.getPeriod()));
|
||||||
|
|
||||||
|
AccountingQuery invocation = new AccountingQuery(
|
||||||
|
PortletUsageRecord.class, temporalConstraint);
|
||||||
|
|
||||||
|
accountingQuerySpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query 4 Service
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery4Service extends AccountingQueryBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingQuery4Service.class);
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public AccountingQuery4Service(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws AccountingManagerServiceException {
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||||
|
seriesRequest.getAccountingPeriod().getStartDate().getTime(),
|
||||||
|
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||||
|
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||||
|
.getPeriod()));
|
||||||
|
|
||||||
|
AccountingQuery invocation = new AccountingQuery(
|
||||||
|
ServiceUsageRecord.class, temporalConstraint);
|
||||||
|
|
||||||
|
accountingQuerySpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query 4 Storage
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingQuery4Storage.class);
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public AccountingQuery4Storage(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws AccountingManagerServiceException {
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||||
|
seriesRequest.getAccountingPeriod().getStartDate().getTime(),
|
||||||
|
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||||
|
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||||
|
.getPeriod()));
|
||||||
|
|
||||||
|
AccountingQuery invocation = new AccountingQuery(
|
||||||
|
StorageUsageRecord.class, temporalConstraint);
|
||||||
|
|
||||||
|
accountingQuerySpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query 4 Task
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AccountingQuery4Task.class);
|
||||||
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
|
public AccountingQuery4Task(SeriesRequest seriesRequest) {
|
||||||
|
this.seriesRequest = seriesRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws AccountingManagerServiceException {
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||||
|
seriesRequest.getAccountingPeriod().getStartDate().getTime(),
|
||||||
|
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||||
|
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||||
|
.getPeriod()));
|
||||||
|
|
||||||
|
AccountingQuery invocation = new AccountingQuery(
|
||||||
|
StorageUsageRecord.class, temporalConstraint);
|
||||||
|
|
||||||
|
accountingQuerySpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for build Accounting Query
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AccountingQueryBuilder {
|
||||||
|
protected AccountingQuerySpec accountingQuerySpec;
|
||||||
|
|
||||||
|
public AccountingQuerySpec getAccountingQuerySpec(){
|
||||||
|
return accountingQuerySpec;
|
||||||
|
}
|
||||||
|
public void createSpec(){
|
||||||
|
accountingQuerySpec=new AccountingQuerySpec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void buildOpEx() throws AccountingManagerServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query Director
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQueryDirector {
|
||||||
|
AccountingQueryBuilder accountingQueryBuilder;
|
||||||
|
|
||||||
|
public void setAccountingQueryBuilder(
|
||||||
|
AccountingQueryBuilder accountingQueryBuilder) {
|
||||||
|
this.accountingQueryBuilder = accountingQueryBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingQuery getAccountingQuery() {
|
||||||
|
return accountingQueryBuilder.getAccountingQuerySpec().getOp();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<AccountingQuery> getListOfAccountingQuery() {
|
||||||
|
return accountingQueryBuilder.getAccountingQuerySpec().getOps();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void constructAccountingQuery() throws AccountingManagerServiceException {
|
||||||
|
accountingQueryBuilder.createSpec();
|
||||||
|
accountingQueryBuilder.buildOpEx();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accounting Query Specification
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingQuerySpec {
|
||||||
|
private AccountingQuery op;
|
||||||
|
private ArrayList<AccountingQuery> ops;
|
||||||
|
|
||||||
|
public AccountingQuery getOp() {
|
||||||
|
return op;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOp(AccountingQuery op) {
|
||||||
|
this.op = op;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<AccountingQuery> getOps() {
|
||||||
|
return ops;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOps(ArrayList<AccountingQuery> ops) {
|
||||||
|
this.ops = ops;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response 4 Job
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponse4Job extends SeriesResponseBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(SeriesResponse4Job.class);
|
||||||
|
private List<Info> infos;
|
||||||
|
|
||||||
|
public SeriesResponse4Job(List<Info> infos) {
|
||||||
|
this.infos=infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
logger.debug("Infos: "+infos);
|
||||||
|
|
||||||
|
|
||||||
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
seriesResponseSpec.setSr(seriesResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response 4 Portlet
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponse4Portlet extends SeriesResponseBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(SeriesResponse4Portlet.class);
|
||||||
|
|
||||||
|
private List<Info> infos;
|
||||||
|
|
||||||
|
public SeriesResponse4Portlet(List<Info> infos) {
|
||||||
|
this.infos=infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
logger.debug("Infos: "+infos);
|
||||||
|
|
||||||
|
|
||||||
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
seriesResponseSpec.setSr(seriesResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.accounting.aggregation.ServiceUsageRecord;
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesServiceData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response 4 Service
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponse4Service extends SeriesResponseBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(SeriesResponse4Service.class);
|
||||||
|
private List<Info> infos;
|
||||||
|
|
||||||
|
public SeriesResponse4Service(List<Info> infos) {
|
||||||
|
this.infos=infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
try {
|
||||||
|
logger.debug("Infos: " + infos);
|
||||||
|
|
||||||
|
ArrayList<SeriesServiceData> series=new ArrayList<SeriesServiceData>();
|
||||||
|
for (Info info : infos) {
|
||||||
|
Date date = info.getDate();
|
||||||
|
JSONObject jso = info.getValue();
|
||||||
|
Long duration = jso.getLong(ServiceUsageRecord.DURATION);
|
||||||
|
Long operationCount = jso
|
||||||
|
.getLong(ServiceUsageRecord.OPERATION_COUNT);
|
||||||
|
Long maxInvocationTime = jso.getLong(ServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||||
|
Long minInvocationTime = jso.getLong(ServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||||
|
|
||||||
|
series.add(new SeriesServiceData(date, operationCount, duration, maxInvocationTime, minInvocationTime));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SeriesService seriesService = new SeriesService(series);
|
||||||
|
|
||||||
|
seriesResponseSpec.setSr(seriesService);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Error creating series for service accounting: "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AccountingManagerServiceException("Error creating series for service accounting: "+e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.accounting.aggregation.StorageUsageRecord;
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorageData;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response 4 Storage
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponse4Storage extends SeriesResponseBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(SeriesResponse4Storage.class);
|
||||||
|
private List<Info> infos;
|
||||||
|
|
||||||
|
public SeriesResponse4Storage(List<Info> infos) {
|
||||||
|
this.infos = infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
try {
|
||||||
|
logger.debug("Infos: " + infos);
|
||||||
|
|
||||||
|
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
||||||
|
for (Info info : infos) {
|
||||||
|
Date date = info.getDate();
|
||||||
|
JSONObject jso = info.getValue();
|
||||||
|
Long dataVolume = jso.getLong(StorageUsageRecord.DATA_VOLUME);
|
||||||
|
Long operationCount = jso
|
||||||
|
.getLong(StorageUsageRecord.OPERATION_COUNT);
|
||||||
|
series.add(new SeriesStorageData(date, dataVolume, operationCount));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SeriesStorage seriesStorage = new SeriesStorage(series);
|
||||||
|
|
||||||
|
seriesResponseSpec.setSr(seriesStorage);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Error creating series for storage accounting: "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AccountingManagerServiceException("Error creating series for storage accounting: "+e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response 4 Task
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponse4Task extends SeriesResponseBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(SeriesResponse4Task.class);
|
||||||
|
private List<Info> infos;
|
||||||
|
|
||||||
|
public SeriesResponse4Task(List<Info> infos) {
|
||||||
|
this.infos=infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
logger.debug("Infos: "+infos);
|
||||||
|
|
||||||
|
|
||||||
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
seriesResponseSpec.setSr(seriesResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for build Series Response
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class SeriesResponseBuilder {
|
||||||
|
protected SeriesResponseSpec seriesResponseSpec;
|
||||||
|
|
||||||
|
public SeriesResponseSpec getSeriesResponseSpec(){
|
||||||
|
return seriesResponseSpec;
|
||||||
|
}
|
||||||
|
public void createSpec(){
|
||||||
|
seriesResponseSpec=new SeriesResponseSpec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void buildSeriesResponse() throws AccountingManagerServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response Director
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponseDirector {
|
||||||
|
SeriesResponseBuilder seriesResponseBuilder;
|
||||||
|
|
||||||
|
public void setSeriesResponseBuilder(
|
||||||
|
SeriesResponseBuilder seriesResponseBuilder) {
|
||||||
|
this.seriesResponseBuilder = seriesResponseBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeriesResponse getSeriesResponse() {
|
||||||
|
return seriesResponseBuilder.getSeriesResponseSpec().getSr();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SeriesResponse> getListOfSeriesResponse() {
|
||||||
|
return seriesResponseBuilder.getSeriesResponseSpec().getSrs();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void constructSeriesResponse() throws AccountingManagerServiceException {
|
||||||
|
seriesResponseBuilder.createSpec();
|
||||||
|
seriesResponseBuilder.buildSeriesResponse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Series Response Specification
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SeriesResponseSpec {
|
||||||
|
private SeriesResponse sr;
|
||||||
|
private ArrayList<SeriesResponse> srs;
|
||||||
|
|
||||||
|
public SeriesResponse getSr() {
|
||||||
|
return sr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSr(SeriesResponse sr) {
|
||||||
|
this.sr = sr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SeriesResponse> getSrs() {
|
||||||
|
return srs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSrs(ArrayList<SeriesResponse> srs) {
|
||||||
|
this.srs = srs;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.server.portlet;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.portlet.GenericPortlet;
|
||||||
|
import javax.portlet.PortletException;
|
||||||
|
import javax.portlet.PortletRequestDispatcher;
|
||||||
|
import javax.portlet.RenderRequest;
|
||||||
|
import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingManagerPortlet extends GenericPortlet {
|
||||||
|
|
||||||
|
protected Logger logger = LoggerFactory.getLogger(AccountingManagerPortlet.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSP folder name
|
||||||
|
*/
|
||||||
|
public static final String JSP_FOLDER = "/WEB-INF/jsp/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String VIEW_JSP = JSP_FOLDER + "AccountingManagerPortlet_view.jsp";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param request .
|
||||||
|
* @param response .
|
||||||
|
* @throws IOException .
|
||||||
|
* @throws PortletException .
|
||||||
|
*/
|
||||||
|
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||||
|
|
||||||
|
logger.trace("TabularDataPortlet loading from JSP: "+VIEW_JSP);
|
||||||
|
|
||||||
|
logger.trace("setting context using ScopeHelper");
|
||||||
|
ScopeHelper.setContext(request);
|
||||||
|
|
||||||
|
logger.trace("passing to the render");
|
||||||
|
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
|
||||||
|
logger.trace("Call: "+VIEW_JSP);
|
||||||
|
rd.include(request,response);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.shared;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
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 = "AMLang";
|
||||||
|
public final static String DEFAULT_USER = "test.user";
|
||||||
|
public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
||||||
|
//public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingPeriod implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4241461469179338817L;
|
||||||
|
|
||||||
|
private Date startDate;
|
||||||
|
private Date endDate;
|
||||||
|
private AccountingPeriodMode period;
|
||||||
|
|
||||||
|
public AccountingPeriod(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingPeriod(Date startDate, Date endDate,
|
||||||
|
AccountingPeriodMode period) {
|
||||||
|
super();
|
||||||
|
this.startDate = startDate;
|
||||||
|
this.endDate = endDate;
|
||||||
|
this.period = period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(Date endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingPeriodMode getPeriod() {
|
||||||
|
return period;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriod(AccountingPeriodMode period) {
|
||||||
|
this.period = period;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AccountingPeriod [startDate=" + startDate + ", endDate="
|
||||||
|
+ endDate + ", period=" + period + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum AccountingPeriodMode {
|
||||||
|
YEARLY("Yearly"),
|
||||||
|
MONTHLY("Monthly"),
|
||||||
|
DAILY("Dayly"),
|
||||||
|
HOURLY("Hourly"),
|
||||||
|
MINUTELY("Minutely"),
|
||||||
|
SECONDLY("Secondly"),
|
||||||
|
MILLISECONDLY("Per Millisecond");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
private AccountingPeriodMode(final String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static AccountingPeriodMode getAccountingPeriodModeFromId(String id) {
|
||||||
|
if(id==null||id.isEmpty()) return null;
|
||||||
|
|
||||||
|
for (AccountingPeriodMode columnDataType : values()) {
|
||||||
|
if (columnDataType.id.compareToIgnoreCase(id) == 0) {
|
||||||
|
return columnDataType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<AccountingPeriodMode> asList() {
|
||||||
|
List<AccountingPeriodMode> list=Arrays.asList(values());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|