Utils (social-util-library 1.4.0-4.13.0-169327 API)
Date: 2018-11-28

org.gcube.social_networking.socialutillibrary

## Class Utils

- java.lang.Object
- - org.gcube.social_networking.socialutillibrary.Utils

-     public class Utils
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `IPV4_REGEX` IPv4 regex
    `static String` | `IPV6_REGEX` IPV6 regex needs to be put in square brackets, see below

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Utils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `convertFileNameAnchorHTML(String url)`
    `static String` | `convertHashtagsAnchorHTML(String escapedFeedText, List<String> hashtags)` convert the hashtag in HTML anchor and also Encode the params Base64
    `static String` | `convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<org.gcube.portlets.widgets.pickitem.shared.ItemBean> taggedPeople, javax.servlet.http.HttpServletRequest request)` convert the mentioned people in HTML anchor and also Encode the params Base64
    `static String` | `createDescriptionFromContent(String link)` generate the description parsing the content (Best Guess)
    `static String` | `escapeHtml(String html)` Escape an html string.
    `static String` | `escapeHtmlAndTransformUrl(String html)` Escape an html string.
    `static String` | `extractURL(String feedText)` utility method that extract an url ina text when you paste a link.
    `static ArrayList<org.gcube.portlets.widgets.pickitem.shared.ItemBean>` | `getDisplayableItemBeans(String scope, String currUser, boolean withinPortal)`
    `static List<String>` | `getHashTags(String postText)` utility method that extract the hashtags from a text
    `static String` | `getHttpToken(String originalItem)` check the tokens of a pasted text and see if there's any http link in it
    `static String` | `removeHTMLFromText(String text)` Remove HTML tags from text by using the following '\\<[^>]*>"'
    `static String` | `transformUrls(String feedText)` utility method that convert a url ina text in a clickable url by the browser and if the user has just pasted a link, converts the link in: shared a link

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

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

- - ### Field Detail

    - #### IPV4_REGEX

          public static final String IPV4_REGEX

      IPv4 regex
      See Also:
        Constant Field Values

    - #### IPV6_REGEX

          public static final String IPV6_REGEX

      IPV6 regex needs to be put in square brackets, see below
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Utils

          public Utils()

  - ### Method Detail

    - #### convertFileNameAnchorHTML

          public static String convertFileNameAnchorHTML(String url)

      Parameters:
        `preview` -
      Returns:

    - #### getDisplayableItemBeans

          public static ArrayList<org.gcube.portlets.widgets.pickitem.shared.ItemBean> getDisplayableItemBeans(String scope,
                                                                                                               String currUser,
                                                                                                               boolean withinPortal)

      Parameters:
        `session` - the Asl Session
        `withinPortal` - true when is on Liferay portal
      Returns:
        the users plus the groups belonging to the current organization (scope)

    - #### getHashTags

          public static List<String> getHashTags(String postText)

      utility method that extract the hashtags from a text
      Parameters:
        `postText` -
      Returns:
        the list of hashtags present in the text

    - #### extractURL

          public static String extractURL(String feedText)

      utility method that extract an url ina text when you paste a link. It returns the first (if any) meaningful url among the ones available.
      Parameters:
        `feedText` -
      Returns:
        the text with the clickable url in it

    - #### escapeHtmlAndTransformUrl

          public static String escapeHtmlAndTransformUrl(String html)

      Escape an html string. Escaping data received from the client helps to prevent cross-site script vulnerabilities.
      Parameters:
        `html` - the html string to escape
      Returns:
        the escaped string

    - #### escapeHtml

          public static String escapeHtml(String html)

      Escape an html string. Escaping data received from the client helps to prevent cross-site script vulnerabilities.
      Parameters:
        `html` - the html string to escape
      Returns:
        the escaped string

    - #### transformUrls

          public static String transformUrls(String feedText)

      utility method that convert a url ina text in a clickable url by the browser and if the user has just pasted a link, converts the link in: shared a link
      Parameters:
        `feedText` -
      Returns:
        the text with the clickable url in it

    - #### getHttpToken

          public static String getHttpToken(String originalItem)

      check the tokens of a pasted text and see if there's any http link in it
      Parameters:
        `item` - a text token
      Returns:
        the actual http link

    - #### convertMentionPeopleAnchorHTML

          public static String convertMentionPeopleAnchorHTML(String escapedFeedText,
                                                              ArrayList<org.gcube.portlets.widgets.pickitem.shared.ItemBean> taggedPeople,
                                                              javax.servlet.http.HttpServletRequest request)

      convert the mentioned people in HTML anchor and also Encode the params Base64
      Parameters:
        `escapedFeedText` -
        `taggedPeople` -
      Returns:

    - #### convertHashtagsAnchorHTML

          public static String convertHashtagsAnchorHTML(String escapedFeedText,
                                                         List<String> hashtags)

      convert the hashtag in HTML anchor and also Encode the params Base64
      Parameters:
        `escapedFeedText` -
        `hashtags` -
      Returns:

    - #### createDescriptionFromContent

          public static String createDescriptionFromContent(String link)

      generate the description parsing the content (Best Guess)
      Parameters:
        `link` - the link to check
      Returns:
        the description guessed

    - #### removeHTMLFromText

          public static String removeHTMLFromText(String text)

      Remove HTML tags from text by using the following '\\<[^>]*>"'
      Parameters:
        `text` -
      Returns:
        a String without html tags

Copyright © 2018. All Rights Reserved.