First import of the new version (made with bootstrap)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/vre-definition@128736 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
25649cf80d
commit
716553cf3b
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/vre-definition-new-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<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 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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-user.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-codeserver.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-dev.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA.jar" sourcepath="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/vre-definition-new-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<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="output" path="target/vre-definition-new-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vre-definition</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,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
|
@ -0,0 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/costantino/workspace/vre-definition-new/target/vre-definition-new-1.0.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
|
@ -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.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
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.5
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
validateFragments=false
|
||||
validation.use-project-settings=true
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="vre-definition-new-portlet">
|
||||
<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"/>
|
||||
<property name="java-output-path" value="/vre-definition-new/target/vre-definition-new-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<property name="context-root" value="vre-definition"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="java" version="1.5"/>
|
||||
<installed facet="liferay.portlet" version="6.0"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
|||
Window
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -0,0 +1 @@
|
|||
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}
|
|
@ -0,0 +1,13 @@
|
|||
log4j.rootLogger=DEBUG, A1
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Print the date in ISO 8601 format
|
||||
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
|
||||
|
||||
# Print only messages of level TRACE or above in the package org.gcube
|
||||
log4j.logger.org.gcube=TRACE
|
||||
log4j.logger.org.gcube.application.framework.core.session=INFO
|
||||
log4j.logger.com.netflix.astyanax.connectionpool=ERROR
|
||||
log4j.logger.org.gcube.portal.databook.server.DBCassandraAstyanaxImpl=TRACE
|
||||
log4j.logger.org.gcube.common=ERROR
|
|
@ -0,0 +1 @@
|
|||
${gcube.license}
|
|
@ -0,0 +1,67 @@
|
|||
The gCube System - ${name}
|
||||
--------------------------------------------------
|
||||
|
||||
${description}
|
||||
|
||||
|
||||
${gcube.description}
|
||||
|
||||
${gcube.funding}
|
||||
|
||||
|
||||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
${version} (${buildDate})
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
||||
Authors
|
||||
--------------------------------------------------
|
||||
|
||||
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
* Costantino Perciante (costantino.perciante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
* Costantino Perciante (costantino.perciante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
Download information
|
||||
--------------------------------------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from the gCube website:
|
||||
${gcube.website}
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------------------------------
|
||||
|
||||
Installation documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/
|
||||
|
||||
|
||||
Documentation
|
||||
--------------------------------------------------
|
||||
|
||||
Documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/
|
||||
${gcube.wikiRoot}/
|
||||
|
||||
Support
|
||||
--------------------------------------------------
|
||||
|
||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||
${gcube.issueTracking}
|
||||
|
||||
|
||||
Licensing
|
||||
--------------------------------------------------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,6 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-admin.vre-definition.1-0-0"
|
||||
date="2016-05-21">
|
||||
<Change>First version</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,42 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>changelog.xml</include>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>target/apidocs</directory>
|
||||
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.war</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>PortletAdmin</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>target/${build.finalName}.war</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,270 @@
|
|||
<?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">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>vre-definition-new</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>VRE Definition Portlet</name>
|
||||
<description>
|
||||
gCube VRE Definition Portlet shows a Wizard to create VREs.
|
||||
</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<liferayVersion>6.2.5</liferayVersion>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>provided</scope>
|
||||
<!-- put at provided for deploying -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-dev</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>compile</scope>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslvre</artifactId>
|
||||
<version>[5.2.0-SNAPSHOT,)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>provided</scope>
|
||||
<!-- put at provided for deploying -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>vremodeler-client-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<version>${liferayVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes"
|
||||
update them in DevMode -->
|
||||
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
|
||||
|
||||
<plugins>
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
|
||||
documentation at codehaus.org -->
|
||||
<configuration>
|
||||
<runTarget>VreDefinition.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
</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>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- SA Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client;
|
||||
|
||||
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.user.client.Window.Location;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
*/
|
||||
public class VREDefinition implements EntryPoint {
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
public void onModuleLoad() {
|
||||
ClientScopeHelper.getService().setScope(Location.getHref(), new AsyncCallback<Boolean>() {
|
||||
|
||||
public void onSuccess(Boolean result) {
|
||||
RootPanel.get("VREDefinitionDIV").add(new VREDefinitionPanel());
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertBlock errorScope = new AlertBlock(AlertType.ERROR);
|
||||
errorScope.setClose(false);
|
||||
errorScope.setText("Sorry, something wrong happened. Try to refresh the page or logout.");
|
||||
RootPanel.get("VREDefinitionDIV").add(errorScope);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,692 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.admin.vredefinition.client.ui.PageHeader;
|
||||
import org.gcube.portlets.admin.vredefinition.client.ui.ResourcesTable;
|
||||
import org.gcube.portlets.admin.vredefinition.client.ui.SummaryPanel;
|
||||
import org.gcube.portlets.admin.vredefinition.client.ui.VRECreationFormSkeleton;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Functionality;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Resource;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.ResourceCategory;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.VREDescriptionBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.AppendButton;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.Column;
|
||||
import com.github.gwtbootstrap.client.ui.Form;
|
||||
import com.github.gwtbootstrap.client.ui.HelpInline;
|
||||
import com.github.gwtbootstrap.client.ui.Row;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
|
||||
import com.github.gwtbootstrap.client.ui.resources.ButtonSize;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Tree;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
/**
|
||||
* The VREDefinitionPanel class contains the form to create/edit a VRE.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class VREDefinitionPanel extends Composite {
|
||||
|
||||
// async services
|
||||
VREDefinitionServiceAsync rpcService = GWT.create(VREDefinitionService.class);
|
||||
|
||||
// main panel
|
||||
private VerticalPanel mainPanel;
|
||||
|
||||
// skeleton
|
||||
private VRECreationFormSkeleton skeleton = new VRECreationFormSkeleton();
|
||||
|
||||
// summary panel
|
||||
private SummaryPanel summary = new SummaryPanel();
|
||||
|
||||
// main tab
|
||||
private TabPanel mainTabPanel = new TabPanel(Tabs.LEFT);
|
||||
|
||||
// tab panel for VRE information
|
||||
private Tab vreInformationTab = new Tab();
|
||||
|
||||
// the create vre button
|
||||
private Button createVREButton = new Button("Upload");
|
||||
|
||||
// retrieving information alert block
|
||||
private AlertBlock retrievingInformation = new AlertBlock(AlertType.INFO);
|
||||
|
||||
// hashmap to keep track of the selection of the subfunctionalities
|
||||
protected class SubFunctionalityClientBean{
|
||||
|
||||
private CheckBox checkbox;
|
||||
private Functionality subfunctionality;
|
||||
|
||||
SubFunctionalityClientBean(CheckBox checkbox, Functionality subfunctionality){
|
||||
|
||||
this.checkbox = checkbox;
|
||||
this.subfunctionality = subfunctionality;
|
||||
|
||||
}
|
||||
|
||||
public CheckBox getCheckbox() {
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
|
||||
public Functionality getSubfunctionality() {
|
||||
return subfunctionality;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, List<SubFunctionalityClientBean>> subFunctionalityBeansMap =
|
||||
new HashMap<String, List<VREDefinitionPanel.SubFunctionalityClientBean>>();
|
||||
|
||||
// keys of the hashmap returned by some rpc services
|
||||
private static final String DESIGNER = "Designer";
|
||||
private static final String MANAGER = "Manager";
|
||||
private static final String VRE_NAME_FIELD = "vreName";
|
||||
private static final String VRE_MANAGER_FIELD = "vreManager";
|
||||
private static final String VRE_DESIGNER_FIELD = "vreDesigner";
|
||||
private static final String VRE_DESCRIPTION_FIELD = "vreDescription";
|
||||
private static final String VRE_START_TIME_FIELD = "vreStartTime";
|
||||
private static final String VRE_END_TIME_FIELD = "vreEndTime";
|
||||
private static final String EDIT_MODE = "edit";
|
||||
|
||||
public VREDefinitionPanel(){
|
||||
|
||||
super();
|
||||
|
||||
// create main panel
|
||||
mainPanel = new VerticalPanel();
|
||||
|
||||
// init
|
||||
initWidget(mainPanel);
|
||||
|
||||
// set its style
|
||||
mainPanel.addStyleName("vre-definition-main-panel");
|
||||
|
||||
// add the main tab panel to the main panel
|
||||
mainPanel.add(mainTabPanel);
|
||||
|
||||
// add skeleton as tab
|
||||
vreInformationTab.setHeading("VRE Information");
|
||||
vreInformationTab.add(skeleton);
|
||||
|
||||
// add and set as selected
|
||||
mainTabPanel.add(vreInformationTab);
|
||||
mainTabPanel.selectTab(0);
|
||||
|
||||
// add loader to skeletonTab
|
||||
retrievingInformation.setClose(false);
|
||||
retrievingInformation.setText("Retrieving information, please wait...");
|
||||
vreInformationTab.add(retrievingInformation);
|
||||
|
||||
// require designers/managers information or retrieve a previous bean saved into section
|
||||
rpcService.getVRE(new AsyncCallback<Map<String,Serializable>>() {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onSuccess(Map<String, Serializable> result) {
|
||||
|
||||
// remove loader
|
||||
vreInformationTab.remove(retrievingInformation);
|
||||
|
||||
if(result != null && !result.isEmpty()){
|
||||
|
||||
retrievingInformation.setText("Retrieving functionalities, please wait...");
|
||||
vreInformationTab.add(retrievingInformation);
|
||||
|
||||
boolean editMode = (Boolean) result.get(EDIT_MODE);
|
||||
|
||||
// check edit mode
|
||||
if(editMode){
|
||||
|
||||
skeleton.setVREDesigner((String)result.get(VRE_DESIGNER_FIELD));
|
||||
skeleton.setVREManagers((List<String>)result.get(MANAGER), (String)result.get(VRE_MANAGER_FIELD)); // pass all the managers plus the selected one
|
||||
skeleton.setVREName((String)result.get(VRE_NAME_FIELD));
|
||||
skeleton.setVREDescription((String)result.get(VRE_DESCRIPTION_FIELD));
|
||||
skeleton.setVREFromDate((Date)result.get(VRE_START_TIME_FIELD));
|
||||
skeleton.setVREToDate((Date)result.get(VRE_END_TIME_FIELD));
|
||||
|
||||
}else{
|
||||
skeleton.setVREDesigner((String)result.get(DESIGNER));
|
||||
skeleton.setVREManagers((List<String>)result.get(MANAGER), null);
|
||||
}
|
||||
|
||||
// require functionalities
|
||||
requireFunctionalities(editMode, mainTabPanel);
|
||||
|
||||
}else
|
||||
showErrors("Unable to retrieve the current designer and managers for this Virtual Organization");
|
||||
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
// remove loader
|
||||
vreInformationTab.remove(retrievingInformation);
|
||||
showErrors("Unable to retrieve the current designer and managers for this Virtual Organization");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Require the list of functionalities
|
||||
* @param mainTabPanel
|
||||
*/
|
||||
private void requireFunctionalities(boolean isEditMode, final TabPanel mainTabPanel) {
|
||||
// require the list of functionalities
|
||||
rpcService.getFunctionality(isEditMode, new AsyncCallback<ArrayList<Functionality>>() {
|
||||
|
||||
public void onSuccess(final ArrayList<Functionality> result) {
|
||||
|
||||
// remove info
|
||||
vreInformationTab.remove(retrievingInformation);
|
||||
|
||||
if(result != null){
|
||||
|
||||
// put these widgets into the skeleton as rows
|
||||
for (final Functionality functionality : result) {
|
||||
|
||||
// create a tab
|
||||
Tab functionalityTab = new Tab();
|
||||
functionalityTab.setHeading(functionality.getName());
|
||||
|
||||
// the header row of each macro functionality will look like
|
||||
// Title - Subtitle
|
||||
Row mainRow = new Row();
|
||||
|
||||
// title and subtitle of the macrofunctionality
|
||||
PageHeader header = new PageHeader();
|
||||
header.setText(functionality.getName(), functionality.getDescription());
|
||||
mainRow.add(header);
|
||||
|
||||
// get subfunctionalities
|
||||
List<Functionality> children = functionality.getSubFunctionalities();
|
||||
|
||||
// if there are more than two, we add a button to select/deselect them all
|
||||
if(children.size() >= 2){
|
||||
|
||||
// Select/Deselect sub-functionalities button
|
||||
final Button selectDeselectAll = new Button("Select All");
|
||||
selectDeselectAll.setTitle("Select all the sub-functionalities");
|
||||
selectDeselectAll.setType(ButtonType.LINK);
|
||||
selectDeselectAll.setSize(ButtonSize.LARGE);
|
||||
selectDeselectAll.addStyleName("select-deselect-button-style");
|
||||
|
||||
final Boolean[] selectedAll = new Boolean[0];
|
||||
selectedAll[0] = false;
|
||||
|
||||
// add an handler to the button Select/Deselect All
|
||||
selectDeselectAll.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
// get the list from the hashmap
|
||||
List<VREDefinitionPanel.SubFunctionalityClientBean> listSubfs =
|
||||
subFunctionalityBeansMap.get(functionality.getName());
|
||||
|
||||
// select/deselect all the subfunctionalities within the list for this macrofunctionality
|
||||
if(!selectedAll[0]){
|
||||
|
||||
// swap to deselect all
|
||||
selectDeselectAll.setTitle("Deselect all the sub-functionalities");
|
||||
selectDeselectAll.setText("Deselect All");
|
||||
|
||||
for(VREDefinitionPanel.SubFunctionalityClientBean subBean : listSubfs){
|
||||
subBean.getCheckbox().setValue(true);
|
||||
subBean.getSubfunctionality().setSelected(true);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
// swap to select all
|
||||
selectDeselectAll.setTitle("Select all the sub-functionalities");
|
||||
selectDeselectAll.setText("Select All");
|
||||
|
||||
for(VREDefinitionPanel.SubFunctionalityClientBean subBean : listSubfs){
|
||||
subBean.getCheckbox().setValue(false);
|
||||
subBean.getSubfunctionality().setSelected(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// swap status
|
||||
selectedAll[0] = !selectedAll[0];
|
||||
}
|
||||
});
|
||||
|
||||
mainRow.add(selectDeselectAll);
|
||||
|
||||
}
|
||||
// append the whole row to the container
|
||||
functionalityTab.add(mainRow);
|
||||
|
||||
mainTabPanel.add(functionalityTab);
|
||||
|
||||
if(children != null){
|
||||
for(final Functionality child: children){
|
||||
|
||||
// create a row for the subfunctionality
|
||||
Row subFunctionalityRow = new Row();
|
||||
|
||||
// put all the stuff into a form
|
||||
Form subFunctionalityForm = new Form();
|
||||
subFunctionalityForm.addStyleName("subfunctionality-form");
|
||||
|
||||
// select subfunctionality checkbox
|
||||
CheckBox checkBoxSubfunctionality = new CheckBox();
|
||||
checkBoxSubfunctionality.setText(child.getName());
|
||||
checkBoxSubfunctionality.setValue(child.isSelected()); // Auth for example is already set
|
||||
checkBoxSubfunctionality.addStyleName("subfunctionality-textbox");
|
||||
|
||||
// add handler to this checkbox
|
||||
checkBoxSubfunctionality.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
|
||||
child.setSelected(event.getValue());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// subfunctionality description
|
||||
HelpInline helpBlock = new HelpInline();
|
||||
helpBlock.setText(child.getDescription());
|
||||
|
||||
|
||||
subFunctionalityForm.add(checkBoxSubfunctionality);
|
||||
subFunctionalityForm.add(helpBlock);
|
||||
|
||||
// add form to row
|
||||
subFunctionalityRow.add(subFunctionalityForm);
|
||||
|
||||
// insert this entry <MacroFunc, <SubFunc, CheckBox>> to the map
|
||||
if(subFunctionalityBeansMap.containsKey(functionality.getName())){
|
||||
|
||||
// we need to update the list
|
||||
List<VREDefinitionPanel.SubFunctionalityClientBean> oldList =
|
||||
subFunctionalityBeansMap.get(functionality.getName());
|
||||
|
||||
oldList.add(new SubFunctionalityClientBean(checkBoxSubfunctionality, child));
|
||||
|
||||
}else{
|
||||
|
||||
// there is not yet such macro functionality
|
||||
List<VREDefinitionPanel.SubFunctionalityClientBean> newList = new ArrayList<SubFunctionalityClientBean>();
|
||||
newList.add(new SubFunctionalityClientBean(checkBoxSubfunctionality, child));
|
||||
|
||||
// put into the hashmap
|
||||
subFunctionalityBeansMap.put(functionality.getName(), newList);
|
||||
|
||||
}
|
||||
|
||||
// append to the main row
|
||||
functionalityTab.add(subFunctionalityRow);
|
||||
|
||||
// iterate over resources (of the subfunctionality)
|
||||
List<ResourceCategory> categoryResources = child.getResources();
|
||||
|
||||
if(categoryResources != null){
|
||||
for (ResourceCategory resourceCategory : categoryResources) {
|
||||
|
||||
// skip the category and go to its children (i.e. the resources)
|
||||
List<Resource> resources = resourceCategory.getItems();
|
||||
|
||||
// if there are resources, add a filter widget to the form and a table
|
||||
if(resources.size() > 0){
|
||||
|
||||
AppendButton apButton = new AppendButton();
|
||||
|
||||
TextBox searchBox = new TextBox();
|
||||
searchBox.setPlaceholder("Filter by name");
|
||||
Button searchButton = new Button();
|
||||
searchButton.setIcon(IconType.SEARCH);
|
||||
searchButton.setIconSize(IconSize.DEFAULT);
|
||||
searchButton.setType(ButtonType.DEFAULT);
|
||||
|
||||
apButton.add(searchBox);
|
||||
apButton.add(searchButton);
|
||||
|
||||
apButton.addStyleName("filter-functionalities-box");
|
||||
subFunctionalityForm.add(apButton);
|
||||
|
||||
// create a table whose rows are
|
||||
//<Name, Description, Select> and show the first 5 rows
|
||||
ResourcesTable table = new ResourcesTable(resources, apButton, checkBoxSubfunctionality);
|
||||
|
||||
// append to the form
|
||||
subFunctionalityForm.add(table);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add SummaryTabPane
|
||||
final Tab summaryTab = new Tab();
|
||||
summaryTab.setHeading("Summary");
|
||||
summaryTab.add(summary);
|
||||
summaryTab.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
onGenerateSummarySubmit(result, summaryTab);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// add to the tab panel
|
||||
mainTabPanel.add(summaryTab);
|
||||
|
||||
}else{
|
||||
|
||||
// remove info
|
||||
vreInformationTab.remove(retrievingInformation);
|
||||
showErrors("Unable to retrieve VRE functionalities");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
// remove info
|
||||
vreInformationTab.remove(retrievingInformation);
|
||||
showErrors("Unable to retrieve VRE functionalities");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate summary
|
||||
* @param result
|
||||
* @param summaryTab
|
||||
*/
|
||||
private void onGenerateSummarySubmit(final ArrayList<Functionality> result, final Tab summaryTab) {
|
||||
|
||||
// we need to generate the current summary and check if something wrong is present (e.g., vre's name missing)
|
||||
final String vreName = skeleton.getCurrentVREName();
|
||||
String vreDesigner = skeleton.getCurrentVREDesigner();
|
||||
String vreSelectedManager = skeleton.getCurrentVREManager();
|
||||
String vreDescription = skeleton.getCurrentVREDescription();
|
||||
Date vreStartDate = skeleton.getCurrentVREStartDate();
|
||||
Date vreToDate = skeleton.getCurrentVREToDate();
|
||||
|
||||
// check errors: vreName, vreDesigner, vreDescription cannot be empty
|
||||
if(vreName.isEmpty() || vreName.contains(" ")){
|
||||
|
||||
Timer t = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
mainTabPanel.selectTab(0);
|
||||
|
||||
}
|
||||
};
|
||||
t.schedule(100);
|
||||
skeleton.showAlertBlockVREName();
|
||||
return;
|
||||
}
|
||||
|
||||
if(vreDescription.isEmpty() || vreDescription.trim().length() == 0){
|
||||
skeleton.showAlertBlockVREDescritption();
|
||||
Timer t = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
mainTabPanel.selectTab(0);
|
||||
|
||||
}
|
||||
};
|
||||
t.schedule(100);
|
||||
return;
|
||||
}
|
||||
|
||||
// we can show the panel
|
||||
summary.setVisible(true);
|
||||
|
||||
// ok, we can create the bean
|
||||
final VREDescriptionBean vreDescriptionBean = new VREDescriptionBean(vreName, vreDescription, vreDesigner, vreSelectedManager, vreStartDate, vreToDate);
|
||||
|
||||
// clear functionalities panel
|
||||
summary.clearFunctionalitiesPanel();
|
||||
|
||||
// collect information on functionalities/subfunctionalities/resources selected and show them
|
||||
for(Functionality macroFunctionality: result){
|
||||
|
||||
// get its name
|
||||
String name = macroFunctionality.getName();
|
||||
|
||||
// start building a tree having as root this macro functionality
|
||||
Tree t = new Tree();
|
||||
TreeItem root = new TreeItem();
|
||||
root.setText(name);
|
||||
t.addItem(root);
|
||||
|
||||
// panel to add later to the summary for this macrofunctionality
|
||||
VerticalPanel partialSummaryFunctionality = new VerticalPanel();
|
||||
partialSummaryFunctionality.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
|
||||
// get the child list
|
||||
List<Functionality> subfunctionalities = macroFunctionality.getSubFunctionalities();
|
||||
|
||||
for (Functionality subfunctionality : subfunctionalities) {
|
||||
|
||||
// set as name the subfunctionality
|
||||
TreeItem subfuncItem = new TreeItem();
|
||||
subfuncItem.setText(subfunctionality.getName());
|
||||
|
||||
if(subfunctionality.isSelected()){
|
||||
|
||||
// add to the root
|
||||
root.addItem(subfuncItem);
|
||||
|
||||
// we need the categories but we need not to put theme into the tree
|
||||
List<ResourceCategory> categories = subfunctionality.getResources();
|
||||
|
||||
if(categories == null)
|
||||
continue;
|
||||
|
||||
for (ResourceCategory resourceCategory : categories) {
|
||||
|
||||
// iterate over its resources
|
||||
ArrayList<Resource> resources = resourceCategory.getItems();
|
||||
|
||||
for (Resource resource : resources) {
|
||||
if(resource.isSelected()){
|
||||
|
||||
TreeItem resourceItem = new TreeItem();
|
||||
resourceItem.setText(resource.getName());
|
||||
|
||||
// add to the subfunctionality
|
||||
subfuncItem.addItem(resourceItem);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add the tree to the summary
|
||||
partialSummaryFunctionality.add(t);
|
||||
summary.addFunctionality(partialSummaryFunctionality);
|
||||
|
||||
}
|
||||
|
||||
// fill the summary panel with main information
|
||||
summary.setVreMainInformation(vreName, vreSelectedManager, vreDesigner, vreDescription, vreStartDate, vreToDate);
|
||||
|
||||
// add the summary
|
||||
summaryTab.add(summary);
|
||||
|
||||
// add the buttons into a flow panel
|
||||
final FlowPanel summaryButtons = new FlowPanel();
|
||||
summaryButtons.addStyleName("summary-buttons-panel");
|
||||
summaryButtons.add(createVREButton);
|
||||
summaryTab.add(summaryButtons);
|
||||
|
||||
// add style to goBackToDefinition button
|
||||
|
||||
// set as primary the create one
|
||||
createVREButton.setType(ButtonType.PRIMARY);
|
||||
|
||||
// make them large
|
||||
createVREButton.setSize(ButtonSize.LARGE);
|
||||
|
||||
|
||||
// add handler to createVRE button
|
||||
createVREButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
boolean confirmed = Window.confirm("Do you want to create " + vreName + " ?");
|
||||
|
||||
// disable buttons
|
||||
createVREButton.setEnabled(false);
|
||||
|
||||
if(confirmed){
|
||||
|
||||
// add waiting block
|
||||
final AlertBlock waitingCreation = new AlertBlock(AlertType.INFO);
|
||||
waitingCreation.setText("Please wait...");
|
||||
waitingCreation.setClose(false);
|
||||
summaryTab.add(waitingCreation);
|
||||
|
||||
// try to set the vre
|
||||
rpcService.setVRE(vreDescriptionBean, result, new AsyncCallback<Boolean>() {
|
||||
|
||||
public void onSuccess(Boolean result) {
|
||||
|
||||
// remove waiting
|
||||
summaryTab.remove(waitingCreation);
|
||||
|
||||
// add alert block
|
||||
addAlertOnCreation(vreName, result, summaryTab);
|
||||
|
||||
// remove the buttons
|
||||
if(result)
|
||||
summaryTab.remove(summaryButtons);
|
||||
else{
|
||||
// enable again
|
||||
createVREButton.setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
// remove waiting
|
||||
summaryTab.remove(waitingCreation);
|
||||
|
||||
// add alert block
|
||||
addAlertOnCreation(vreName, false, summaryTab);
|
||||
|
||||
// enable again
|
||||
createVREButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// enable again
|
||||
createVREButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show errors on async request
|
||||
*/
|
||||
private void showErrors(String msg){
|
||||
|
||||
skeleton.removeLoader();
|
||||
|
||||
// error block
|
||||
AlertBlock errorMsg = new AlertBlock();
|
||||
errorMsg.setType(AlertType.ERROR);
|
||||
errorMsg.setClose(false);
|
||||
errorMsg.setText(msg);
|
||||
|
||||
// put it into a column of width 12
|
||||
Row errorRow = new Row();
|
||||
Column errorCol = new Column(12);
|
||||
errorCol.add(errorMsg);
|
||||
errorRow.add(errorCol);
|
||||
|
||||
// pass to the skeleton
|
||||
skeleton.appendRow(errorRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* After creation show an alert message
|
||||
* @param vreName
|
||||
* @param success
|
||||
* @param summaryTab
|
||||
*/
|
||||
private void addAlertOnCreation(String vreName, boolean success, final Tab summaryTab){
|
||||
|
||||
String msg = "VRE with name " + vreName;
|
||||
if(success)
|
||||
msg += " created correctly!";
|
||||
else
|
||||
msg += " not created. Please retry later.";
|
||||
|
||||
final AlertBlock confirmation = new AlertBlock(msg);
|
||||
|
||||
if(success)
|
||||
confirmation.setType(AlertType.SUCCESS);
|
||||
else
|
||||
confirmation.setType(AlertType.ERROR);
|
||||
|
||||
// add to the panel
|
||||
summaryTab.add(confirmation);
|
||||
|
||||
// remove after a while
|
||||
Timer t = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
summaryTab.remove(confirmation);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// remove after two seconds
|
||||
t.schedule(2000);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Functionality;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.VREDescriptionBean;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.exception.VREDefinitionException;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
||||
@RemoteServiceRelativePath("VREDefinitionServiceImpl")
|
||||
public interface VREDefinitionService extends RemoteService {
|
||||
|
||||
/**
|
||||
* Retrieve VRE (that is going to be created) information
|
||||
* @return an hashmap with a VREDefinitionBean object, a vre designer and
|
||||
* some vre managers (if any).
|
||||
*/
|
||||
Map<String, Serializable> getVRE();
|
||||
|
||||
/**
|
||||
* Request the vre functionalities to show (the returned object is a tree like structure that could be navigated)
|
||||
* @param isEdit
|
||||
* @return
|
||||
* @throws VREDefinitionException
|
||||
*/
|
||||
ArrayList<Functionality> getFunctionality(boolean isEdit) throws VREDefinitionException;
|
||||
|
||||
/**
|
||||
* Create a VRE with the definition information included into the description bean and
|
||||
* with the functionalities set into the functionalities array list
|
||||
* @param bean
|
||||
* @param functionalities
|
||||
* @return
|
||||
* @throws VREDefinitionException
|
||||
*/
|
||||
boolean setVRE(VREDescriptionBean bean, ArrayList<Functionality> functionalities) throws VREDefinitionException;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Functionality;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.VREDescriptionBean;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public interface VREDefinitionServiceAsync {
|
||||
|
||||
void getVRE(AsyncCallback<Map<String, Serializable>> callback);
|
||||
|
||||
void getFunctionality(boolean isEdit, AsyncCallback<ArrayList<Functionality>> callback);
|
||||
|
||||
void setVRE(VREDescriptionBean bean,
|
||||
ArrayList<Functionality> functionalities,
|
||||
AsyncCallback<Boolean> callback);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client.ui;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.HeadingElement;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class PageHeader extends Composite{
|
||||
|
||||
private static PageHeaderUiBinder uiBinder = GWT
|
||||
.create(PageHeaderUiBinder.class);
|
||||
|
||||
interface PageHeaderUiBinder extends UiBinder<Widget, PageHeader> {
|
||||
}
|
||||
|
||||
public PageHeader() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
icon.addStyleName("icon-style");
|
||||
popoverInfo.setPlacement(Placement.BOTTOM);
|
||||
popoverInfo.setHtml(true);
|
||||
}
|
||||
|
||||
@UiField HeadingElement mainText;
|
||||
@UiField Popover popoverInfo;
|
||||
@UiField Icon icon;
|
||||
|
||||
/**
|
||||
* Set the main text
|
||||
*/
|
||||
public void setText(String text, String subtext){
|
||||
mainText.setInnerHTML(text);
|
||||
popoverInfo.setHeading("<b>" + text + "</b>");
|
||||
popoverInfo.setText(subtext);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<g:HTMLPanel>
|
||||
<div
|
||||
style="padding-bottom: 9px!important; margin: 20px 0 30px!important; border-bottom: 1px solid #eee!important;">
|
||||
<h1 ui:field="mainText" style="display:inline; margin-left: 40px; margin-right: 20px;">
|
||||
</h1>
|
||||
<b:Popover ui:field="popoverInfo">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="icon"/>
|
||||
</b:Popover>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,456 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Resource;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AppendButton;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CellTable;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.SimplePager;
|
||||
import com.github.gwtbootstrap.client.ui.SimplePager.TextLocation;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.cell.client.Cell;
|
||||
import com.google.gwt.cell.client.Cell.Context;
|
||||
import com.google.gwt.cell.client.CheckboxCell;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.NativeEvent;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyDownEvent;
|
||||
import com.google.gwt.event.dom.client.KeyDownHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.Range;
|
||||
|
||||
/**
|
||||
* The resources table class.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class ResourcesTable extends Composite{
|
||||
|
||||
// the data provider
|
||||
protected ListDataProvider<Resource> dataProvider = new ListDataProvider<Resource>();
|
||||
|
||||
// the table that will be displayed
|
||||
private CellTable<Resource> table = new CellTable<Resource>();
|
||||
|
||||
// save original list
|
||||
private List<Resource> originalResources;
|
||||
|
||||
// max row to show
|
||||
private static final int MAX_ROW_TO_SHOW_BEGINNING = 10;
|
||||
|
||||
// TextBox and Button for filtering
|
||||
private TextBox searchBox;
|
||||
private Button searchButton;
|
||||
|
||||
private Boolean isFilteringEnabled = false;
|
||||
|
||||
// show all or switch to pagination button
|
||||
private Button showAllButton = new Button();
|
||||
|
||||
// select all rows button
|
||||
private Button selectAllRows = new Button();
|
||||
|
||||
// status
|
||||
private boolean allRowsSelected = false;
|
||||
|
||||
// main panel
|
||||
private VerticalPanel mainPanel = new VerticalPanel();
|
||||
|
||||
// keep track of the number of checked resources
|
||||
private int checkedResourcesNumber = 0;
|
||||
|
||||
// father checkbox (if at least one of the resources is checked, it must be checked as well)
|
||||
// we need to call the CheckBox.checkHandler that also selects the associated subfunctionality
|
||||
public ResourcesTable(List<Resource> resources, AppendButton apButton, final CheckBox checkBoxSubfunctionality){
|
||||
|
||||
super();
|
||||
initWidget(mainPanel);
|
||||
|
||||
// set panel width
|
||||
mainPanel.setWidth("100%");
|
||||
|
||||
// save original resources
|
||||
this.originalResources = resources;
|
||||
|
||||
// add data to the provider
|
||||
dataProvider.setList(resources);
|
||||
dataProvider.addDataDisplay(table);
|
||||
|
||||
// style of the table
|
||||
table.setStriped(true);
|
||||
table.setWidth("100%", false);
|
||||
table.addStyleName("table-style");
|
||||
table.setBordered(true);
|
||||
|
||||
// visible rows
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
table.setRowCount(resources.size(), true);
|
||||
|
||||
// add handler to apButton (that contains the searchBox textbox and the search button)
|
||||
searchBox = (TextBox)apButton.getWidget(0);
|
||||
searchButton = (Button)apButton.getWidget(1);
|
||||
|
||||
// add handlers on click as well as on key down
|
||||
searchBox.addKeyDownHandler(new KeyDownHandler() {
|
||||
|
||||
public void onKeyDown(KeyDownEvent event) {
|
||||
event.preventDefault();
|
||||
searchOnKeyDown(event);
|
||||
}
|
||||
});
|
||||
|
||||
// add the handler
|
||||
searchButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
event.preventDefault();
|
||||
boolean[] isFilteringEnabledReference = {isFilteringEnabled};
|
||||
searchOnClickEvent(event, isFilteringEnabledReference);
|
||||
isFilteringEnabled = isFilteringEnabledReference[0];
|
||||
}
|
||||
});
|
||||
|
||||
// Add a checked column to show the address.
|
||||
Column<Resource, Boolean> chosenColumn = new Column<Resource, Boolean>(new CheckboxCell(true,false)) {
|
||||
|
||||
@Override
|
||||
public Boolean getValue(Resource object) {
|
||||
return object.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Cell.Context context, final Element parent, final Resource user, NativeEvent event) {
|
||||
event.preventDefault();
|
||||
|
||||
if(!"change".equals(event.getType()))
|
||||
return;
|
||||
|
||||
user.setSelected(!user.isSelected());
|
||||
|
||||
// update checked elements
|
||||
checkedResourcesNumber = user.isSelected() ? checkedResourcesNumber + 1 : checkedResourcesNumber - 1;
|
||||
|
||||
// deselect the father
|
||||
if(checkedResourcesNumber == 0)
|
||||
checkBoxSubfunctionality.setValue(false, true);
|
||||
else
|
||||
checkBoxSubfunctionality.setValue(true, true);
|
||||
|
||||
// refresh data
|
||||
dataProvider.refresh();
|
||||
}
|
||||
};
|
||||
table.addColumn(chosenColumn, "Select");
|
||||
|
||||
// Add a text column to show the name (and make it sortable)
|
||||
TextColumn<Resource> nameColumn = new TextColumn<Resource>() {
|
||||
@Override
|
||||
public String getValue(Resource object) {
|
||||
return object.getName();
|
||||
}
|
||||
};
|
||||
|
||||
ListHandler<Resource> nameColHandler = new ListHandler<Resource>(dataProvider.getList());
|
||||
nameColHandler.setComparator(nameColumn, new Comparator<Resource>() {
|
||||
|
||||
public int compare(Resource o1, Resource o2) {
|
||||
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
|
||||
}
|
||||
});
|
||||
nameColumn.setSortable(true);
|
||||
nameColumn.setDefaultSortAscending(false);
|
||||
table.addColumnSortHandler(nameColHandler);
|
||||
table.addColumn(nameColumn, "Name");
|
||||
|
||||
// Add a date column to show the description (and make it sortable)
|
||||
TextColumn<Resource> descColumn = new TextColumn<Resource>() {
|
||||
@Override
|
||||
public String getValue(Resource object) {
|
||||
return object.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, Resource object,
|
||||
SafeHtmlBuilder sb) {
|
||||
|
||||
// keep the first 120 chars
|
||||
boolean trunk = object.getDescription().length() > 120;
|
||||
String toShow = trunk ? object.getDescription().substring(0, 120) : object.getDescription();
|
||||
HTML htmlDescription;
|
||||
String randomPar = Document.get().createUniqueId();
|
||||
|
||||
// escape full description
|
||||
String escapedFullDescription = object.getDescription().replaceAll("'", "");
|
||||
escapedFullDescription = escapedFullDescription.replaceAll("\"", "");
|
||||
|
||||
if(trunk)
|
||||
htmlDescription = new HTML("<p id=\"" + randomPar + "\" >" + toShow + "..." +
|
||||
"<a style=\"cursor:pointer;\" onclick=\"javascript:document.getElementById('"+randomPar+"').innerHTML='" + escapedFullDescription + "'\">See more</a>" +
|
||||
"</p>");
|
||||
else
|
||||
htmlDescription = new HTML("<p>" + toShow + "</p>");
|
||||
|
||||
sb.appendHtmlConstant(htmlDescription.getHTML());
|
||||
}
|
||||
|
||||
};
|
||||
ListHandler<Resource> descColHandler = new ListHandler<Resource>(dataProvider.getList());
|
||||
descColHandler.setComparator(descColumn, new Comparator<Resource>() {
|
||||
|
||||
public int compare(Resource o1, Resource o2) {
|
||||
|
||||
return o1.getDescription().compareTo(o2.getDescription());
|
||||
|
||||
}
|
||||
});
|
||||
descColumn.setSortable(true);
|
||||
table.addColumnSortHandler(descColHandler);
|
||||
table.addColumn(descColumn, "Description");
|
||||
|
||||
// sort by columnName
|
||||
table.getColumnSortList().push(nameColumn);
|
||||
|
||||
// set width column chosen
|
||||
table.setColumnWidth(chosenColumn, 60, Unit.PX);
|
||||
|
||||
// control panel
|
||||
FlowPanel controlPanel = new FlowPanel();
|
||||
|
||||
// set buttons information
|
||||
showAllButton.setText("Show all resources");
|
||||
showAllButton.addStyleName("show-all-resources-button");
|
||||
showAllButton.setTitle("Show all resources");
|
||||
selectAllRows.setText("Select all resources");
|
||||
selectAllRows.setTitle("Select all resources of the table");
|
||||
|
||||
// show all button handler
|
||||
addShowButtonsHandler();
|
||||
addselectAllRowsHandler(checkBoxSubfunctionality);
|
||||
|
||||
// add it if the number of rows is larger wrt the page size
|
||||
if(resources.size() > MAX_ROW_TO_SHOW_BEGINNING){
|
||||
controlPanel.add(showAllButton);
|
||||
|
||||
}
|
||||
|
||||
// add the select all rows if there are resources
|
||||
if(resources.size() > 0){
|
||||
controlPanel.add(selectAllRows);
|
||||
}
|
||||
|
||||
mainPanel.add(controlPanel);
|
||||
|
||||
// pager for pagination
|
||||
SimplePager pager = new SimplePager(TextLocation.RIGHT);
|
||||
pager.setPageSize(MAX_ROW_TO_SHOW_BEGINNING);
|
||||
pager.setDisplay(table);
|
||||
pager.getElement().getStyle().setMarginTop(20, Unit.PX);
|
||||
mainPanel.add(pager);
|
||||
|
||||
// add the table
|
||||
mainPanel.add(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add handlers for selectAllRowsButtons
|
||||
* @param checkBoxSubfunctionality
|
||||
*/
|
||||
private void addselectAllRowsHandler(final CheckBox checkBoxSubfunctionality) {
|
||||
|
||||
// add handlers on selection
|
||||
selectAllRows.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
List<Resource> currentList = dataProvider.getList();
|
||||
|
||||
if(!allRowsSelected){
|
||||
for(Resource resource: currentList)
|
||||
resource.setSelected(true);
|
||||
|
||||
allRowsSelected = true;
|
||||
selectAllRows.setText("Deselect all resources");
|
||||
selectAllRows.setTitle("Deselect all resources of the table");
|
||||
|
||||
// check the father as well
|
||||
checkBoxSubfunctionality.setValue(true, true);
|
||||
|
||||
// update checked elements
|
||||
checkedResourcesNumber = dataProvider.getList().size();
|
||||
|
||||
}else{
|
||||
for(Resource resource: currentList)
|
||||
resource.setSelected(false);
|
||||
|
||||
allRowsSelected = false;
|
||||
selectAllRows.setText("Select all resources");
|
||||
selectAllRows.setTitle("Select all resources of the table");
|
||||
|
||||
// update checked elements
|
||||
checkedResourcesNumber = dataProvider.getList().size();
|
||||
|
||||
// uncheck the father as well
|
||||
checkBoxSubfunctionality.setValue(false, true);
|
||||
}
|
||||
|
||||
// refresh view
|
||||
dataProvider.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add handlers to show buttons
|
||||
*/
|
||||
private void addShowButtonsHandler() {
|
||||
|
||||
showAllButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
boolean visibleAllActive = table.getVisibleRange().getLength() == dataProvider.getList().size();
|
||||
|
||||
if(visibleAllActive){
|
||||
|
||||
// switch back to pagination
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
|
||||
showAllButton.setText("Show all resources");
|
||||
|
||||
}else{
|
||||
|
||||
// show all rows
|
||||
table.setVisibleRange(new Range(0, dataProvider.getList().size()));
|
||||
|
||||
// change text
|
||||
showAllButton.setText("Switch to pagination");
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Search on click
|
||||
* @param event
|
||||
* @param isFilteringEnabledReference
|
||||
*/
|
||||
private void searchOnClickEvent(ClickEvent event,
|
||||
boolean[] isFilteringEnabledReference) {
|
||||
|
||||
if(isFilteringEnabledReference[0]){
|
||||
// change icon style
|
||||
searchButton.setIcon(IconType.SEARCH);
|
||||
searchBox.setText("");
|
||||
isFilteringEnabledReference[0] = false;
|
||||
|
||||
// show all data
|
||||
dataProvider.setList(originalResources);
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
table.setRowCount(dataProvider.getList().size(), true);
|
||||
dataProvider.refresh();
|
||||
|
||||
}else{
|
||||
if(!searchBox.getText().isEmpty()){
|
||||
|
||||
// current filter
|
||||
String filter = searchBox.getText();
|
||||
|
||||
// get current data
|
||||
List<Resource> currentList = dataProvider.getList();
|
||||
|
||||
// the list to show
|
||||
List<Resource> toShow = new ArrayList<Resource>();
|
||||
|
||||
for(Resource resource : currentList) {
|
||||
|
||||
// lower case
|
||||
String nameLowerCase = resource.getName().toLowerCase();
|
||||
String filterLowerCase = filter.toLowerCase();
|
||||
|
||||
if(nameLowerCase.contains(filterLowerCase))
|
||||
toShow.add(resource);
|
||||
|
||||
}
|
||||
|
||||
dataProvider.setList(toShow);
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
table.setRowCount(dataProvider.getList().size(), true);
|
||||
dataProvider.refresh();
|
||||
|
||||
// change icon style
|
||||
searchButton.setIcon(IconType.REMOVE_SIGN);
|
||||
searchButton.setTitle("Remove search");
|
||||
isFilteringEnabledReference[0] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Search on key ENTER press
|
||||
* @param event
|
||||
*/
|
||||
private void searchOnKeyDown(KeyDownEvent event){
|
||||
|
||||
if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER){
|
||||
|
||||
if(!searchBox.getText().isEmpty()){
|
||||
|
||||
// current filter
|
||||
String filter = searchBox.getText();
|
||||
|
||||
// get current data
|
||||
List<Resource> currentList = dataProvider.getList();
|
||||
|
||||
// the list to show
|
||||
List<Resource> toShow = new ArrayList<Resource>();
|
||||
|
||||
for(Resource resource : currentList) {
|
||||
|
||||
// lower case
|
||||
String nameLowerCase = resource.getName().toLowerCase();
|
||||
String filterLowerCase = filter.toLowerCase();
|
||||
|
||||
if(nameLowerCase.contains(filterLowerCase))
|
||||
toShow.add(resource);
|
||||
|
||||
}
|
||||
|
||||
dataProvider.setList(toShow);
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
table.setRowCount(dataProvider.getList().size(), true);
|
||||
dataProvider.refresh();
|
||||
|
||||
}else{
|
||||
|
||||
// show all data
|
||||
dataProvider.setList(originalResources);
|
||||
table.setVisibleRange(new Range(0, MAX_ROW_TO_SHOW_BEGINNING));
|
||||
table.setRowCount(dataProvider.getList().size(), true);
|
||||
dataProvider.refresh();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client.ui;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.InlineLabel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class SummaryPanel extends Composite{
|
||||
|
||||
private static SummaryPanelUiBinder uiBinder = GWT
|
||||
.create(SummaryPanelUiBinder.class);
|
||||
|
||||
interface SummaryPanelUiBinder extends UiBinder<Widget, SummaryPanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
InlineLabel vreNameSummary;
|
||||
@UiField
|
||||
InlineLabel vreDesignerSummary;
|
||||
@UiField
|
||||
InlineLabel vreManagerSummary;
|
||||
@UiField
|
||||
InlineLabel vreFromSummary;
|
||||
@UiField
|
||||
InlineLabel vreToSummary;
|
||||
@UiField
|
||||
InlineLabel vreDescriptionSummary;
|
||||
@UiField
|
||||
VerticalPanel functionalities;
|
||||
|
||||
public SummaryPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vre's main information
|
||||
* @param name
|
||||
* @param manager
|
||||
* @param designer
|
||||
* @param description
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
public void setVreMainInformation(String name, String manager, String designer, String description, Date from, Date to){
|
||||
|
||||
vreNameSummary.setText(name);
|
||||
vreDesignerSummary.setText(designer);
|
||||
vreManagerSummary.setText(manager);
|
||||
vreDescriptionSummary.setText(description);
|
||||
|
||||
// format date in dd/mm/yy
|
||||
DateTimeFormat formatter = DateTimeFormat.getFormat("dd.MM.yyyy");// new DateTimeFormat("dd.MM.yyyy");
|
||||
vreFromSummary.setText(formatter.format(from));
|
||||
vreToSummary.setText(formatter.format(to));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the functionalities tree
|
||||
* @param w
|
||||
*/
|
||||
public void addFunctionality(Widget w){
|
||||
functionalities.add(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the functionalities tree
|
||||
* @param w
|
||||
*/
|
||||
public void clearFunctionalitiesPanel() {
|
||||
functionalities.clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel visible="false">
|
||||
<h1 style="text-align:center;">Summary</h1>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<h2>VRE description</h2>
|
||||
|
||||
<p>
|
||||
<g:InlineLabel styleName="{style.bold}">VRE Name:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreNameSummary"></g:InlineLabel>
|
||||
</p>
|
||||
<p>
|
||||
<g:InlineLabel styleName="{style.bold}">VRE Designer:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreDesignerSummary"></g:InlineLabel>
|
||||
</p>
|
||||
<p>
|
||||
<g:InlineLabel styleName="{style.bold}">VRE Manager:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreManagerSummary"></g:InlineLabel>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<g:InlineLabel styleName="{style.bold}">From:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreFromSummary">
|
||||
</g:InlineLabel>
|
||||
<g:InlineLabel styleName="{style.bold}"> To:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreToSummary">
|
||||
</g:InlineLabel>
|
||||
</p>
|
||||
<p>
|
||||
<g:InlineLabel styleName="{style.bold}">Description:</g:InlineLabel>
|
||||
<g:InlineLabel ui:field="vreDescriptionSummary"></g:InlineLabel>
|
||||
</p>
|
||||
|
||||
</g:HTMLPanel>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<h2>VRE chosen functionalities</h2>
|
||||
<g:VerticalPanel ui:field="functionalities">
|
||||
</g:VerticalPanel>
|
||||
</g:HTMLPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,304 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client.ui;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.HelpInline;
|
||||
import com.github.gwtbootstrap.client.ui.Image;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Row;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.datepicker.client.ui.DateBoxAppended;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class VRECreationFormSkeleton extends Composite{
|
||||
|
||||
private static VRECreationFormSkeletonUiBinder uiBinder = GWT
|
||||
.create(VRECreationFormSkeletonUiBinder.class);
|
||||
|
||||
interface VRECreationFormSkeletonUiBinder extends
|
||||
UiBinder<Widget, VRECreationFormSkeleton> {
|
||||
}
|
||||
|
||||
@UiField VerticalPanel vreFunctionalities;
|
||||
@UiField DateBoxAppended vreFromDate;
|
||||
@UiField DateBoxAppended vreToDate;
|
||||
@UiField TextBox vreNameTextBox;
|
||||
@UiField TextBox vreDesignerTextBox;
|
||||
@UiField ListBox vreManagersListBox;
|
||||
@UiField TextArea vreDescriptionTextArea;
|
||||
|
||||
// error panels
|
||||
@UiField HelpInline vreNameError;
|
||||
@UiField HelpInline vreDescriptionError;
|
||||
@UiField HelpInline vreDesignerError;
|
||||
|
||||
// Path of the image to be shown during loading
|
||||
public static final String imagePath = GWT.getModuleBaseURL() + "../images/statistics-loader.gif";
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public VRECreationFormSkeleton() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// update data vreToDate
|
||||
Date end = vreFromDate.getValue();
|
||||
end.setYear(end.getYear() + 1);
|
||||
|
||||
vreToDate.setValue(end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a functionality (it must be a Row object)
|
||||
* @param child
|
||||
*/
|
||||
public void appendRow(Widget child){
|
||||
if(child.getClass().equals(Row.class))
|
||||
vreFunctionalities.add(child);
|
||||
}
|
||||
|
||||
@UiHandler("vreFromDate")
|
||||
void ChangeHandlerStart(ValueChangeEvent<Date> event){
|
||||
|
||||
GWT.log("Change handler FROM");
|
||||
|
||||
// get current date
|
||||
Date current = new Date();
|
||||
|
||||
// get selected date
|
||||
Date selected = vreFromDate.getValue();
|
||||
|
||||
if(selected.compareTo(current) < 0)
|
||||
vreFromDate.setValue(current);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@UiHandler("vreToDate")
|
||||
void ChangeHandlerTo(ValueChangeEvent<Date> event){
|
||||
|
||||
GWT.log("Change handler TO");
|
||||
|
||||
// get current date start
|
||||
Date start = vreFromDate.getValue();
|
||||
|
||||
// get selected date
|
||||
Date selected = vreToDate.getValue();
|
||||
|
||||
if(selected.compareTo(start) < 0){
|
||||
|
||||
Date end = vreFromDate.getValue();
|
||||
end.setYear(end.getYear() + 1);
|
||||
vreToDate.setValue(end);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* remove image loading
|
||||
*/
|
||||
public void removeLoader() {
|
||||
|
||||
vreFunctionalities.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
|
||||
vreFunctionalities.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* add a loading image
|
||||
*/
|
||||
public void showLoader() {
|
||||
|
||||
vreFunctionalities.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
vreFunctionalities.setWidth("100%");
|
||||
vreFunctionalities.add(new Image(imagePath));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current name
|
||||
* @return
|
||||
*/
|
||||
public String getCurrentVREName(){
|
||||
return vreNameTextBox.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current designer
|
||||
* @return
|
||||
*/
|
||||
public String getCurrentVREDesigner(){
|
||||
return vreDesignerTextBox.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current manager
|
||||
* @return
|
||||
*/
|
||||
public String getCurrentVREManager(){
|
||||
GWT.log("Selected manager is " + vreManagersListBox.getSelectedItemText());
|
||||
return vreManagersListBox.getSelectedItemText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current description
|
||||
* @return
|
||||
*/
|
||||
public String getCurrentVREDescription(){
|
||||
return vreDescriptionTextArea.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current start date
|
||||
* @return
|
||||
*/
|
||||
public Date getCurrentVREStartDate(){
|
||||
return vreFromDate.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return vre current to date
|
||||
* @return
|
||||
*/
|
||||
public Date getCurrentVREToDate(){
|
||||
return vreToDate.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the designer
|
||||
* @param designer
|
||||
*/
|
||||
public void setVREDesigner(String designer){
|
||||
|
||||
vreDesignerTextBox.setText(designer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the managers
|
||||
* @param managers
|
||||
* @param a selected manager among the list of managers
|
||||
*/
|
||||
public void setVREManagers(List<String> managers, String selectedManager){
|
||||
|
||||
// sort the list first
|
||||
Collections.sort(managers);
|
||||
|
||||
for (String manager : managers) {
|
||||
vreManagersListBox.addItem(manager);
|
||||
}
|
||||
|
||||
if(selectedManager != null)
|
||||
vreManagersListBox.setSelectedValue(selectedManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alert on missing vre name
|
||||
*/
|
||||
public void showAlertBlockVREName() {
|
||||
|
||||
vreNameError.setVisible(true);
|
||||
vreNameTextBox.setFocus(true); // set focus
|
||||
|
||||
vreNameTextBox.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
|
||||
vreNameError.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vreNameTextBox.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
vreNameError.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Alert on missing vre description
|
||||
*/
|
||||
public void showAlertBlockVREDescritption() {
|
||||
|
||||
vreDescriptionError.setVisible(true);
|
||||
vreDescriptionTextArea.setFocus(true); // set focus
|
||||
|
||||
vreDescriptionTextArea.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
|
||||
vreDescriptionError.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vreDescriptionTextArea.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
vreDescriptionError.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the vre name
|
||||
* @param vreName
|
||||
*/
|
||||
public void setVREName(String vreName) {
|
||||
|
||||
vreNameTextBox.setText(vreName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the vre description
|
||||
* @param description
|
||||
*/
|
||||
public void setVREDescription(String description) {
|
||||
|
||||
vreDescriptionTextArea.setText(description);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Start from vre date
|
||||
* @param startDate
|
||||
*/
|
||||
public void setVREFromDate(Date startDate) {
|
||||
|
||||
vreFromDate.setValue(startDate);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Start from vre date
|
||||
* @param toDate
|
||||
*/
|
||||
public void setVREToDate(Date toDate) {
|
||||
|
||||
vreToDate.setValue(toDate);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
|
||||
<ui:style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<div
|
||||
style="padding-bottom: 9px!important; margin: 20px 0 30px!important; border-bottom: 1px solid #eee!important;">
|
||||
<h1 style="display:inline; margin-left: 40px; margin-right: 40px;"> VRE Information </h1>
|
||||
</div>
|
||||
<b:Row>
|
||||
<b:Form type="HORIZONTAL" ui:field="vreInformationForm">
|
||||
<b:Fieldset>
|
||||
<b:ControlGroup>
|
||||
|
||||
<b:ControlLabel for="name" title="VRE's Name">
|
||||
Name:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" placeholder="Enter VRE Name"
|
||||
b:id="name" title="VRE's Name" ui:field="vreNameTextBox" />
|
||||
<b:HelpInline ui:field="vreNameError" styleName="{style.error}"
|
||||
visible="false" text="VRE must have a name and it must not contain spaces"></b:HelpInline>
|
||||
</b:Controls>
|
||||
|
||||
<br></br>
|
||||
|
||||
<b:ControlLabel for="designer" title="VRE's Designer">
|
||||
Designer:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox readOnly="true" alternateSize="LARGE"
|
||||
placeholder="VRE Designer" b:id="designer" title="VRE's Designer"
|
||||
ui:field="vreDesignerTextBox" />
|
||||
<b:HelpInline ui:field="vreDesignerError" styleName="{style.error}"
|
||||
visible="false" text="VRE must have a Designer"></b:HelpInline>
|
||||
</b:Controls>
|
||||
|
||||
<br></br>
|
||||
|
||||
<b:ControlLabel for="managers" title="VRE's Managers">
|
||||
Managers:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox alternateSize="LARGE" b:id="managers" title="VRE's Managers"
|
||||
ui:field="vreManagersListBox">
|
||||
</b:ListBox>
|
||||
</b:Controls>
|
||||
|
||||
<br></br>
|
||||
|
||||
<b:ControlLabel for="description" title="VRE's Description">
|
||||
Description:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea alternateSize="LARGE" b:id="description"
|
||||
visibleLines="5" width="50%" title="VRE's Description" ui:field="vreDescriptionTextArea"
|
||||
placeholder="Enter VRE Description">
|
||||
</b:TextArea>
|
||||
<b:HelpInline ui:field="vreDescriptionError"
|
||||
styleName="{style.error}" visible="false" text="VRE must have a Description"></b:HelpInline>
|
||||
</b:Controls>
|
||||
|
||||
<br></br>
|
||||
|
||||
<b:ControlLabel for="vreStartTime" title="VRE's from date">
|
||||
From:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b2:DateBoxAppended format="yyyy/mm/dd" icon="CALENDAR"
|
||||
autoClose="true" title="VRE's from date" ui:field="vreFromDate" />
|
||||
</b:Controls>
|
||||
|
||||
<br></br>
|
||||
|
||||
<b:ControlLabel for="vreEndTime" title="VRE's to date">
|
||||
To:
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b2:DateBoxAppended format="yyyy/mm/dd" icon="CALENDAR"
|
||||
autoClose="true" title="VRE's to date" ui:field="vreToDate" />
|
||||
</b:Controls>
|
||||
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
|
||||
</b:Row>
|
||||
<!-- Functionalities -->
|
||||
<g:VerticalPanel width="100%" ui:field="vreFunctionalities">
|
||||
</g:VerticalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,663 @@
|
|||
package org.gcube.portlets.admin.vredefinition.server;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.application.framework.vremanagement.vremanagement.impl.VREGeneratorEvo;
|
||||
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
|
||||
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.admin.vredefinition.client.VREDefinitionService;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Functionality;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.Resource;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.ResourceCategory;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.VREDescriptionBean;
|
||||
import org.gcube.portlets.admin.vredefinition.shared.exception.VREDefinitionException;
|
||||
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.gcube.vremanagement.vremodel.cl.stubs.types.FunctionalityItem;
|
||||
import org.gcube.vremanagement.vremodel.cl.stubs.types.ResourceDescriptionItem;
|
||||
import org.gcube.vremanagement.vremodel.cl.stubs.types.ResourceItem;
|
||||
import org.gcube.vremanagement.vremodel.cl.stubs.types.SelectedResourceDescriptionType;
|
||||
import org.gcube.vremanagement.vremodel.cl.stubs.types.VREDescription;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
/**
|
||||
* The VREDefinitionServiceImpl class.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VREDefinitionService{
|
||||
|
||||
private static final long serialVersionUID = -7581858549584810224L;
|
||||
|
||||
// Logger
|
||||
private static final Logger logger = LoggerFactory.getLogger(VREDefinitionServiceImpl.class);
|
||||
|
||||
// some usefull constants
|
||||
private static final String DESIGNER = "Designer";
|
||||
private static final String MANAGER = "Manager";
|
||||
private static final String DESCRIPTION = "DESCRIPTION";
|
||||
private static final String VRE_MANAGER_STRING = "VRE-Manager";
|
||||
private static final String VRE_DEFINER_GENERATOR_ATTRIBUTE = "VREDefinerGenerator";
|
||||
private static final String VRE_GENERATOR_ATTRIBUTE = "VREGenerator";
|
||||
private static final String REEDIT_TYPE_ATTRIBUTE = "reeditType";
|
||||
private static final String EDIT_MODE = "edit";
|
||||
private static final String APPROVE_MODE = "approve";
|
||||
private static final String VRE_NAME_FIELD = "vreName";
|
||||
private static final String VRE_MANAGER_FIELD = "vreManager";
|
||||
private static final String VRE_DESIGNER_FIELD = "vreDesigner";
|
||||
private static final String VRE_DESCRIPTION_FIELD = "vreDescription";
|
||||
private static final String VRE_START_TIME_FIELD = "vreStartTime";
|
||||
private static final String VRE_END_TIME_FIELD = "vreEndTime";
|
||||
|
||||
//dev user
|
||||
public static final String defaultUserId = "test.user";
|
||||
|
||||
//dev vo
|
||||
private static final String voID = "/gcube/devsec";
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
logger.debug("Servlet init");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(){
|
||||
|
||||
logger.debug("Servlet destroyed");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* the current ASLSession
|
||||
* @return the session
|
||||
*/
|
||||
private ASLSession getASLSession() {
|
||||
|
||||
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
||||
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||
|
||||
if (user == null) {
|
||||
|
||||
logger.warn("USER IS NULL setting " + defaultUserId + " and Running OUTSIDE PORTAL");
|
||||
user = getDevelopmentUser();
|
||||
SessionManager.getInstance().getASLSession(sessionID, user).setScope(voID);
|
||||
SessionManager.getInstance().getASLSession(sessionID, user).setAttribute(REEDIT_TYPE_ATTRIBUTE, APPROVE_MODE);
|
||||
|
||||
}
|
||||
|
||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Online or in development mode?
|
||||
* @return true if you're running into the portal, false if in development
|
||||
*/
|
||||
private boolean isWithinPortal() {
|
||||
try {
|
||||
UserLocalServiceUtil.getService();
|
||||
return true;
|
||||
}
|
||||
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
||||
logger.trace("Development Mode ON");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* when packaging test will fail if the user is not set to test.user
|
||||
* @return .
|
||||
*/
|
||||
public String getDevelopmentUser() {
|
||||
String user = defaultUserId;
|
||||
// user = "costantino.perciante";
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the portlet starts, this method is invoked in order to return
|
||||
* 1) vre managers for the current VO
|
||||
* 2) the current designer (that is the current user)
|
||||
* 3) a VREDefinitionBean that will be filled somehow by the designer
|
||||
*/
|
||||
public Map<String, Serializable> getVRE() {
|
||||
|
||||
logger.debug("########### INVOKED getVRE() METHOD ###########");
|
||||
|
||||
Map<String, Serializable> toReturn = new HashMap<String, Serializable>();
|
||||
|
||||
// retrieve the session
|
||||
ASLSession session = getASLSession();
|
||||
|
||||
// username
|
||||
String username = session.getUsername();
|
||||
|
||||
// check if development mode or portal
|
||||
if(!isWithinPortal()){
|
||||
|
||||
logger.debug("You are in dev mode");
|
||||
return getFakeVreDefinition();
|
||||
|
||||
}else{
|
||||
|
||||
// check if we are in edit mode or not
|
||||
boolean editMode = isEditMode();
|
||||
|
||||
logger.debug("EDIT MODE IS " + editMode);
|
||||
|
||||
// put this information in the returned hashmap
|
||||
toReturn.put(EDIT_MODE, editMode);
|
||||
|
||||
try{
|
||||
|
||||
// user and role managers
|
||||
UserManager um = new LiferayUserManager();
|
||||
RoleManager rm = new LiferayRoleManager();
|
||||
|
||||
// current org id of the vo
|
||||
long voOrgID = getASLSession().getGroupId();
|
||||
long roleId = rm.getRoleId(VRE_MANAGER_STRING, getASLSession().getGroupId());
|
||||
|
||||
logger.debug(VRE_MANAGER_STRING + " has role id " + roleId + " into organization " + voOrgID);
|
||||
|
||||
logger.debug("Trying to get roleid of " + VRE_MANAGER_STRING + " into " + getASLSession().getGroupName());
|
||||
|
||||
List<GCubeUser> belongingUsers = um.listUsersByGroupAndRole(voOrgID, roleId);
|
||||
|
||||
logger.debug("Number of managers is " + belongingUsers.size());
|
||||
|
||||
ArrayList<String> managers = new ArrayList<String>();
|
||||
for (int i = 0; i < belongingUsers.size(); i++) {
|
||||
|
||||
managers.add(belongingUsers.get(i).getFullname()+" ("+belongingUsers.get(i).getUsername()+")");
|
||||
|
||||
}
|
||||
toReturn.put(MANAGER, managers);
|
||||
logger.debug("Managers set as " + managers);
|
||||
|
||||
// set the designer
|
||||
String fullName = um.getUserByUsername(username).getFullname();
|
||||
toReturn.put(DESIGNER, fullName+" ("+username+")");
|
||||
logger.debug("Designer set as " + fullName+" ("+username+")");
|
||||
|
||||
// in edit mode we need to retrieve the selected manager as well as other vre info
|
||||
if(editMode){
|
||||
|
||||
try{
|
||||
|
||||
VREDescriptionBean vreBean = getVREInSession();
|
||||
if(vreBean != null) {
|
||||
toReturn.put(VRE_NAME_FIELD,vreBean.getName());
|
||||
toReturn.put(VRE_MANAGER_FIELD, vreBean.getManager());
|
||||
toReturn.put(VRE_DESIGNER_FIELD, fullName+" ("+vreBean.getDesigner()+")"); // should be equal to DESIGNER
|
||||
toReturn.put(VRE_DESCRIPTION_FIELD, vreBean.getDescription());
|
||||
toReturn.put(VRE_START_TIME_FIELD, vreBean.getStartTime());
|
||||
toReturn.put(VRE_END_TIME_FIELD, vreBean.getEndTime());
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Error while retrieving vre description bean", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Error while retrieving vre information", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random data
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Serializable> getFakeVreDefinition() {
|
||||
|
||||
Map<String, Serializable> toReturn = new HashMap<String,Serializable>();
|
||||
ArrayList<String> managers = new ArrayList<String>();
|
||||
managers.add("Pasquale Pagano (pasquale.pagano)");
|
||||
managers.add("Andrea Manzi (andrea.manzi)");
|
||||
managers.add("Massimiliano Assante (massimiliano.assante)");
|
||||
toReturn.put(MANAGER, managers);
|
||||
|
||||
// designer
|
||||
toReturn.put(DESIGNER, "Leonardo Candela (leonardo.candela)");
|
||||
|
||||
// check if we are in edit mode or not
|
||||
boolean editMode = isEditMode();
|
||||
|
||||
// put this information in the returned hashmap
|
||||
toReturn.put(EDIT_MODE, editMode);
|
||||
|
||||
if(editMode){
|
||||
try {
|
||||
VREDescriptionBean vreBean = getVREInSession();
|
||||
if(vreBean != null) {
|
||||
logger.debug(" ########### VRE != NULL ##########");
|
||||
logger.debug("Bean is " + vreBean);
|
||||
toReturn.put(VRE_NAME_FIELD,vreBean.getName());
|
||||
toReturn.put(VRE_MANAGER_FIELD, vreBean.getManager());
|
||||
toReturn.put(VRE_DESIGNER_FIELD, vreBean.getDesigner());
|
||||
toReturn.put(VRE_DESCRIPTION_FIELD, vreBean.getDescription());
|
||||
toReturn.put(VRE_START_TIME_FIELD, vreBean.getStartTime().getTime());
|
||||
toReturn.put(VRE_END_TIME_FIELD, vreBean.getEndTime().getTime());
|
||||
}
|
||||
} catch (Exception e1){
|
||||
logger.error("Missing definition bean...");
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the VREDescriptionBean from the session if possible
|
||||
* @return
|
||||
* @throws VREDefinitionException
|
||||
*/
|
||||
private VREDescriptionBean getVREInSession() throws VREDefinitionException {
|
||||
VREGeneratorEvo vreGenerator = getVREGenerator();
|
||||
|
||||
VREDescriptionBean vreDescBean = null;
|
||||
try {
|
||||
VREDescription sd = vreGenerator.getVREModel();
|
||||
vreDescBean = new VREDescriptionBean(sd.name(), sd.description(),
|
||||
sd.designer(), sd.manager(), sd.startTime().getTime(), sd.endTime().getTime());
|
||||
|
||||
} catch (RemoteException e) {
|
||||
throw new VREDefinitionException("Fail retrieve VRE");
|
||||
}
|
||||
|
||||
logger.debug("Model retrieved is " + vreDescBean);
|
||||
return vreDescBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The VREGenerator is needed to retrieve VRE Bean information
|
||||
* @return
|
||||
*/
|
||||
private VREGeneratorEvo getVREGenerator(){
|
||||
ASLSession d4ScienceSession = getASLSession();
|
||||
VREGeneratorEvo vreGenerator = (VREGeneratorEvo) d4ScienceSession.getAttribute(VRE_DEFINER_GENERATOR_ATTRIBUTE);
|
||||
|
||||
// if there is not..add it
|
||||
if(vreGenerator == null){
|
||||
logger.debug("There is no VREGeneratorEvo in the session, adding it..");
|
||||
vreGenerator = new VREGeneratorEvo(d4ScienceSession);
|
||||
d4ScienceSession.setAttribute(VRE_DEFINER_GENERATOR_ATTRIBUTE, vreGenerator);
|
||||
}
|
||||
return vreGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we are in edit mode or not
|
||||
* @return
|
||||
*/
|
||||
private boolean isEditMode(){
|
||||
|
||||
logger.debug("Checking if we are in edit mode...");
|
||||
|
||||
// retrieve current session
|
||||
ASLSession session = getASLSession();
|
||||
|
||||
// get this attribute
|
||||
String reeditType = (String)session.getAttribute(REEDIT_TYPE_ATTRIBUTE);
|
||||
|
||||
// set to null the VRE_DEFINER_GENERATOR_ATTRIBUTE
|
||||
session.setAttribute(VRE_DEFINER_GENERATOR_ATTRIBUTE, null);
|
||||
|
||||
// if the reeditType is actually edit
|
||||
if(reeditType != null && reeditType.equals(EDIT_MODE)) {
|
||||
|
||||
// retrieve the vreid (of the vre to be changed)
|
||||
String vreid = (String) session.getAttribute(VRE_GENERATOR_ATTRIBUTE);
|
||||
|
||||
if(vreid != null){
|
||||
|
||||
// put the generator in session
|
||||
VREGeneratorEvo vreGenerator = new VREGeneratorEvo(session, vreid);
|
||||
session.setAttribute(VRE_DEFINER_GENERATOR_ATTRIBUTE, vreGenerator);
|
||||
|
||||
}
|
||||
|
||||
// set to null the attribute REEDIT_TYPE_ATTRIBUTE
|
||||
session.setAttribute(REEDIT_TYPE_ATTRIBUTE, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ArrayList<Functionality> getFunctionality(boolean isEdit)
|
||||
throws VREDefinitionException {
|
||||
/*
|
||||
* if i am creating a new Vre I need to 'pretend' I already set the description to the service otherwise VREModeler won't return me the collections
|
||||
* if is editing instead this is not necessary
|
||||
*/
|
||||
if (!isEdit) {
|
||||
Calendar cal= Calendar.getInstance();
|
||||
long startTime = cal.getTimeInMillis();
|
||||
cal.add(Calendar.MONTH, 5);
|
||||
cal.add(Calendar.HOUR, 7);
|
||||
long endTime = cal.getTimeInMillis();
|
||||
try {
|
||||
//a useless setVREModel() is needed to retrieve functionalities....
|
||||
getVREGenerator().setVREModel("notCompletedVirtualResearchEnv.", UUID.randomUUID().toString(),
|
||||
UUID.randomUUID().toString(), UUID.randomUUID().toString(), startTime, endTime);
|
||||
Thread.sleep(1000); // wait a sec
|
||||
} catch (Exception e) {
|
||||
logger.error("Error on setVREModel()", e);
|
||||
}
|
||||
}
|
||||
|
||||
// if the service is not ready, return null
|
||||
if (!getVREGenerator().isVreModelerServiceUp())
|
||||
return null;
|
||||
|
||||
// build up the list of functionalities
|
||||
List<Functionality> toReturn = new ArrayList<Functionality>();
|
||||
|
||||
try{
|
||||
|
||||
// get the list of main functionalities
|
||||
List<FunctionalityItem> listMainFunctionalities = getVREGenerator().getFunctionality();
|
||||
|
||||
if(listMainFunctionalities != null && !listMainFunctionalities.isEmpty()){
|
||||
|
||||
// for each functionality
|
||||
for (FunctionalityItem functionalityItem : listMainFunctionalities) {
|
||||
|
||||
logger.debug("Reading FunctionalityItem with id:" + functionalityItem.id() + " and name " + functionalityItem.name());
|
||||
|
||||
// add it to the returning list
|
||||
Functionality mainFunctionality = new Functionality(functionalityItem.id(), functionalityItem.name(), functionalityItem.description(), functionalityItem.selected());
|
||||
toReturn.add(mainFunctionality);
|
||||
|
||||
// scan its children (if any)
|
||||
if(functionalityItem.children() == null || functionalityItem.children().isEmpty()){
|
||||
logger.debug(functionalityItem.name() + " has no children.");
|
||||
}
|
||||
else{
|
||||
// get its children
|
||||
List<FunctionalityItem> childrenFunctionalities = functionalityItem.children();
|
||||
|
||||
// subfunctionalities of our model
|
||||
List<Functionality> subFunctionalities = new ArrayList<Functionality>();
|
||||
|
||||
// for each subfunctionality
|
||||
for(FunctionalityItem childFunctionality: childrenFunctionalities){
|
||||
|
||||
logger.debug("Reading child FunctionalityItem " + childFunctionality.name() + " of node " + functionalityItem.name());
|
||||
Functionality subFunctionality = new Functionality(childFunctionality.id(), childFunctionality.name(), childFunctionality.description(), childFunctionality.selected());
|
||||
|
||||
// this subfunctionality could have resource categories
|
||||
List<ResourceDescriptionItem> resourcesDescriptionItems = childFunctionality.selectableResourcesDescription();
|
||||
|
||||
if(resourcesDescriptionItems != null && !resourcesDescriptionItems.isEmpty()){
|
||||
|
||||
// categories of our model
|
||||
List<ResourceCategory> categories = new ArrayList<ResourceCategory>();
|
||||
|
||||
for (ResourceDescriptionItem resourceDescriptionItem : resourcesDescriptionItems) {
|
||||
logger.debug("Reading ResourceDescriptionItem " + resourceDescriptionItem.description() + " of functionality " + childFunctionality.name());
|
||||
|
||||
// resource category list
|
||||
List<ResourceItem> resourceItems = resourceDescriptionItem.resources();
|
||||
|
||||
if(resourceItems != null && !resourceItems.isEmpty()){
|
||||
|
||||
ResourceCategory rc = new ResourceCategory(resourceDescriptionItem.id(), resourceDescriptionItem.description());
|
||||
List<Resource> resourceModels = new ArrayList<Resource>();
|
||||
for (ResourceItem resource : resourceDescriptionItem.resources()) {
|
||||
logger.debug("Reading resource " + resource.name() + " of ResourceDescriptionItem " + resourceDescriptionItem.description());
|
||||
resourceModels.add(new Resource(resource.id(), resource.name(), resource.description(), resource.selected()));
|
||||
|
||||
}
|
||||
|
||||
// set resources for this category
|
||||
rc.setItems((ArrayList<Resource>) resourceModels);
|
||||
|
||||
// append the resource category to categories
|
||||
categories.add(rc);
|
||||
}
|
||||
}
|
||||
|
||||
// append this resources to the child functionality
|
||||
subFunctionality.setResources(categories);
|
||||
|
||||
}
|
||||
|
||||
// add this subfunctionality to our functionality list
|
||||
subFunctionalities.add(subFunctionality);
|
||||
|
||||
}
|
||||
|
||||
// add the subfunctionalities to the main functionality
|
||||
mainFunctionality.setSubFunctionalities(subFunctionalities);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Error while retrieving the list of functionalities", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
// return the list of functionalities
|
||||
return (ArrayList<Functionality>)toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the vre functionalities and resources it will use.
|
||||
* @param functionalities
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
private boolean setFunctionalities(List<Functionality> functionalities){
|
||||
|
||||
//filling up
|
||||
ArrayList<SelectedResourceDescriptionType> toSend = new ArrayList<SelectedResourceDescriptionType>();
|
||||
|
||||
// we need a list of checked subfunctionalities' ids
|
||||
ArrayList<Integer> subfunctionalitiesIDS = new ArrayList<Integer>();
|
||||
|
||||
// iterate over the macro functionalities
|
||||
for(Functionality macroFunctionality : functionalities){
|
||||
|
||||
logger.debug("Scanning macro functionality " + macroFunctionality.getName());
|
||||
|
||||
// retrieve its direct children
|
||||
List<Functionality> subfunctionalities = macroFunctionality.getSubFunctionalities();
|
||||
|
||||
// iterate
|
||||
for (Functionality subfunctionality : subfunctionalities) {
|
||||
|
||||
logger.debug("Scanning sub functionality " + subfunctionality.getName());
|
||||
|
||||
if(subfunctionality.isSelected()){
|
||||
|
||||
logger.debug("This subfunctionality was selected");
|
||||
|
||||
// save its id
|
||||
subfunctionalitiesIDS.add(subfunctionality.getId());
|
||||
|
||||
// retrieve its children list
|
||||
List<ResourceCategory> categories = subfunctionality.getResources();
|
||||
|
||||
if(categories != null){
|
||||
|
||||
for(ResourceCategory category : categories){
|
||||
|
||||
// get the description id
|
||||
String descriptionId = category.getId();
|
||||
|
||||
// get its resources
|
||||
ArrayList<Resource> resources = category.getItems();
|
||||
|
||||
// list of ids for resources
|
||||
ArrayList<String> resourceIds = new ArrayList<String>();
|
||||
|
||||
if(resources != null){
|
||||
|
||||
logger.debug("Scanning resources of " + subfunctionality.getName());
|
||||
|
||||
for (Resource resource : resources) {
|
||||
|
||||
if(resource.isSelected()){
|
||||
|
||||
logger.debug("Resource of " + resource.getName() + " was selected by the user");
|
||||
|
||||
// add its id
|
||||
resourceIds.add(resource.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SelectedResourceDescriptionType toAdd = new SelectedResourceDescriptionType();
|
||||
toAdd.descriptionId(descriptionId);
|
||||
toAdd.resourceIds(resourceIds);
|
||||
toSend.add(toAdd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert to array
|
||||
Integer funcIdAsInts[] = subfunctionalitiesIDS.toArray(new Integer[subfunctionalitiesIDS.size()]);
|
||||
|
||||
// convert to array
|
||||
SelectedResourceDescriptionType[] selres = toSend.toArray(new SelectedResourceDescriptionType[toSend.size()]);
|
||||
logger.debug("SelectedResourceDescriptionType[] Sending to Service .... toSend size = " + toSend.size());
|
||||
for (int i = 0; i < selres.length; i++) {
|
||||
logger.debug("SelectedResourceDescriptionType DESC: " + selres[i].getDescriptionId());
|
||||
for (int j = 0; j < selres[i].resourceIds().size(); j++) {
|
||||
logger.debug("resid= " +selres[i].resourceIds().get(j));
|
||||
}
|
||||
}
|
||||
|
||||
// save the above information
|
||||
VREGeneratorEvo vreGenerator = getVREGenerator();
|
||||
try {
|
||||
vreGenerator.setFunctionality(funcIdAsInts, selres);
|
||||
vreGenerator.setVREtoPendingState();
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
logger.error("An error arises", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean setVRE(VREDescriptionBean bean,
|
||||
ArrayList<Functionality> functionalities)
|
||||
throws VREDefinitionException {
|
||||
|
||||
// retrieve information from the description bean
|
||||
String completeDesigner = bean.getDesigner();
|
||||
bean.setDesigner(extractUserName(completeDesigner));
|
||||
String managerUserName = extractUserName(bean.getManager());
|
||||
bean.setManager(managerUserName);
|
||||
|
||||
// set this description bean
|
||||
setVREDescription(bean);
|
||||
|
||||
// save this functionalities
|
||||
setFunctionalities(functionalities);
|
||||
try {
|
||||
getVREGenerator().setVREtoPendingState();
|
||||
|
||||
getASLSession().setAttribute(VRE_DEFINER_GENERATOR_ATTRIBUTE, null);
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(getASLSession().getUsername());
|
||||
ArrayList<String> toSend = new ArrayList<String>();
|
||||
toSend.add(managerUserName);
|
||||
String subject = "New VRE Definition requires your approval";
|
||||
String body = "Dear Manager, \n\n" + completeDesigner + " has created a VRE Definition indicating you as VRE Manager on " + getASLSession().getScope();
|
||||
body+=".\n\nThe VRE Name is: " + bean.getName() +", the VRE Description is: " + bean.getDescription()+".";
|
||||
String messagedId = workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, new ArrayList<String>(), toSend);
|
||||
|
||||
ASLSession session = getASLSession();
|
||||
SocialNetworkingUser user = new SocialNetworkingUser(session.getUsername(), session.getUserEmailAddress(), session.getUserFullName(), session.getUserAvatarId());
|
||||
NotificationsManager nnm = new ApplicationNotificationsManager(new SocialNetworkingSite(getThreadLocalRequest()), session.getScope(), user);
|
||||
|
||||
if (nnm.notifyMessageReceived(managerUserName, messagedId, subject, body))
|
||||
logger.trace("Sending VRE Definition create notification: " + subject + " OK");
|
||||
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while creating the new VRE ", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bean within the session
|
||||
* @param bean
|
||||
* @return
|
||||
* @throws VREDefinitionException
|
||||
*/
|
||||
private String setVREDescription(VREDescriptionBean bean) throws VREDefinitionException {
|
||||
VREGeneratorEvo vreGenerator = getVREGenerator();
|
||||
ASLSession d4ScienceSession = getASLSession();
|
||||
d4ScienceSession.setAttribute(VRE_NAME_FIELD, bean.getName());
|
||||
d4ScienceSession.setAttribute(DESCRIPTION, bean.getDescription());
|
||||
d4ScienceSession.setAttribute(DESIGNER, bean.getDesigner());
|
||||
d4ScienceSession.setAttribute(MANAGER, bean.getManager());
|
||||
try {
|
||||
vreGenerator.setVREModel(bean.getName(), bean.getDescription(), bean.getDesigner(),
|
||||
bean.getManager(), bean.getStartTime().getTime() , bean.getEndTime().getTime());
|
||||
} catch (RemoteException e) {
|
||||
logger.error("An error arises", e);
|
||||
throw new VREDefinitionException("Set Description Error");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original format looks like Clark Kent (clark.kent) and we need the name within brackets
|
||||
* @param toExtract
|
||||
* @return
|
||||
*/
|
||||
private String extractUserName(String toExtract) {
|
||||
int openBracket = toExtract.indexOf("(")+1;
|
||||
int closeBracket = toExtract.indexOf(")");
|
||||
String toReturn = toExtract.substring(openBracket, closeBracket);
|
||||
logger.debug("Extracted username is " + toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.gcube.portlets.admin.vredefinition.server.portlet;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
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;
|
||||
|
||||
public class VREDefinitionPortlet extends GenericPortlet {
|
||||
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||
response.setContentType("text/html");
|
||||
ScopeHelper.setContext(request);
|
||||
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/VREDefinition_view.jsp");
|
||||
dispatcher.include(request, response);
|
||||
}
|
||||
|
||||
public void processAction(ActionRequest request, ActionResponse response)
|
||||
throws PortletException, IOException {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package org.gcube.portlets.admin.vredefinition.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A functionality class element.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class Functionality implements Serializable{
|
||||
|
||||
private List<Functionality> subFunctionalities; // For Base Functionalities: Authorization..
|
||||
private int id;
|
||||
private List<ResourceCategory> resourceCategories; // For Occurrence and Taxonomic (under BiolCube): Data Discovery/BrazilianFlora for instance
|
||||
private String description;
|
||||
private String name;
|
||||
private boolean selected; // if this object has subFunctionalities and it is selected, they are automatically checked, but
|
||||
// resources must be manually checked.
|
||||
|
||||
/**
|
||||
* needed for serialization
|
||||
*/
|
||||
public Functionality() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subFunctionalities
|
||||
* @param description
|
||||
* @param name
|
||||
*/
|
||||
public Functionality(int id, String description, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Functionality(int id, String name, String description, boolean selected) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.name = name;
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public List<Functionality> getSubFunctionalities() {
|
||||
return subFunctionalities;
|
||||
}
|
||||
public void setSubFunctionalities(List<Functionality> subFunctionalities) {
|
||||
this.subFunctionalities = subFunctionalities;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public List<ResourceCategory> getResources() {
|
||||
return resourceCategories;
|
||||
}
|
||||
public void setResources(List<ResourceCategory> resourceCategories) {
|
||||
this.resourceCategories = resourceCategories;
|
||||
}
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Functionality [subFunctionalities=" + subFunctionalities
|
||||
+ ", id=" + id + ", resources=" + resourceCategories + ", description="
|
||||
+ description + ", name=" + name + ", selected=" + selected
|
||||
+ "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.portlets.admin.vredefinition.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* A resource class element.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class Resource implements Serializable{
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private boolean selected;
|
||||
|
||||
/**
|
||||
* needed for serialization
|
||||
*/
|
||||
public Resource() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param name
|
||||
* @param description
|
||||
* @param selected
|
||||
*/
|
||||
public Resource(String id, String name, String description, boolean selected) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.selected = selected;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Resource [id=" + id + ", name=" + name + ", description="
|
||||
+ description + ", selected=" + selected + "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.admin.vredefinition.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A resource category class element.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ResourceCategory implements Serializable{
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private ArrayList<Resource> items;
|
||||
|
||||
/**
|
||||
* needed for serialization
|
||||
*/
|
||||
public ResourceCategory() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ResourceCategory(String id, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ArrayList<Resource> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(ArrayList<Resource> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceCategory [id=" + id + ", name=" + name + ", items="
|
||||
+ items + "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package org.gcube.portlets.admin.vredefinition.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* VREDescriptionBean
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VREDescriptionBean implements Serializable{
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String designer;
|
||||
private String manager;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* needed for serialization
|
||||
*/
|
||||
public VREDescriptionBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
public VREDescriptionBean(String name, String description, String designer,
|
||||
String manager, Date startTime, Date endTime) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.designer = designer;
|
||||
this.manager = manager;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDesigner() {
|
||||
return designer;
|
||||
}
|
||||
|
||||
public void setDesigner(String designer) {
|
||||
this.designer = designer;
|
||||
}
|
||||
|
||||
public String getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setManager(String manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VREDescriptionBean [name=" + name + ", description="
|
||||
+ description + ", designer=" + designer + ", manager="
|
||||
+ manager + ", startTime=" + startTime + ", endTime=" + endTime
|
||||
+ "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.portlets.admin.vredefinition.shared.exception;
|
||||
|
||||
/**
|
||||
* VRE definition bean missing exception
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class VREDefinitionException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -8266001298734768421L;
|
||||
|
||||
// message to show
|
||||
private String error;
|
||||
|
||||
public VREDefinitionException(){
|
||||
|
||||
this.error = "VRE Definition Error :";
|
||||
}
|
||||
|
||||
public VREDefinitionException(String message){
|
||||
this.error = message;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return this.error;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='vredefinition'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.admin.vredefinition.client.VREDefinition' />
|
||||
|
||||
<!-- Bootstrap import -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
|
@ -0,0 +1,2 @@
|
|||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
|
@ -0,0 +1,56 @@
|
|||
.vre-definition-main-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.vre-definition-elements-common-style {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.select-deselect-button-style {
|
||||
margin-top: -40px;
|
||||
margin-left: 40px;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.table-style {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.filter-functionalities-box {
|
||||
margin-top: 40px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.subfunctionality-textbox {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.show-all-resources-button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.generate-summary-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.summary-buttons-panel {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.macrofunctionality-name-summary {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.subfunctionality-form {
|
||||
margin-left: 40px !important;
|
||||
margin-right: 40px !important;
|
||||
}
|
||||
|
||||
.button-margin-right {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.icon-style {
|
||||
color: #08c;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<!doctype html>
|
||||
<!-- The DOCTYPE declaration above will set the -->
|
||||
<!-- browser's rendering engine into -->
|
||||
<!-- "Standards Mode". Replacing this declaration -->
|
||||
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||
<!-- differences in layout. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="VreDefinition.css">
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
<title>Web Application Starter Project</title>
|
||||
|
||||
<!-- -->
|
||||
<!-- This script loads your compiled module. -->
|
||||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
<script type="text/javascript" src="vredefinition/vredefinition.nocache.js"></script>
|
||||
</head>
|
||||
|
||||
<!-- -->
|
||||
<!-- The body can have arbitrary html, or -->
|
||||
<!-- you can leave the body empty if you want -->
|
||||
<!-- to create a completely dynamic UI. -->
|
||||
<!-- -->
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled
|
||||
in order for this application to display correctly.
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="VREDefinitionDIV"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter'
|
||||
rel='stylesheet' type='text/css'>
|
||||
<script type="text/javascript" language="javascript"
|
||||
src="<%=request.getContextPath()%>/vredefinition/vredefinition.nocache.js"></script>
|
||||
<div id="VREDefinitionDIV"></div>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||
|
||||
<display>
|
||||
<category name="gCube Enabling Apps">
|
||||
<portlet id="VREDefinition" />
|
||||
</category>
|
||||
</display>
|
|
@ -0,0 +1,9 @@
|
|||
name=VRE Definition Wizard
|
||||
module-group-id=liferay
|
||||
module-incremental-version=1
|
||||
tags=
|
||||
short-description=
|
||||
change-log=
|
||||
page-url=http://www.d4science.org
|
||||
author=D4Science.org
|
||||
licenses=MIT
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||
<liferay-portlet-app>
|
||||
<portlet>
|
||||
<portlet-name>VREDefinition</portlet-name>
|
||||
<layout-cacheable>false</layout-cacheable>
|
||||
<instanceable>false</instanceable>
|
||||
<ajaxable>false</ajaxable>
|
||||
<!-- LOCATION CSS HERE -->
|
||||
<header-portlet-css>/VreDefinition.css</header-portlet-css>
|
||||
</portlet>
|
||||
<role-mapper>
|
||||
<role-name>administrator</role-name>
|
||||
<role-link>Administrator</role-link>
|
||||
</role-mapper>
|
||||
</liferay-portlet-app>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
|
||||
<portlet>
|
||||
<portlet-name>VREDefinition</portlet-name>
|
||||
<display-name>VRE Definition Wizard</display-name>
|
||||
<portlet-class>org.gcube.portlets.admin.vredefinition.server.portlet.VREDefinitionPortlet</portlet-class>
|
||||
<init-param>
|
||||
<name>view-jsp</name>
|
||||
<value>/WEB-INF/jsp/VREDefinition_view.jsp</value>
|
||||
</init-param>
|
||||
<expiration-cache>0</expiration-cache>
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>VRE Definition Wizard</title>
|
||||
<short-title>VRE Definition Wizard</short-title>
|
||||
<keywords>VRE Definition Wizard</keywords>
|
||||
</portlet-info>
|
||||
<security-role-ref>
|
||||
<role-name>administrator</role-name>
|
||||
</security-role-ref>
|
||||
</portlet>
|
||||
</portlet-app>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
|
||||
<servlet>
|
||||
<servlet-name>VREDefinitionServiceImpl</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.admin.vredefinition.server.VREDefinitionServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>scopeService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>VREDefinitionServiceImpl</servlet-name>
|
||||
<url-pattern>/vredefinition/VREDefinitionServiceImpl</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>scopeService</servlet-name>
|
||||
<url-pattern>/vredefinition/scopeService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<welcome-file-list>
|
||||
<welcome-file>VreDefinition.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
</web-app>
|
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.portlets.admin.vredefinition.client;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.gcube.portlets.admin.vredefinition.server.VREDefinitionServiceImpl;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestForDeploy {
|
||||
|
||||
@Test
|
||||
public void testUserIsTestUser() {
|
||||
VREDefinitionServiceImpl serviceImpl = new VREDefinitionServiceImpl();
|
||||
String username = serviceImpl.getDevelopmentUser();
|
||||
System.out.println("username for deploy is: " + username);
|
||||
assertTrue(username.compareTo(VREDefinitionServiceImpl.defaultUserId) == 0);
|
||||
System.out.println("Test OK!");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="VreDefinition">
|
||||
<!-- Inherit our applications main module. -->
|
||||
<inherits name='org.gcube.portlets.admin.vredefinition.VreDefinition' />
|
||||
|
||||
<!-- Specify the path to any remote services. -->
|
||||
<servlet path="/VreDefinition/greet" class="org.gcube.portlets.admin.vredefinition.server.GreetingServiceImpl" />
|
||||
|
||||
</module>
|
Loading…
Reference in New Issue