Compare commits

...

21 Commits

Author SHA1 Message Date
Massimiliano Assante d98116cc37 ready to release 2022-09-22 17:15:21 +02:00
Massimiliano Assante 257141f581 updated version to 2.6 2022-09-22 17:14:53 +02:00
Massimiliano Assante cdb2e85967 - Moved to OpenJDK11
- Moved to GWT 2.9.0
2022-09-22 17:12:32 +02:00
Massimiliano Assante caa2570450 fixed bug #23898 2022-09-22 17:04:13 +02:00
Massimiliano Assante cfeef31ec1 ready to release 2022-06-16 15:44:02 +02:00
Massimiliano Assante 0eb9e7602f - Released for removal HL from portal 2022-06-16 15:43:38 +02:00
Massimiliano Assante d73f4944b6 ready to release 2021-09-09 17:15:03 +02:00
Massimiliano Assante e8cc5753bc - Fixed attachment issue #21972 2021-09-09 17:14:42 +02:00
Massimiliano Assante 40ac5d0d4e alpha test worked 2021-09-09 17:08:28 +02:00
Massimiliano Assante 23c2dedffb after Lucio suggestion 2021-09-09 16:32:48 +02:00
Massimiliano Assante 46e5e2a787 messages with attachment support 2021-09-08 10:42:50 +02:00
Massimiliano Assante 3e624e687a Temporarely removed possibility to add attachments 2021-07-28 17:47:49 +02:00
Massimiliano Assante 5ebf43429f updated css containing a syntax error 2021-07-02 16:47:41 +02:00
Massimiliano Assante ca11b0411e updated bom 2021-06-24 17:35:14 +02:00
Massimiliano Assante 94ee25e07d updated bom in pom 2021-06-22 10:50:08 +02:00
Massimiliano Assante 2b711b4de6 fixed pom 2021-06-22 10:35:45 +02:00
Massimiliano Assante 2a373db9ad Removed HomeLibrary dependency and replace with storage hub one 2021-06-22 10:33:15 +02:00
Massimiliano Assante 68059a04df minor change 2021-05-25 17:46:27 +02:00
Massimiliano Assante 57e20e7304 updated changelog 2021-04-14 15:48:35 +02:00
Massimiliano Assante 68e5119f79 added changelog md 2021-04-14 15:48:13 +02:00
lucio.lelii 1c3d93ebba solved bug:
-right panel slow down when the message were more then 1000
2021-04-13 18:50:15 +02:00
23 changed files with 784 additions and 356 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/messages-2.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/messages-2.5.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/messages-2.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/messages-2.5.3-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -22,13 +22,7 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/messages-2.4.0-SNAPSHOT/WEB-INF/classes" path="target/generated-sources/gwt">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER/gwt-2.8.1"/>
<classpathentry kind="con" path="com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
@ -36,22 +30,11 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/gwt-user.jar">
<classpathentry kind="src" output="target/messages-2.5.3-SNAPSHOT/WEB-INF/classes" path="target/generated-sources/gwt">
<attributes>
<attribute name="javadoc_location" value="file:/Users/massi/portal/distro/GWT%20SDK/gwt-2.8.2/doc/javadoc/"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/gwt-codeserver.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Users/massi/portal/distro/GWT%20SDK/gwt-2.8.2/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/gwt-dev.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Users/massi/portal/distro/GWT%20SDK/gwt-2.8.2/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="lib" path="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/validation-api-1.0.0.GA.jar" sourcepath="/Users/massi/portal/distro/GWT SDK/gwt-2.8.2/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="output" path="target/messages-2.4.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/messages-2.5.3-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -3,7 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,11 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="messages">
<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"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<property name="java-output-path" value="/message-conversations/target/message-conversations-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="messages"/>
</wb-module>
</project-modules>

55
CHANGELOG.md Normal file
View File

@ -0,0 +1,55 @@
# Changelog for Messages Portlet
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.6.0] - 2022-09-22
- Fix Bug #23898: open with email addresse preset is not working anymore
- Moved to OpenJDK11
- Moved to GWT 2.9.0
## [v2.5.2] - 2022-06-16
- Released for removal HL from portal
## [v2.5.1] - 2021-09-09
- Fixed attachment issue #21972
## [v2.5.0] - 2021-07-28
- Ported to git
- Remove HomeLibrary dependency and replace with storage hub one
- Temporarely removed possibility to add attachments
## [v2.4.0] - 2019-10-25
- Bug #17876 the message menu isn't fully displayed if there is only one message or no other messages below
- Incident #17778 direct download attachment does not work
## [v2.3.0] - 2019-02-28
- Feature #10068, Request for enhancement: new Messages is error prone and challenging to use
- Feature #16194, Isolate Gateway user list in Messages
## [v2.1.0] - 2018-06-14
- Updated Workspace Explorer dependency
- Added support for SendTo
## [v2.0.0] -2 017-09-21
- Improved look and feel
- Responsive, works on mobile
## [v1.0.0] - 2013-01-13
- First release

26
FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

View File

@ -20,29 +20,20 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/Messages/releases).
## Authors
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
## Maintainers
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260);
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488), D4Science-II (grant no.239019), ENVRI (grant no. 283465), EUBrazilOpenBio (grant no. 288754), iMarine(grant no. 283644);
- the H2020 research and innovation programme
- BlueBRIDGE (grant no. 675680), EGIEngage (grant no. 654142), ENVRIplus (grant no. 654182), Parthenos (grant no. 654119), SoBigData (grant no. 654024),DESIRA (grant no. 818194), ARIADNEplus (grant no. 823914), RISIS2 (grant no. 824091), PerformFish (grant no. 727610), AGINFRAplus (grant no. 731001);
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

View File

@ -1 +0,0 @@
${gcube.license}

View File

@ -1,61 +0,0 @@
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).
Maintainers
-----------
* Francesco Mangiacrapa (francesco.mangiacrapa-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
* Massimiliano Assante (massimiliano.assante-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
--------------------------------------------------
Documentation
--------------------------------------------------
Documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}/Workspace
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.

View File

@ -1,65 +0,0 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.messages.2-4-0"
date="2019-10-25">
<Change>Bug #17876 the message menu isn't fully displayed if there is only one message or no other messages below</Change>
<Change>Incident #17778 direct download attachment does not work</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.2-3-0"
date="2019-02-28">
<Change>Feature #10068, Request for enhancement: new Messages is error prone and challenging to use</Change>
<Change>Feature #16194, Isolate Gateway user list in Messages</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.2-1-0"
date="2018-06-14">
<Change>Updated Workspace Explorer dependency</Change>
<Change>Added support for SendTo</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.2-0-0"
date="2017-09-21">
<Change>Improved look and feel</Change>
<Change>Responsive, works on mobile</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.1-3-0"
date="2016-11-28">
<Change>Removed ASL Session</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-8-0"
date="2015-10-08">
<Change>[Feature #879] Message Improvements</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-7-0"
date="2015-06-05">
<Change>Upgraded to GWT 2.7</Change>
<Change>[Feature #129] Porting to HL 2.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-6-0"
date="2013-06-04">
<Change>Fixed bug on "reply all"</Change>
<Change>Changed icons</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-5-0"
date="2013-06-04">
<Change>Updated pom to support new gcube core (gcube release 3.2)
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-4-0"
date="2013-10-21">
<Change>#Ticket 2223. This project was enhancements to gwt 2.5.1
</Change>
<Change>GCF dependency was removed</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-3-0"
date="2013-07-08">
<Change>Updated show attachments: this functionality now calls the
servlet contained in ws-tree
</Change>
<Change>Error management for attachments: it was added redirect
functionality in download servlet
</Change>
<Change>Fixed Ticket #1348</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.0-1-0"
date="2013-01-13">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

View File

@ -1,32 +0,0 @@
<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>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.${project.packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

View File

@ -1,25 +0,0 @@
<?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>PortletUser</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>

63
pom.xml
View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portets.user</groupId>
<artifactId>messages</artifactId>
<packaging>war</packaging>
<version>2.5.0-SNAPSHOT</version>
<version>2.6.0</version>
<description>
gCube Messages Portlet for exchanging messages with other users.
</description>
@ -25,11 +25,7 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.8.2</gwt.version>
<distroDirectory>distro</distroDirectory>
<!-- GWT 2.8 requires 1.8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<gwt.version>2.9.0</gwt.version>
<gwt-material.version>2.0.1</gwt-material.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -39,7 +35,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.1-SNAPSHOT</version>
<version>3.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -102,6 +98,12 @@
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId>
@ -240,14 +242,6 @@
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -273,51 +267,24 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
<additionalparam>-Xdoclint:none</additionalparam>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
<version>3.1.0</version>
<executions>
<execution>
<id>servicearchive</id>
<id>generate-doc</id>
<phase>install</phase>
<goals>
<goal>single</goal>
<goal>jar</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>

View File

@ -55,7 +55,6 @@ import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.constants.Position;
import gwt.material.design.client.ui.MaterialAnchorButton;
import gwt.material.design.client.ui.MaterialBadge;
import gwt.material.design.client.ui.MaterialCollection;
import gwt.material.design.client.ui.MaterialFAB;
import gwt.material.design.client.ui.MaterialLink;
import gwt.material.design.client.ui.MaterialProgress;
@ -88,10 +87,12 @@ public class ApplicationView extends Composite {
@UiField MaterialFAB FAB;
@UiField MaterialLink menu, newMessage, switcher;
@UiField MaterialAnchorButton replyAll, reply, forward;
@UiField MaterialCollection messagesCollection;
@UiField MaterialProgress messageLoader, messagesLoader;
@UiField MaterialBadge badge;
@UiField ShowMorePagerPanel pagerPanel;
MyMaterialCollection<ConvMessage> messagesCollection;
private ConvMessage currentSelected;
private DisplayMessage displayMessage;
private WriteMessage newMessageDisplay;
@ -160,7 +161,6 @@ public class ApplicationView extends Composite {
});
}
private void showErrorOccurred() {
messagesCollection.clear();
messagesLoader.setVisible(false);
messageLoader.setVisible(false);
hideSidePanel();
@ -172,18 +172,21 @@ public class ApplicationView extends Composite {
* @param sent
*/
public void showMessages(ArrayList<ConvMessage> messages, boolean sent) {
messagesCollection.clear();
messagesLoader.setVisible(false);
messagesCollection.setVisible(true);
int scrollerHeight = Window.getClientHeight() - 100;
scrollerPanel.setHeight(scrollerHeight+"px");
scrollerPanel.setHeight(scrollerHeight+"px");
pagerPanel.setHeight(scrollerHeight+"px");
GWT.log("message returned are "+messages.size());
messagesCollection= new MyMaterialCollection<>(messages, c -> new MessageItem(c, messagesCollection, this, sent));
messagesCollection.init();
pagerPanel.setDisplay(messagesCollection);
for (ConvMessage convMessage : messages) {
messagesCollection.add(new MessageItem(convMessage, messagesCollection, this, sent));
if (! (sent || convMessage.isRead()))
unreadMessages++;
totalMessages++;
}
if (messages.size() > 0) {
GWT.log("message returned are "+messages.size());
MessageItem first = (MessageItem) messagesCollection.getChildrenList().get(0);
first.setSelected(true);
} else {
@ -247,7 +250,6 @@ public class ApplicationView extends Composite {
}
private void displayMessage(String messageId, final boolean sent) {
messageLoader.setColor(Utils.getRandomColor());
messageLoader.setVisible(true);
scrollerPanel.clear();
convService.getMessageById(messageId, toggleSwitch, new AsyncCallback<ConvMessage>() {
@ -321,7 +323,8 @@ public class ApplicationView extends Composite {
private void displayNewOrReplyMessage() {
WRITING_MESSAGE = true;
FAB.setVisible(false);
messagesCollection.clearActive();
if (messagesCollection != null)
messagesCollection.clearActive();
scrollerPanel.clear();
scrollerPanel.add(newMessageDisplay);
newMessageDisplay.setFocusOnUsersInput();
@ -332,7 +335,10 @@ public class ApplicationView extends Composite {
private void prepareNewMessageForSendTo(String[] usernamesToSendTo) {
newMessageDisplay = new WriteMessage(convService, this);
newMessageDisplay.setNewMessageForSendTo(usernamesToSendTo);
GWT.log("setNewMessageForSendTo - Done");
displayNewOrReplyMessage();
GWT.log("displayNewOrReplyMessage - Done");
}
@UiHandler("newMessage")

View File

@ -1,7 +1,9 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:m="urn:import:gwt.material.design.client.ui"
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:m="urn:import:gwt.material.design.client.ui"
xmlns:ma="urn:import:gwt.material.design.addins.client"
xmlns:mc="urn:import:org.gcube.portets.user.message_conversations.client.autocomplete">
xmlns:mc="urn:import:org.gcube.portets.user.message_conversations.client.autocomplete"
xmlns:my="urn:import:org.gcube.portets.user.message_conversations.client.ui">
<ui:style>
.animation {
@ -41,42 +43,47 @@
<g:HTMLPanel ui:field="htmlPanel">
<!-- TOP BAR -->
<m:MaterialHeader ui:field="header">
<m:MaterialNavBar ui:field="navBar" layoutPosition="FIXED"
addStyleNames="{style.topBar}" height="60" backgroundColor="WHITE">
<m:MaterialNavSection float="LEFT" showOn="SHOW_ON_MED_DOWN">
<m:MaterialLink iconType="MENU" iconColor="LIGHT_BLUE_DARKEN_2"
paddingLeft="25" waves="DEFAULT" ui:field="menu" hideOn="HIDE_ON_MED_DOWN" />
<m:MaterialLink iconType="INBOX" textColor="LIGHT_BLUE_DARKEN_2"
ui:field="switcher" waves="DEFAULT" paddingLeft="25">
<m:MaterialBadge text="22 unread" backgroundColor="LIGHT_BLUE_DARKEN_2"
textColor="WHITE" circle="false" ui:field="badge" visible="false"
<m:MaterialNavBar ui:field="navBar"
layoutPosition="FIXED" addStyleNames="{style.topBar}" height="60"
backgroundColor="WHITE">
<m:MaterialNavSection float="LEFT"
showOn="SHOW_ON_MED_DOWN">
<m:MaterialLink iconType="MENU"
iconColor="LIGHT_BLUE_DARKEN_2" paddingLeft="25" waves="DEFAULT"
ui:field="menu" hideOn="HIDE_ON_MED_DOWN" />
<m:MaterialLink iconType="INBOX"
textColor="LIGHT_BLUE_DARKEN_2" ui:field="switcher"
waves="DEFAULT" paddingLeft="25">
<m:MaterialBadge text="22 unread"
backgroundColor="LIGHT_BLUE_DARKEN_2" textColor="WHITE"
circle="false" ui:field="badge" visible="false"
hideOn="HIDE_ON_MED_DOWN" />
</m:MaterialLink>
<m:MaterialLink ui:field="newMessage" text="New"
showOn="SHOW_ON_MED_DOWN" iconType="MESSAGE" textColor="LIGHT_BLUE_DARKEN_2"
waves="LIGHT" />
showOn="SHOW_ON_MED_DOWN" iconType="MESSAGE"
textColor="LIGHT_BLUE_DARKEN_2" waves="LIGHT" />
</m:MaterialNavSection>
</m:MaterialNavBar>
</m:MaterialHeader>
<!-- SIDE PANEL -->
<m:MaterialRow ui:field="rightPanel" overflow="AUTO"
depth="995" grid="l3 m3 s12" padding="0" backgroundColor="WHITE"
height="100%" layoutPosition="FIXED" top="60" left="0" width="350px"
<m:MaterialRow ui:field="rightPanel" depth="995"
grid="l3 m3 s12" padding="0" backgroundColor="WHITE" height="90%"
layoutPosition="FIXED" top="60" left="0" width="350px"
addStyleNames="{style.animation} {style.borderRight}">
<m:MaterialProgress type="INDETERMINATE" ui:field="messagesLoader"
color="BLUE" />
<m:MaterialCollection ui:field="messagesCollection"
addStyleNames="{style.marginTop}" visible="false">
</m:MaterialCollection>
<m:MaterialProgress type="INDETERMINATE"
ui:field="messagesLoader" color="BLUE" />
<my:ShowMorePagerPanel ui:field="pagerPanel"
addStyleNames="{style.marginTop}">
</my:ShowMorePagerPanel>
</m:MaterialRow>
<!-- MAIN WINDOW -->
<m:MaterialContainer fontSize="0.8em">
<m:MaterialRow layoutPosition="RELATIVE" grid="l8 s12 m12"
top="65">
<m:MaterialRow layoutPosition="RELATIVE"
grid="l8 s12 m12" top="65">
<m:MaterialProgress type="INDETERMINATE"
ui:field="messageLoader" color="TEAL" />
<g:ScrollPanel height="600px" ui:field="scrollerPanel"
@ -86,16 +93,20 @@
<!-- FAB -->
<m:MaterialFAB ui:field="FAB">
<m:MaterialButton type="FLOATING" backgroundColor="RED"
iconType="REPLY" size="LARGE" />
<m:MaterialButton type="FLOATING"
backgroundColor="RED" iconType="REPLY" size="LARGE" />
<m:MaterialFABList>
<m:MaterialAnchorButton type="FLOATING"
waves="LIGHT" backgroundColor="BLUE" ui:field="forward" iconType="FORWARD" />
waves="LIGHT" backgroundColor="BLUE" ui:field="forward"
iconType="FORWARD" />
<m:MaterialAnchorButton type="FLOATING"
waves="LIGHT" backgroundColor="AMBER" ui:field="replyAll" iconType="REPLY_ALL" />
waves="LIGHT" backgroundColor="AMBER" ui:field="replyAll"
iconType="REPLY_ALL" />
<m:MaterialAnchorButton type="FLOATING"
waves="LIGHT" backgroundColor="TEAL" ui:field="reply" iconType="REPLY" />
waves="LIGHT" backgroundColor="TEAL" ui:field="reply"
iconType="REPLY" />
</m:MaterialFABList>
</m:MaterialFAB>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,113 @@
package org.gcube.portets.user.message_conversations.client.ui;
import java.util.ArrayList;
import java.util.function.Function;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.HasRows;
import com.google.gwt.view.client.Range;
import com.google.gwt.view.client.RangeChangeEvent.Handler;
import gwt.material.design.client.ui.MaterialCollection;
public class MyMaterialCollection<T> extends MaterialCollection implements HasRows {
private final int DEFAULT_LENGTH= 20;
private boolean init_called = false;
ArrayList<T> objects = new ArrayList<>();
Function<T, Widget> converter;
public MyMaterialCollection(ArrayList<T> objects, Function<T, Widget> function) {
this.objects = objects;
this.converter = function;
}
int start=0;
int length=DEFAULT_LENGTH;
public void init(){
if (init_called) GWT.log("init already called");
else {
init_called = true;
onRangeChanged();
}
}
private void onRangeChanged() {
int widgetCountIndex = super.getWidgetCount()-1;
int index = widgetCountIndex-1>start ? widgetCountIndex: start;
int finish = length>objects.size()? objects.size():length ;
for (int i =index; i<finish; i++) {
super.add(converter.apply(objects.get(i)));
}
}
public void add(Widget widget) {}
@Override
public HandlerRegistration addRangeChangeHandler(Handler handler) {
return new MyHandlerRegistration();
}
@Override
public HandlerRegistration addRowCountChangeHandler(
com.google.gwt.view.client.RowCountChangeEvent.Handler handler) {
return new MyHandlerRegistration();
}
@Override
public int getRowCount() {
GWT.log("get row count");
return objects.size();
}
@Override
public Range getVisibleRange() {
GWT.log("get visible range");
return new Range(start, length);
}
@Override
public boolean isRowCountExact() {
GWT.log("is row exact");
return true;
}
@Override
public void setRowCount(int count) {
GWT.log("set row count");
}
@Override
public void setRowCount(int count, boolean isExact) {
GWT.log("set row count ex");
}
@Override
public void setVisibleRange(int start, int length) {
this.start = start;
this.length = length;
onRangeChanged();
}
@Override
public void setVisibleRange(Range range) {
this.setVisibleRange(range.getStart(), range.getLength());
}
class MyHandlerRegistration implements HandlerRegistration{
@Override
public void removeHandler() {
GWT.log("handler removed");
}
}
}

View File

@ -0,0 +1,106 @@
package org.gcube.portets.user.message_conversations.client.ui;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.user.cellview.client.AbstractPager;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.HasRows;
/**
* A scrolling pager that automatically increases the range every time the
* scroll bar reaches the bottom.
*/
public class ShowMorePagerPanel extends AbstractPager {
/**
* The default increment size.
*/
private static final int DEFAULT_INCREMENT = 20;
/**
* The increment size.
*/
private int incrementSize = DEFAULT_INCREMENT;
/**
* The last scroll position.
*/
private int lastScrollPos = 0;
/**
* The scrollable panel.
*/
private final ScrollPanel scrollable = new ScrollPanel();
/**
* Construct a new {@link ShowMorePagerPanel}.
*/
public ShowMorePagerPanel() {
initWidget(scrollable);
// Do not let the scrollable take tab focus.
scrollable.getElement().setTabIndex(-1);
// Handle scroll events.
scrollable.addScrollHandler(new ScrollHandler() {
public void onScroll(ScrollEvent event) {
// If scrolling up, ignore the event.
int oldScrollPos = lastScrollPos;
lastScrollPos = scrollable.getVerticalScrollPosition();
if (oldScrollPos >= lastScrollPos) {
return;
}
HasRows display = getDisplay();
if (display == null) {
return;
}
int maxScrollTop = scrollable.getWidget().getOffsetHeight()
- scrollable.getOffsetHeight();
if (lastScrollPos >= maxScrollTop) {
// We are near the end, so increase the page size.
int newPageSize = Math.min(
display.getVisibleRange().getLength() + incrementSize,
display.getRowCount());
display.setVisibleRange(0, newPageSize);
}
}
});
}
/**
* Get the number of rows by which the range is increased when the scrollbar
* reaches the bottom.
*
* @return the increment size
*/
public int getIncrementSize() {
return incrementSize;
}
@Override
public void setDisplay(HasRows display) {
assert display instanceof Widget : "display must extend Widget";
scrollable.setWidget((Widget) display);
scrollable.scrollToTop();
super.setDisplay(display);
}
/**
* Set the number of rows by which the range is increased when the scrollbar
* reaches the bottom.
*
* @param incrementSize the incremental number of rows
*/
public void setIncrementSize(int incrementSize) {
GWT.log("increment of "+ incrementSize);
this.incrementSize = incrementSize;
}
@Override
protected void onRangeOrRowCountChanged() {
GWT.log("range changed ...");
}
}

View File

@ -83,7 +83,7 @@ public class WriteMessage extends Composite {
}
public void setNewMessageForSendTo(String[] usernames) {
GWT.log("her add the users");
GWT.log("setNewMessageForSendTo - here add the users");
convService.getUsersInfo(usernames, new AsyncCallback<ArrayList<WSUser>>() {
@Override
public void onFailure(Throwable caught) {
@ -91,7 +91,7 @@ public class WriteMessage extends Composite {
@Override
public void onSuccess(ArrayList<WSUser> result) {
for (WSUser user : result) {
acModal.addItem(new UserSuggestion(user));
acModal.addItem(new UserSuggestion(user));
}
}
});

View File

@ -0,0 +1,79 @@
package org.gcube.portets.user.message_conversations.server;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import org.gcube.portets.user.message_conversations.client.MessageService;
import org.gcube.portets.user.message_conversations.shared.ConvMessage;
import org.gcube.portets.user.message_conversations.shared.CurrUserAndPortalUsersWrapper;
import org.gcube.portets.user.message_conversations.shared.WSUser;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial")
public class ConvService extends RemoteServiceServlet implements MessageService, HttpServletRetriever {
MessageService delegate;
public void init() {
delegate = new ConvServiceImpl(this);
}
@Override
public ArrayList<ConvMessage> getMessages(boolean sent) {
return delegate.getMessages(sent);
}
@Override
public ConvMessage getMessageById(String messageId, boolean sent) {
return delegate.getMessageById(messageId, sent);
}
@Override
public CurrUserAndPortalUsersWrapper getWorkspaceUsers() {
return delegate.getWorkspaceUsers();
}
@Override
public ArrayList<WSUser> getUsersInfo(String[] usernames) {
return delegate.getUsersInfo(usernames);
}
@Override
public ArrayList<WSUser> searchUsers(String keyword) {
return delegate.searchUsers(keyword);
}
@Override
public boolean sendToById(ArrayList<String> recipientIds, ArrayList<String> listAttachmentsId, String subject,
String body) {
return delegate.sendToById(recipientIds, listAttachmentsId, subject, body);
}
@Override
public boolean deleteMessageById(String messageId, boolean sent) {
return delegate.deleteMessageById(messageId, sent);
}
@Override
public String getAttachmentDownloadURL(String itemId) {
return delegate.getAttachmentDownloadURL(itemId);
}
@Override
public boolean saveAttachmentToWorkspaceFolder(String itemId, String destinationFolderId) {
return delegate.saveAttachmentToWorkspaceFolder(itemId, destinationFolderId);
}
@Override
public boolean markMessageUnread(String messageId, boolean sent) {
return delegate.markMessageUnread(messageId, sent);
}
@Override
public HttpServletRequest getRequest() {
return getThreadLocalRequest();
}
}

View File

@ -13,10 +13,13 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.dsl.ContainerType;
import org.gcube.common.storagehub.client.dsl.FileContainer;
import org.gcube.common.storagehub.client.dsl.OpenResolver;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
import org.gcube.common.storagehub.client.proxies.MessageManagerClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.FolderItem;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehub.model.messages.Message;
@ -37,7 +40,6 @@ import org.gcube.vomanagement.usermanagement.util.ManagementUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.User;
@ -47,16 +49,19 @@ import com.liferay.portal.util.PortalUtil;
/**
* @author Massimiliano Assante, CNR-ISTI
*/
@SuppressWarnings("serial")
public class ConvServiceImpl extends RemoteServiceServlet implements MessageService {
public class ConvServiceImpl implements MessageService {
private static final Logger _log = LoggerFactory.getLogger(ConvServiceImpl.class);
private final int MESSAGE_BODY_CHAR_LIMIT = 79;
private PortalContext pContext;
private UserManager um;
public void init() {
private HttpServletRetriever requestRetriever;
ConvServiceImpl(HttpServletRetriever servletRetriever) {
um = new LiferayUserManager();
pContext = PortalContext.getConfiguration();
requestRetriever= servletRetriever;
}
/**
*
@ -89,26 +94,27 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
return null;
}
} else {
return pContext.getCurrentUser(getThreadLocalRequest());
return pContext.getCurrentUser(requestRetriever.getRequest());
}
}
@Override
public ArrayList<ConvMessage> getMessages(boolean sent) {
ArrayList<ConvMessage> toReturn = new ArrayList<>();
try {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
pContext = PortalContext.getConfiguration();
_log.debug("*** Reading user = " +user.getFullname());
String scope = pContext.getCurrentScope(getThreadLocalRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
ScopeProvider.instance.set(scope);
String token = pContext.getCurrentUserToken(scope, user.getUserId());
SecurityTokenProvider.instance.set(token);
MessageManagerClient client = AbstractPlugin.messages().build();
long start = System.currentTimeMillis();
List<Message> listMessages = (sent) ? client.getSentMessages(79)
: client.getReceivedMessages(79);
List<Message> listMessages = (sent) ? client.getSentMessages(MESSAGE_BODY_CHAR_LIMIT)
: client.getReceivedMessages(MESSAGE_BODY_CHAR_LIMIT);
if (listMessages == null) {
_log.error("listMessages is null, Could not read messages of {}", user.getFullname());
return null;
@ -186,8 +192,8 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
@Override
public boolean markMessageUnread(String messageId, boolean sent) {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
String scope = pContext.getCurrentScope(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
SecurityTokenProvider.instance.set(pContext.getCurrentUserToken(scope, user.getUserId()));
try {
MessageManagerClient client = AbstractPlugin.messages().build();
@ -203,9 +209,9 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
public ConvMessage getMessageById(String messageId, boolean sent) {
ConvMessage toReturn = null;
try {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
_log.debug("*** Reading user from liferay session = " +user.getFullname());
String scope = pContext.getCurrentScope(getThreadLocalRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
SecurityTokenProvider.instance.set(pContext.getCurrentUserToken(scope, user.getUserId()));
LiferayUserManager um = new LiferayUserManager();
MessageManagerClient client = AbstractPlugin.messages().build();
@ -262,8 +268,8 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
@Override
public String getAttachmentDownloadURL(String itemId) {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
String scope = pContext.getCurrentScope(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
SecurityTokenProvider.instance.set(pContext.getCurrentUserToken(scope, user.getUserId()));
_log.info("getAttachmentDownloadURL for user "+user.getUsername() + " file id="+itemId);
try {
@ -278,8 +284,8 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
}
@Override
public boolean saveAttachmentToWorkspaceFolder(String itemId, String destinationFolderId) {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
String scope = pContext.getCurrentScope(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
SecurityTokenProvider.instance.set(pContext.getCurrentUserToken(scope, user.getUserId()));
try {
StorageHubClient shc = new StorageHubClient();
@ -294,9 +300,9 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
@Override
public boolean deleteMessageById(String messageId, boolean sent) {
GCubeUser user = getCurrentUser(getThreadLocalRequest());
GCubeUser user = getCurrentUser(requestRetriever.getRequest());
_log.debug("deleteMessageById reading user from liferay session = " +user.getFullname() + " m id = " + messageId);
String scope = pContext.getCurrentScope(getThreadLocalRequest());
String scope = pContext.getCurrentScope(requestRetriever.getRequest());
SecurityTokenProvider.instance.set(pContext.getCurrentUserToken(scope, user.getUserId()));
try {
MessageManagerClient client = AbstractPlugin.messages().build();
@ -313,7 +319,7 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
public ArrayList<WSUser> searchUsers(String keyword) {
ArrayList<WSUser> toReturn = new ArrayList<>();
if (isWithinPortal()) {
long gatewayGroupId = pContext.getCurrentGroupId(this.getThreadLocalRequest());
long gatewayGroupId = pContext.getCurrentGroupId(this.requestRetriever.getRequest());
try {
_log.debug("Searching " + keyword);
List<GCubeUser> users = um.searchUsersByGroup(keyword, gatewayGroupId);
@ -357,7 +363,7 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
@Override
public boolean sendToById(ArrayList<String> recipientIds, ArrayList<String> listAttachmentsId, String subject, String body) {
PortalContext pContext = PortalContext.getConfiguration();
GCubeUser currentUser = pContext.getCurrentUser(getThreadLocalRequest());
GCubeUser currentUser = pContext.getCurrentUser(requestRetriever.getRequest());
MessageManagerClient client = AbstractPlugin.messages().build();
try {
_log.info("Sending message to: " + recipientIds.toString());
@ -365,17 +371,17 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
String checkedBody = body;
String messageId = client.sendMessage(recipientIds, checkedSubject, checkedBody, listAttachmentsId);
/*try {
try {
body += getPublicLinksForAttachs(listAttachmentsId);
catch (StorageHubException e) {
}
catch (Exception e) {
_log.error("Ops, could not generate publick link for some of the attachments");
}*/
}
_log.debug("Sending message notification to: " + recipientIds.toString());
List<GenericItemBean> recipients = getUsersbyUserId(recipientIds);
NotificationsManager nm = new ApplicationNotificationsManager(new SocialNetworkingSite(getThreadLocalRequest()), pContext.getCurrentScope(getThreadLocalRequest()),
NotificationsManager nm = new ApplicationNotificationsManager(new SocialNetworkingSite(requestRetriever.getRequest()), pContext.getCurrentScope(requestRetriever.getRequest()),
new SocialNetworkingUser(
currentUser.getUsername(),
currentUser.getEmail(),
@ -429,10 +435,8 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
* @throws ItemNotFoundException
* @throws InternalErrorException
*/
/*
private String getPublicLinksForAttachs(ArrayList<String> listAttachments) {
if (listAttachments != null && (!listAttachments.isEmpty()) ) {
StorageHubClient client = new StorageHubClient();
StringBuilder builder = new StringBuilder();
@ -444,24 +448,22 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
try {
OpenResolver openResolver = client.open(itemId);
if(openResolver.asItem().getType()==ContainerType.FOLDER) {
String publicLink = openResolver.getPublickLink(itemId).toString();;
String itemName = item.getTitle();
if(openResolver.resolve().getType()==ContainerType.FILE) {
String publicLink = openResolver.asFile().getPublicLink().toString();
String itemName = openResolver.asFile().get().getTitle();
builder.append(itemName + " ("+publicLink+")");
builder.append("\n");
}catch (StorageHubException e) {
_log.error("While reading attachments");
}
} catch (StorageHubException e) {
_log.error("While reading attachments", e);
e.printStackTrace();
}
}
}
}
_log.debug("returning public links: "+builder.toString());
return builder.toString();
}
else return "";
}*/
}
return "";
}
/**
@ -472,7 +474,7 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
public CurrUserAndPortalUsersWrapper getWorkspaceUsers() {
PortalContext pContext = PortalContext.getConfiguration();
GCubeUser currentUser = pContext.getCurrentUser(getThreadLocalRequest());
GCubeUser currentUser = pContext.getCurrentUser(requestRetriever.getRequest());
_log.debug("trying to get WorkspaceUsers ..");
WSUser currUser = null;
ArrayList<WSUser> portalUsers = new ArrayList<WSUser>();

View File

@ -0,0 +1,144 @@
package org.gcube.portets.user.message_conversations.server;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.portets.user.message_conversations.client.MessageService;
import org.gcube.portets.user.message_conversations.shared.ConvMessage;
import org.gcube.portets.user.message_conversations.shared.CurrUserAndPortalUsersWrapper;
import org.gcube.portets.user.message_conversations.shared.MessageUserModel;
import org.gcube.portets.user.message_conversations.shared.WSUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FakeConvServiceImpl implements MessageService{
private static final Logger _log = LoggerFactory.getLogger(FakeConvServiceImpl.class);
ArrayList<ConvMessage> receivedMessages;
ArrayList<ConvMessage> sentMessages;
Map<String,ConvMessage> receivedMessagesMap = new HashMap<>();
Map<String,ConvMessage> sentMessagesMap = new HashMap<>();
final int messageReceivedNumberToTest = 200;
final int messageSentNumberToTest = 11;
public FakeConvServiceImpl() {
Calendar cal = Calendar.getInstance();
MessageUserModel mu = new MessageUserModel("andrea.rossi");
List<MessageUserModel> recipients = Arrays.asList(new MessageUserModel("lucio.lelii"));
String prefix ="received";
receivedMessages = new ArrayList<>();
for (int i =0; i<messageReceivedNumberToTest; i++) {
String id = "id-"+prefix+i;
ConvMessage msg= new ConvMessage(id, prefix+i, mu, recipients, new Date(cal.getTimeInMillis()), prefix+i, false, false);
receivedMessages.add(msg);
receivedMessagesMap.put(id, msg);
}
prefix ="sent";
sentMessages = new ArrayList<>();
for (int i =0; i<messageSentNumberToTest; i++) {
String id = "id-"+prefix+i;
ConvMessage msg= new ConvMessage(id, prefix+i, mu, recipients, new Date(cal.getTimeInMillis()), prefix+i, false, false);
sentMessages.add(msg);
sentMessagesMap.put(id, msg);
}
}
@Override
public ArrayList<ConvMessage> getMessages(boolean sent) {
if (sent) {
_log.info("sent messages call with sent {}",sent);
return new ArrayList<>(sentMessages);
}
else {
_log.info("received messages call with sent {}",sent);
return new ArrayList<>(receivedMessages);
}
}
@Override
public ConvMessage getMessageById(String messageId, boolean sent) {
_log.info("get messageById called with id {} and sent {}", messageId,sent );
ConvMessage msg;
if (sent)
msg = sentMessagesMap.get(messageId);
else msg = receivedMessagesMap.get(messageId);
msg.setRead(true);
return msg;
}
@Override
public CurrUserAndPortalUsersWrapper getWorkspaceUsers() {
_log.debug("trying to get WorkspaceUsers ..");
WSUser currUser = new WSUser("andrea.rossi", "andrea.rossi", "Andrea Rossi", "m.assante@gmail.com");
ArrayList<WSUser> portalUsers = new ArrayList<WSUser>();
for (int i = 0; i < 10; i++) {
portalUsers.add(new WSUser(""+i, "username"+i, "userGetFullname()"+i, "user.getEmail()"+i));
}
CurrUserAndPortalUsersWrapper toReturn = new CurrUserAndPortalUsersWrapper(currUser, portalUsers);
return toReturn;
}
@Override
public ArrayList<WSUser> getUsersInfo(String[] usernames) {
return new ArrayList<>(Arrays.asList(new WSUser("andrea.rossi", "andrea.rossi", "Andrea Rossi", "m.assante@gmail.com")));
}
@Override
public ArrayList<WSUser> searchUsers(String keyword) {
return new ArrayList<>(Arrays.asList(new WSUser("andrea.rossi", "andrea.rossi", "Andrea Rossi", "m.assante@gmail.com")));
}
@Override
public boolean sendToById(ArrayList<String> recipientIds, ArrayList<String> listAttachmentsId, String subject,
String body) {
_log.info("email sent");
return true;
}
@Override
public boolean deleteMessageById(String messageId, boolean sent) {
_log.info("message deleted");
return true;
}
@Override
public String getAttachmentDownloadURL(String itemId) {
return "www.google.it";
}
@Override
public boolean saveAttachmentToWorkspaceFolder(String itemId, String destinationFolderId) {
_log.info("attachment saved");
return true;
}
@Override
public boolean markMessageUnread(String messageId, boolean sent) {
_log.info("message marked");
return true;
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.portets.user.message_conversations.server;
import javax.servlet.http.HttpServletRequest;
public interface HttpServletRetriever {
HttpServletRequest getRequest();
}

View File

@ -9,7 +9,7 @@
padding: 3px;
}
#wpTreepopup>div.modal-body>table>tbody>tr:nth-child (1) >td {
#wpTreepopup>div.modal-body>table>tbody>tr:nth-child(1)>td {
padding: 0px;
}
@ -44,7 +44,7 @@
color: #ccc !important;
}
.message-metadata>div:not (.empty-state ) h4 {
.message-metadata>div:not(.empty-state ) h4 {
font-size: 2em;
margin-top: 10px !important;
font-weight: 400 !important;

View File

@ -7,7 +7,7 @@
<!-- Servlets -->
<servlet>
<servlet-name>convServlet</servlet-name>
<servlet-class>org.gcube.portets.user.message_conversations.server.ConvServiceImpl</servlet-class>
<servlet-class>org.gcube.portets.user.message_conversations.server.ConvService</servlet-class>
</servlet>
<servlet-mapping>
@ -20,7 +20,7 @@
<servlet-class>com.liferay.portal.kernel.servlet.PortalDelegateServlet</servlet-class>
<init-param>
<param-name>servlet-class</param-name>
<param-value>org.gcube.portets.user.message_conversations.server.ConvServiceImpl</param-value>
<param-value>org.gcube.portets.user.message_conversations.server.ConvService</param-value>
</init-param>
<init-param>
<param-name>sub-context</param-name>