removed the set deprecated methods as they should not be

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@178469 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2019-03-04 16:44:38 +00:00
parent 1bd21cd2d8
commit 2d2913aea7
1 changed files with 24 additions and 16 deletions

View File

@ -39,25 +39,25 @@ public class Utils {
/** /**
* Hashtag regex enhanced for ticket #4937 * Hashtag regex enhanced for ticket #4937
*/ */
@Deprecated
private static final String HASHTAG_REGEX = "^#\\w+([-_.]?\\w+)*|\\s#\\w+([-_.]?\\w+)*|(?<=[\\[({])#\\w+([-_.]?\\w+)"; private static final String HASHTAG_REGEX = "^#\\w+([-_.]?\\w+)*|\\s#\\w+([-_.]?\\w+)*|(?<=[\\[({])#\\w+([-_.]?\\w+)";
/** /**
* IPv4 regex * IPv4 regex
*/ */
@Deprecated
public static final String IPV4_REGEX = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"; public static final String IPV4_REGEX = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
/** /**
* IPV6 regex needs to be put in square brackets, see below * IPV6 regex needs to be put in square brackets, see below
*/ */
@Deprecated
public static final String IPV6_REGEX = "\\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\\b"; public static final String IPV6_REGEX = "\\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\\b";
/** /**
* Pattern for URLS * Pattern for URLS
*/ */
@Deprecated
private static final Pattern URL_PATTERN = Pattern.compile( private static final Pattern URL_PATTERN = Pattern.compile(
"\\b(((ht|f)tp(s?)\\:\\/\\/|~\\/|\\/)|www.)" + "\\b(((ht|f)tp(s?)\\:\\/\\/|~\\/|\\/)|www.)" +
"(\\w+:\\w+@)?((([-\\w]+\\.)+(com|org|net|gov" + "(\\w+:\\w+@)?((([-\\w]+\\.)+(com|org|net|gov" +
@ -161,7 +161,7 @@ public class Utils {
* @param postText * @param postText
* @return the list of hashtags present in the text * @return the list of hashtags present in the text
*/ */
@Deprecated
public static List<String> getHashTags(String postText) { public static List<String> getHashTags(String postText) {
List<String> hashtags = new ArrayList<>(); List<String> hashtags = new ArrayList<>();
Pattern MY_PATTERN = Pattern.compile(HASHTAG_REGEX);//Pattern.compile("^#\\w+|\\s#\\w+"); Pattern MY_PATTERN = Pattern.compile(HASHTAG_REGEX);//Pattern.compile("^#\\w+|\\s#\\w+");
@ -178,7 +178,7 @@ public class Utils {
* @param feedText * @param feedText
* @return the text with the clickable url in it * @return the text with the clickable url in it
*/ */
@Deprecated
public static String extractURL(String feedText) { public static String extractURL(String feedText) {
// separate input by spaces ( URLs have no spaces ) // separate input by spaces ( URLs have no spaces )
feedText = feedText.replaceAll("(\r\n|\n)"," <br/> "); feedText = feedText.replaceAll("(\r\n|\n)"," <br/> ");
@ -207,7 +207,7 @@ public class Utils {
* @param html the html string to escape * @param html the html string to escape
* @return the escaped string * @return the escaped string
*/ */
@Deprecated
public static String escapeHtmlAndTransformUrl(String html) { public static String escapeHtmlAndTransformUrl(String html) {
if (html == null) { if (html == null) {
return null; return null;
@ -230,7 +230,7 @@ public class Utils {
* @param html the html string to escape * @param html the html string to escape
* @return the escaped string * @return the escaped string
*/ */
@Deprecated
public static String escapeHtml(String html) { public static String escapeHtml(String html) {
return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;") return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
.replaceAll(">", "&gt;"); .replaceAll(">", "&gt;");
@ -242,7 +242,7 @@ public class Utils {
* @param feedText * @param feedText
* @return the text with the clickable url in it * @return the text with the clickable url in it
*/ */
@Deprecated
public static String transformUrls(String feedText) { public static String transformUrls(String feedText) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
// separate input by spaces ( URLs have no spaces ) // separate input by spaces ( URLs have no spaces )
@ -276,7 +276,7 @@ public class Utils {
* @param item a text token * @param item a text token
* @return the actual http link * @return the actual http link
*/ */
@Deprecated
public static String getHttpToken(String originalItem) { public static String getHttpToken(String originalItem) {
// apply pattern // apply pattern
String item = null; String item = null;
@ -304,15 +304,19 @@ public class Utils {
* @param taggedPeople * @param taggedPeople
* @return * @return
*/ */
@Deprecated
public static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<ItemBean> taggedPeople, HttpServletRequest request) { public static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<ItemBean> taggedPeople, HttpServletRequest request) {
String pageToRedirectURL = ""; String pageToRedirectURL = "";
String httpGETAttrName = ""; String httpGETAttrName = "";
String httpGETAttrValue =""; String httpGETAttrValue ="";
PortalContext pContext = PortalContext.getConfiguration();
String gatewayURL = pContext.getGatewayURL(request);
for (ItemBean tagged : taggedPeople) { for (ItemBean tagged : taggedPeople) {
if (! tagged.isItemGroup()) { if (! tagged.isItemGroup()) {
pageToRedirectURL = PortalContext.getConfiguration().getSiteLandingPagePath(request)+GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; StringBuilder sb = new StringBuilder(gatewayURL)
.append(pContext.getSiteLandingPagePath(request))
.append(GCubePortalConstants.USER_PROFILE_FRIENDLY_URL);
pageToRedirectURL = sb.toString();
httpGETAttrName = GCubeSocialNetworking.USER_PROFILE_OID; httpGETAttrName = GCubeSocialNetworking.USER_PROFILE_OID;
httpGETAttrValue = tagged.getName(); httpGETAttrValue = tagged.getName();
} else { } else {
@ -322,7 +326,11 @@ public class Utils {
//returns the VRE url e.g. /devVRE //returns the VRE url e.g. /devVRE
String vreURL = new LiferayGroupManager().getGroup(theTeam.getGroupId()).getFriendlyURL(); String vreURL = new LiferayGroupManager().getGroup(theTeam.getGroupId()).getFriendlyURL();
//append the members url //append the members url
pageToRedirectURL= GCubePortalConstants.PREFIX_GROUP_URL + vreURL + GCubePortalConstants.GROUP_MEMBERS_FRIENDLY_URL; StringBuilder sb = new StringBuilder(gatewayURL)
.append(GCubePortalConstants.PREFIX_GROUP_URL)
.append(vreURL)
.append(GCubePortalConstants.GROUP_MEMBERS_FRIENDLY_URL);
pageToRedirectURL= sb.toString();
httpGETAttrName = GCubeSocialNetworking.GROUP_MEMBERS_OID; httpGETAttrName = GCubeSocialNetworking.GROUP_MEMBERS_OID;
httpGETAttrValue = tagged.getId(); httpGETAttrValue = tagged.getId();
} catch (Exception e) { } catch (Exception e) {
@ -344,7 +352,7 @@ public class Utils {
* @param hashtags * @param hashtags
* @return * @return
*/ */
@Deprecated
public static String convertHashtagsAnchorHTML(String escapedFeedText, List<String> hashtags) { public static String convertHashtagsAnchorHTML(String escapedFeedText, List<String> hashtags) {
for (String hashtag : hashtags) { for (String hashtag : hashtags) {
String taggedHTML = "<a class=\"link\" style=\"font-size:14px;\" href=\"?"+ String taggedHTML = "<a class=\"link\" style=\"font-size:14px;\" href=\"?"+
@ -380,7 +388,7 @@ public class Utils {
* @param text * @param text
* @return a String without html tags * @return a String without html tags
*/ */
@Deprecated
public static String removeHTMLFromText(String text){ public static String removeHTMLFromText(String text){
if(text == null) if(text == null)