ShareUpdateServiceImpl (gCube Share Updates Portlet 1.1.3-3.0.0 API)
Date: 2014-02-26

org.gcube.portlets.user.shareupdates.server

## Class ShareUpdateServiceImpl

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
      - - com.google.gwt.user.server.rpc.RemoteServiceServlet
        - - org.gcube.portlets.user.shareupdates.server.ShareUpdateServiceImpl

- All Implemented Interfaces:
    com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, ShareUpdateService

      public class ShareUpdateServiceImpl
      extends com.google.gwt.user.server.rpc.RemoteServiceServlet
      implements ShareUpdateService

  The server side implementation of the RPC service.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `UPLOAD_DIR`

    - ### Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

      `perThreadRequest, perThreadResponse`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ShareUpdateServiceImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `LinkPreview` | `checkLink(String linkToCheck)` tries the following in the indicated order for Populating the Link preview Open Graph protocol Meta "title" and "description" tags Best guess from page content (not recommended) Schema.org microdata <-- This is still a TODO
    `LinkPreview` | `checkUploadedFile(String fileName, String fileabsolutePathOnServer)` generate a preview of the file, upload the file on the storage and shorts the link
    `void` | `destroy()`
    `String` | `extractURL(String feedText)` utilty method that extract an url ina text
    `protected static String` | `getMimeType(File file, String filenameWithExtension)`
    `ArrayList<org.gcube.portlets.widgets.pickuser.shared.PickingUser>` | `getPortalUsers()`
    `ArrayList<org.gcube.portlets.widgets.pickuser.shared.PickingUser>` | `getSelectedUserIds(ArrayList<String> fullNames)`
    `UserSettings` | `getUserSettings()`
    `void` | `init()` connect to cassandra at startup
    `org.gcube.portal.databook.shared.ClientFeed` | `share(String postText, org.gcube.portal.databook.shared.FeedType feedType, org.gcube.portal.databook.shared.PrivacyLevel pLevel, String vreId, LinkPreview preview, String urlThumbnail, ArrayList<String> mentionedUserFullNames, String fileName, String filePathOnServer)`

    - ### Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet

      `checkPermutationStrongName, doGetSerializationPolicy, getSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processPost, shouldCompressResponse`

    - ### Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

      `doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent`

    - ### Methods inherited from class javax.servlet.http.HttpServlet

      `doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service`

    - ### Methods inherited from class javax.servlet.GenericServlet

      `getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### UPLOAD_DIR

          public static final String UPLOAD_DIR

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ShareUpdateServiceImpl

          public ShareUpdateServiceImpl()

  - ### Method Detail

    - #### init

          public void init()

      connect to cassandra at startup
      Overrides:
        `init` in class `javax.servlet.GenericServlet`

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `javax.servlet.Servlet`
      Overrides:
        `destroy` in class `javax.servlet.GenericServlet`

    - #### share

          public org.gcube.portal.databook.shared.ClientFeed share(String postText,
                                                          org.gcube.portal.databook.shared.FeedType feedType,
                                                          org.gcube.portal.databook.shared.PrivacyLevel pLevel,
                                                          String vreId,
                                                          LinkPreview preview,
                                                          String urlThumbnail,
                                                          ArrayList<String> mentionedUserFullNames,
                                                          String fileName,
                                                          String filePathOnServer)

      Specified by:
        `share` in interface `ShareUpdateService`

    - #### getUserSettings

          public UserSettings getUserSettings()

      Specified by:
        `getUserSettings` in interface `ShareUpdateService`

    - #### checkUploadedFile

          public LinkPreview checkUploadedFile(String fileName,
                                      String fileabsolutePathOnServer)

      generate a preview of the file, upload the file on the storage and shorts the link
      Specified by:
        `checkUploadedFile` in interface `ShareUpdateService`

    - #### getMimeType

          protected static String getMimeType(File file,
                           String filenameWithExtension)
                                       throws IOException

      Parameters:
        `file` -
      Returns:
      Throws:
        `IOException`
        `MagicParseException`
        `MagicMatchNotFoundException`
        `MagicException`

    - #### extractURL

          public String extractURL(String feedText)

      utilty method that extract an url ina text
      Parameters:
        `feedText` -
      Returns:
        the text with the clickable url in it

    - #### checkLink

          public LinkPreview checkLink(String linkToCheck)

      tries the following in the indicated order for Populating the Link preview Open Graph protocol Meta "title" and "description" tags Best guess from page content (not recommended) Schema.org microdata <-- This is still a TODO
      Specified by:
        `checkLink` in interface `ShareUpdateService`

    - #### getSelectedUserIds

          public ArrayList<org.gcube.portlets.widgets.pickuser.shared.PickingUser> getSelectedUserIds(ArrayList<String> fullNames)

      Returns:
        the screennames of the addressee (user logins e.g. pino.pini)

    - #### getPortalUsers

          public ArrayList<org.gcube.portlets.widgets.pickuser.shared.PickingUser> getPortalUsers()

      Specified by:
        `getPortalUsers` in interface `ShareUpdateService`

Copyright © 2014. All Rights Reserved.