From 52ac6121f6f5b3c34f91dc1f078aa305afcfb88a Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 21 Jan 2013 11:30:24 +0000 Subject: [PATCH] Initial import. git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@68137 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 36 ++++ .project | 59 ++++++ .settings/.jsdtscope | 15 ++ .../com.google.appengine.eclipse.core.prefs | 3 + .settings/com.google.gdt.eclipse.core.prefs | 6 + .settings/com.google.gwt.eclipse.core.prefs | 5 + .settings/org.eclipse.core.resources.prefs | 7 + .settings/org.eclipse.jdt.core.prefs | 9 + .settings/org.eclipse.m2e.core.prefs | 5 + .settings/org.eclipse.wst.common.component | 11 ++ ....eclipse.wst.common.project.facet.core.xml | 7 + ...rg.eclipse.wst.jsdt.ui.superType.container | 1 + .settings/org.maven.ide.eclipse.prefs | 9 + SocialProfileTest-dev.launch | 22 +++ SocialProfileTest-prod.launch | 22 +++ pom.xml | 187 ++++++++++++++++++ .../socialprofile/client/GreetingService.java | 12 ++ .../client/GreetingServiceAsync.java | 9 + .../socialprofile/client/SocialProfile.java | 148 ++++++++++++++ .../server/GreetingServiceImpl.java | 48 +++++ .../server/portlet/SocialProfilePortlet.java | 32 +++ .../socialprofile/shared/FieldVerifier.java | 42 ++++ .../user/socialprofile/SocialProfile.gwt.xml | 26 +++ .../socialprofile/client/Messages.properties | 2 + .../client/Messages_fr.properties | 2 + src/main/webapp/SocialProfile.css | 34 ++++ src/main/webapp/SocialProfile.html | 63 ++++++ .../webapp/WEB-INF/jsp/SocialProfile_view.jsp | 14 ++ src/main/webapp/WEB-INF/liferay-display.xml | 8 + .../WEB-INF/liferay-plugin-package.properties | 9 + src/main/webapp/WEB-INF/liferay-portlet.xml | 28 +++ src/main/webapp/WEB-INF/portlet.xml | 30 +++ src/main/webapp/WEB-INF/web.xml | 24 +++ src/main/webapp/images/coming_soon.jpg | Bin 0 -> 9973 bytes .../client/GwtTestSocialProfile.java | 75 +++++++ .../socialprofile/SocialProfileJUnit.gwt.xml | 9 + 36 files changed, 1019 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/.jsdtscope create mode 100644 .settings/com.google.appengine.eclipse.core.prefs create mode 100644 .settings/com.google.gdt.eclipse.core.prefs create mode 100644 .settings/com.google.gwt.eclipse.core.prefs create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 .settings/org.eclipse.wst.common.component create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 .settings/org.maven.ide.eclipse.prefs create mode 100644 SocialProfileTest-dev.launch create mode 100644 SocialProfileTest-prod.launch create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingService.java create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingServiceAsync.java create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/server/GreetingServiceImpl.java create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/server/portlet/SocialProfilePortlet.java create mode 100644 src/main/java/org/gcube/portlets/user/socialprofile/shared/FieldVerifier.java create mode 100644 src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml create mode 100644 src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages.properties create mode 100644 src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages_fr.properties create mode 100644 src/main/webapp/SocialProfile.css create mode 100644 src/main/webapp/SocialProfile.html create mode 100644 src/main/webapp/WEB-INF/jsp/SocialProfile_view.jsp create mode 100644 src/main/webapp/WEB-INF/liferay-display.xml create mode 100644 src/main/webapp/WEB-INF/liferay-plugin-package.properties create mode 100644 src/main/webapp/WEB-INF/liferay-portlet.xml create mode 100644 src/main/webapp/WEB-INF/portlet.xml create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/images/coming_soon.jpg create mode 100644 src/test/java/org/gcube/portlets/user/socialprofile/client/GwtTestSocialProfile.java create mode 100644 src/test/resources/org/gcube/portlets/user/socialprofile/SocialProfileJUnit.gwt.xml diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..aa63bb7 --- /dev/null +++ b/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..eedc03e --- /dev/null +++ b/.project @@ -0,0 +1,59 @@ + + + social-profile + social-profile project + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + com.google.gwt.eclipse.core.gwtNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..ba3c245 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/.settings/com.google.appengine.eclipse.core.prefs b/.settings/com.google.appengine.eclipse.core.prefs new file mode 100644 index 0000000..e4ac63a --- /dev/null +++ b/.settings/com.google.appengine.eclipse.core.prefs @@ -0,0 +1,3 @@ +#Mon Jan 21 12:20:12 CET 2013 +eclipse.preferences.version=1 +filesCopiedToWebInfLib= diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 0000000..caa65d7 --- /dev/null +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,6 @@ +#Mon Jan 21 12:24:20 CET 2013 +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +lastWarOutDir=/Users/massi/Documents/workspace/social-profile/target/social-profile-0.1.0-SNAPSHOT +warSrcDir=src/main/webapp +warSrcDirIsOutput=false diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 0000000..c803c44 --- /dev/null +++ b/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,5 @@ +#Thu Jun 16 11:14:17 CEST 2011 +eclipse.preferences.version=1 +entryPointModules= +filesCopiedToWebInfLib=gwt-servlet.jar +gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+ diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..5d8b3cc --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,7 @@ +#Mon Jan 21 12:20:12 CET 2013 +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/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ad26666 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +#Thu Sep 02 10:42:20 CEST 2010 +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 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..a22402a --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Mon Jan 21 12:20:12 CET 2013 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..737c457 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..18c1b9a --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.maven.ide.eclipse.prefs b/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000..c74c58e --- /dev/null +++ b/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Thu Sep 02 10:42:12 CEST 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/SocialProfileTest-dev.launch b/SocialProfileTest-dev.launch new file mode 100644 index 0000000..3b2a700 --- /dev/null +++ b/SocialProfileTest-dev.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/SocialProfileTest-prod.launch b/SocialProfileTest-prod.launch new file mode 100644 index 0000000..01943c8 --- /dev/null +++ b/SocialProfileTest-prod.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d64e7cf --- /dev/null +++ b/pom.xml @@ -0,0 +1,187 @@ + + + + 4.0.0 + + maven-parent + org.gcube.tools + 1.0.0 + + + + org.gcube.portlets.user + social-profile + war + 0.1.0-SNAPSHOT + gCube Social Profile Portlet + + + + 2.4.0 + distro + + 1.6 + 1.6 + ${project.build.directory}/${project.build.finalName} + + UTF-8 + UTF-8 + + + + + + xerces + xercesImpl + 2.9.1 + provided + + + com.google.gwt + gwt-user + ${gwtVersion} + provided + + + com.google.gwt + gwt-servlet + ${gwtVersion} + provided + + + org.gcube.core + gcf + [1.4.0,1.5.0] + provided + + + org.gcube.portal + custom-portal-handler + 1.2.0-SNAPSHOT + provided + + + org.gcube.applicationsupportlayer + aslcore + 3.2.0-2.12.0 + provided + + + com.liferay.portal + portal-service + 6.0.6 + provided + + + javax.portlet + portlet-api + 2.0 + provided + + + org.gcube.portal + social-networking-library + 1.0.0-SNAPSHOT + provided + + + junit + junit + 4.7 + test + + + javax.validation + validation-api + 1.0.0.GA + test + + + javax.validation + validation-api + 1.0.0.GA + sources + test + + + + + + ${webappDirectory}/WEB-INF/classes + + + + + + org.codehaus.mojo + gwt-maven-plugin + 2.4.0 + + + + compile + + + + + + + Notifications.html + ${webappDirectory} + org.gcube.portlets.user.notifications.client.Messages + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + compile + + exploded + + + + + ${webappDirectory} + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.5 + 1.5 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${distroDirectory}/descriptor.xml + + + + + servicearchive + install + + single + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingService.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingService.java new file mode 100644 index 0000000..a77537b --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingService.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.socialprofile.client; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +/** + * The client side stub for the RPC service. + */ +@RemoteServiceRelativePath("greet") +public interface GreetingService extends RemoteService { + String greetServer(String name) throws IllegalArgumentException; +} diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingServiceAsync.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingServiceAsync.java new file mode 100644 index 0000000..3af119f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/GreetingServiceAsync.java @@ -0,0 +1,9 @@ +package org.gcube.portlets.user.socialprofile.client; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +public interface GreetingServiceAsync { + + void greetServer(String name, AsyncCallback callback); + +} diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java new file mode 100644 index 0000000..a854890 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java @@ -0,0 +1,148 @@ +package org.gcube.portlets.user.socialprofile.client; + +import org.gcube.portlets.user.socialprofile.shared.FieldVerifier; +import com.google.gwt.core.client.EntryPoint; +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.KeyCodes; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.VerticalPanel; + +/** + * Entry point classes define onModuleLoad(). + */ +public class SocialProfile implements EntryPoint { + /** + * The message displayed to the user when the server cannot be reached or + * returns an error. + */ + private static final String SERVER_ERROR = "An error occurred while " + + "attempting to contact the server. Please check your network " + + "connection and try again."; + + /** + * Create a remote service proxy to talk to the server-side Greeting service. + */ + private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class); + + + /** + * This is the entry point method. + */ + public void onModuleLoad() { + final Button sendButton = new Button( "" ); + final TextBox nameField = new TextBox(); + nameField.setText( "" ); + final Label errorLabel = new Label(); + + // We can add style names to widgets + sendButton.addStyleName("sendButton"); + + // Add the nameField and sendButton to the RootPanel + // Use RootPanel.get() to get the entire body element + RootPanel.get("nameFieldContainer").add(nameField); + RootPanel.get("sendButtonContainer").add(sendButton); + RootPanel.get("errorLabelContainer").add(errorLabel); + + // Focus the cursor on the name field when the app loads + nameField.setFocus(true); + nameField.selectAll(); + + // Create the popup dialog box + final DialogBox dialogBox = new DialogBox(); + dialogBox.setText("Remote Procedure Call"); + dialogBox.setAnimationEnabled(true); + final Button closeButton = new Button("Close"); + // We can set the id of a widget by accessing its Element + closeButton.getElement().setId("closeButton"); + final Label textToServerLabel = new Label(); + final HTML serverResponseLabel = new HTML(); + VerticalPanel dialogVPanel = new VerticalPanel(); + dialogVPanel.addStyleName("dialogVPanel"); + dialogVPanel.add(new HTML("Sending name to the server:")); + dialogVPanel.add(textToServerLabel); + dialogVPanel.add(new HTML("
Server replies:")); + dialogVPanel.add(serverResponseLabel); + dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); + dialogVPanel.add(closeButton); + dialogBox.setWidget(dialogVPanel); + + // Add a handler to close the DialogBox + closeButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent event) { + dialogBox.hide(); + sendButton.setEnabled(true); + sendButton.setFocus(true); + } + }); + + // Create a handler for the sendButton and nameField + class MyHandler implements ClickHandler, KeyUpHandler { + /** + * Fired when the user clicks on the sendButton. + */ + public void onClick(ClickEvent event) { + sendNameToServer(); + } + + /** + * Fired when the user types in the nameField. + */ + public void onKeyUp(KeyUpEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + sendNameToServer(); + } + } + + /** + * Send the name from the nameField to the server and wait for a response. + */ + private void sendNameToServer() { + // First, we validate the input. + errorLabel.setText(""); + String textToServer = nameField.getText(); + if (!FieldVerifier.isValidName(textToServer)) { + errorLabel.setText("Please enter at least four characters"); + return; + } + + // Then, we send the input to the server. + sendButton.setEnabled(false); + textToServerLabel.setText(textToServer); + serverResponseLabel.setText(""); + greetingService.greetServer(textToServer, new AsyncCallback() { + public void onFailure(Throwable caught) { + // Show the RPC error message to the user + dialogBox.setText("Remote Procedure Call - Failure"); + serverResponseLabel.addStyleName("serverResponseLabelError"); + serverResponseLabel.setHTML(SERVER_ERROR); + dialogBox.center(); + closeButton.setFocus(true); + } + + public void onSuccess(String result) { + dialogBox.setText("Remote Procedure Call"); + serverResponseLabel.removeStyleName("serverResponseLabelError"); + serverResponseLabel.setHTML(result); + dialogBox.center(); + closeButton.setFocus(true); + } + }); + } + } + + // Add a handler to send the name to the server + MyHandler handler = new MyHandler(); + sendButton.addClickHandler(handler); + nameField.addKeyUpHandler(handler); + } +} diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/server/GreetingServiceImpl.java b/src/main/java/org/gcube/portlets/user/socialprofile/server/GreetingServiceImpl.java new file mode 100644 index 0000000..ecf57a1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/server/GreetingServiceImpl.java @@ -0,0 +1,48 @@ +package org.gcube.portlets.user.socialprofile.server; + +import org.gcube.portlets.user.socialprofile.client.GreetingService; +import org.gcube.portlets.user.socialprofile.shared.FieldVerifier; +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +/** + * The server side implementation of the RPC service. + */ +@SuppressWarnings("serial") +public class GreetingServiceImpl extends RemoteServiceServlet implements + GreetingService { + + public String greetServer(String input) throws IllegalArgumentException { + // Verify that the input is valid. + if (!FieldVerifier.isValidName(input)) { + // If the input is not valid, throw an IllegalArgumentException back to + // the client. + throw new IllegalArgumentException( + "Name must be at least 4 characters long"); + } + + String serverInfo = getServletContext().getServerInfo(); + String userAgent = getThreadLocalRequest().getHeader("User-Agent"); + + // Escape data from the client to avoid cross-site script vulnerabilities. + input = escapeHtml(input); + userAgent = escapeHtml(userAgent); + + return "Hello, " + input + "!

I am running " + serverInfo + + ".

It looks like you are using:
" + userAgent; + } + + /** + * Escape an html string. Escaping data received from the client helps to + * prevent cross-site script vulnerabilities. + * + * @param html the html string to escape + * @return the escaped string + */ + private String escapeHtml(String html) { + if (html == null) { + return null; + } + return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll( + ">", ">"); + } +} diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/server/portlet/SocialProfilePortlet.java b/src/main/java/org/gcube/portlets/user/socialprofile/server/portlet/SocialProfilePortlet.java new file mode 100644 index 0000000..83d753c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/server/portlet/SocialProfilePortlet.java @@ -0,0 +1,32 @@ + +package org.gcube.portlets.user.socialprofile.server.portlet; + +import javax.portlet.GenericPortlet; +import javax.portlet.ActionRequest; +import javax.portlet.RenderRequest; +import javax.portlet.ActionResponse; +import javax.portlet.RenderResponse; +import javax.portlet.PortletException; +import java.io.IOException; +import javax.portlet.PortletRequestDispatcher; + +import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; + +/** + * WfTemplatesPortlet Portlet Class + * + * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it + * @version May 2011 (0.1) + */ + public class SocialProfilePortlet 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/SocialProfile_view.jsp"); + dispatcher.include(request, response); + } + + public void processAction(ActionRequest request, ActionResponse response) + throws PortletException, IOException { + } +} diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/shared/FieldVerifier.java b/src/main/java/org/gcube/portlets/user/socialprofile/shared/FieldVerifier.java new file mode 100644 index 0000000..a2ebb57 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/socialprofile/shared/FieldVerifier.java @@ -0,0 +1,42 @@ +package org.gcube.portlets.user.socialprofile.shared; + +/** + *

+ * FieldVerifier validates that the name the user enters is valid. + *

+ *

+ * This class is in the shared packing because we use it in both + * the client code and on the server. On the client, we verify that the name is + * valid before sending an RPC request so the user doesn't have to wait for a + * network round trip to get feedback. On the server, we verify that the name is + * correct to ensure that the input is correct regardless of where the RPC + * originates. + *

+ *

+ * When creating a class that is used on both the client and the server, be sure + * that all code is translatable and does not use native JavaScript. Code that + * is note translatable (such as code that interacts with a database or the file + * system) cannot be compiled into client side JavaScript. Code that uses native + * JavaScript (such as Widgets) cannot be run on the server. + *

+ */ +public class FieldVerifier { + + /** + * Verifies that the specified name is valid for our service. + * + * In this example, we only require that the name is at least four + * characters. In your application, you can use more complex checks to ensure + * that usernames, passwords, email addresses, URLs, and other fields have the + * proper syntax. + * + * @param name the name to validate + * @return true if valid, false if invalid + */ + public static boolean isValidName(String name) { + if (name == null) { + return false; + } + return name.length() > 3; + } +} diff --git a/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml b/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml new file mode 100644 index 0000000..b4da3d5 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/socialprofile/SocialProfile.gwt.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages.properties new file mode 100644 index 0000000..c222555 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages.properties @@ -0,0 +1,2 @@ +sendButton = Send +nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages_fr.properties new file mode 100644 index 0000000..b4a7627 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/socialprofile/client/Messages_fr.properties @@ -0,0 +1,2 @@ +sendButton = Envoyer +nameField = Entrez votre nom \ No newline at end of file diff --git a/src/main/webapp/SocialProfile.css b/src/main/webapp/SocialProfile.css new file mode 100644 index 0000000..7aca7ac --- /dev/null +++ b/src/main/webapp/SocialProfile.css @@ -0,0 +1,34 @@ +/** Add css rules here for your application. */ + + +/** Example rules used by the template application (remove for your app) */ +h1 { + font-size: 2em; + font-weight: bold; + color: #777777; + margin: 40px 0px 70px; + text-align: center; +} + +.sendButton { + display: block; + font-size: 16pt; +} + +/** Most GWT widgets already have a style name defined */ +.gwt-DialogBox { + width: 400px; +} + +.dialogVPanel { + margin: 5px; +} + +.serverResponseLabelError { + color: red; +} + +/** Set ids using widget.getElement().setId("idOfElement") */ +#closeButton { + margin: 15px 6px 6px; +} diff --git a/src/main/webapp/SocialProfile.html b/src/main/webapp/SocialProfile.html new file mode 100644 index 0000000..78eefdb --- /dev/null +++ b/src/main/webapp/SocialProfile.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + Web Application Starter Project + + + + + + + + + + + + + + + + + + + + + + +

Web Application Starter Project

+ + + + + + + + + + + + +
Please enter your name:
+ + diff --git a/src/main/webapp/WEB-INF/jsp/SocialProfile_view.jsp b/src/main/webapp/WEB-INF/jsp/SocialProfile_view.jsp new file mode 100644 index 0000000..420df1e --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/SocialProfile_view.jsp @@ -0,0 +1,14 @@ +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> + +<%-- Uncomment below lines to add portlet taglibs to jsp +<%@ page import="javax.portlet.*"%> +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> + + +--%> + + +
+ +
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml new file mode 100644 index 0000000..445328e --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-display.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..2e1d3a9 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,9 @@ +name=SocialProfile +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +change-log= +page-url=http://www.d4science.org +author=D4Science.org +licenses=EUPL \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml new file mode 100644 index 0000000..b301be5 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -0,0 +1,28 @@ + + + + + + SocialProfile + false + false + false + /SocialProfile.css + + + administrator + Administrator + + + guest + Guest + + + power-user + Power User + + + user + User + + diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml new file mode 100644 index 0000000..c58bb49 --- /dev/null +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -0,0 +1,30 @@ + + + + + SocialProfile + Social Profile + org.gcube.portlets.user.socialprofile.server.portlet.SocialProfilePortlet + + view-jsp + /view.jsp + + 0 + + text/html + + + Social Profile + Social Profile + Social Profile + + + administrator + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..61e288c --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + + + + + greetServlet + org.gcube.portlets.user.socialprofile.server.GreetingServiceImpl + + + + greetServlet + /SocialProfile/greet + + + + + SocialProfile.html + + + diff --git a/src/main/webapp/images/coming_soon.jpg b/src/main/webapp/images/coming_soon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ab77aa3a1a2446568a52d2d629ba61a092773ebd GIT binary patch literal 9973 zcma)iby!r*`}bK`x|Wud?(UTC4(V1|y?l;s5~F3jo0D1OPI50ATv@umVH^s9-P{1&oS< zf{KBP_+g==qM~DAV`5@qVq!zE|0W1FE*=CA7n_ifh=`Dol7fPQ^6`HX2n`Jl2OH-R z1oDWS7@wH@KaBt1%0oYZj}GDii6DdU0VI47GCt^G5ST@D2MHMjLiqnb350}>F9~It%_v%83bfd@e#v^ zgy<(275N`U2wV8b5L#Xt9ReC2>lbu<(qU;$vbu!)+Qo1ikJA}XdhjMpj^KZr1%M(# zgdl)03r2YQ*DDZ!|3?iCkB;>VgbwZECiv;h=9!g8XzIfP2aCZ9tmjp^A8j{A>t9}Ln zXb^z|0VKhp0Dx4PGae7r8R{wnp&+Cp>3C^;=>WP7gjkvNWCzN#E*J>WlrA(@I~Jtv zUrI{@0Cc=t+kE=ORdX-^2t^0Nw87|QpgleW!Y3M1i=W6esV@sh7(fRgYycfmSiyuc z@W&sO=!UXqi1_@YkVYSb#7d^63;;Gm1=Ct2uL?*1FaT*VAYBYV>{7G=KqjRy*To^* z?L%1~HGOp61a$F9C_sapnoYK3gpkL~`GxSZ)^@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@KpzPs+K=nvWAi}U6{H;ZlzUQ1)JT{xH^r&3Oqy?thSKY-X^F;(#hb$~ke$1Xb g4sl$-UFf-kI5a?v!r!8o_~y|@Q*c7y$-~nB0r9P(dH?_b literal 0 HcmV?d00001 diff --git a/src/test/java/org/gcube/portlets/user/socialprofile/client/GwtTestSocialProfile.java b/src/test/java/org/gcube/portlets/user/socialprofile/client/GwtTestSocialProfile.java new file mode 100644 index 0000000..5c786a4 --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/socialprofile/client/GwtTestSocialProfile.java @@ -0,0 +1,75 @@ +package org.gcube.portlets.user.socialprofile.client; + +import org.gcube.portlets.user.socialprofile.shared.FieldVerifier; +import com.google.gwt.core.client.GWT; +import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; + +/** + * GWT JUnit integration tests must extend GWTTestCase. + * Using "GwtTest*" naming pattern exclude them from running with + * surefire during the test phase. + * + * If you run the tests using the Maven command line, you will have to + * navigate with your browser to a specific url given by Maven. + * See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html + * for details. + */ +public class GwtTestSocialProfile extends GWTTestCase { + + /** + * Must refer to a valid module that sources this class. + */ + public String getModuleName() { + return "org.gcube.portlets.user.socialprofile.SocialProfileJUnit"; + } + + /** + * Tests the FieldVerifier. + */ + public void testFieldVerifier() { + assertFalse(FieldVerifier.isValidName(null)); + assertFalse(FieldVerifier.isValidName("")); + assertFalse(FieldVerifier.isValidName("a")); + assertFalse(FieldVerifier.isValidName("ab")); + assertFalse(FieldVerifier.isValidName("abc")); + assertTrue(FieldVerifier.isValidName("abcd")); + } + + /** + * This test will send a request to the server using the greetServer method in + * GreetingService and verify the response. + */ + public void testGreetingService() { + // Create the service that we will test. + GreetingServiceAsync greetingService = GWT.create(GreetingService.class); + ServiceDefTarget target = (ServiceDefTarget) greetingService; + target.setServiceEntryPoint(GWT.getModuleBaseURL() + "SocialProfile/greet"); + + // Since RPC calls are asynchronous, we will need to wait for a response + // after this test method returns. This line tells the test runner to wait + // up to 10 seconds before timing out. + delayTestFinish(10000); + + // Send a request to the server. + greetingService.greetServer("GWT User", new AsyncCallback() { + public void onFailure(Throwable caught) { + // The request resulted in an unexpected error. + fail("Request failure: " + caught.getMessage()); + } + + public void onSuccess(String result) { + // Verify that the response is correct. + assertTrue(result.startsWith("Hello, GWT User!")); + + // Now that we have received a response, we need to tell the test runner + // that the test is complete. You must call finishTest() after an + // asynchronous test finishes successfully, or the test will time out. + finishTest(); + } + }); + } + + +} diff --git a/src/test/resources/org/gcube/portlets/user/socialprofile/SocialProfileJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/socialprofile/SocialProfileJUnit.gwt.xml new file mode 100644 index 0000000..17e37a7 --- /dev/null +++ b/src/test/resources/org/gcube/portlets/user/socialprofile/SocialProfileJUnit.gwt.xml @@ -0,0 +1,9 @@ + + + + + + + + +