Sync Integ to Master
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / util / ValidationUtils.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.common.util;
22
23 import com.google.common.base.CharMatcher;
24 import org.apache.commons.lang3.StringEscapeUtils;
25 import org.apache.commons.lang3.StringUtils;
26 import org.apache.commons.lang3.math.NumberUtils;
27 import org.apache.commons.lang3.text.WordUtils;
28 import org.apache.commons.validator.routines.UrlValidator;
29 import org.jsoup.Jsoup;
30 import org.jsoup.helper.StringUtil;
31 import org.jsoup.safety.Whitelist;
32
33 import java.util.Arrays;
34 import java.util.HashSet;
35 import java.util.LinkedHashSet;
36 import java.util.List;
37 import java.util.Set;
38 import java.util.regex.Pattern;
39
40 public class ValidationUtils {
41         public final static Integer COMPONENT_NAME_MAX_LENGTH = 1024;
42         public final static Pattern COMPONENT_NAME_PATTERN = Pattern
43                         .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH-1) + "}$");
44         public final static Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
45         public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
46                         .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
47         public final static Integer RSI_NAME_MAX_LENGTH = 1024;
48         public final static Pattern RSI_NAME_PATTERN = Pattern
49                         .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
50         public final static Integer COMMENT_MAX_LENGTH = 256;
51
52         public final static Integer ICON_MAX_LENGTH = 25;
53         public final static Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
54         public final static Integer PROJECT_CODE_MAX_LEGTH = 50;
55         public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
56
57         // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
58         public final static Integer CONNTACT_ID_MAX_LENGTH = 50;
59 //      public final static Pattern CONTACT_ID_PATTERN = Pattern
60 //                      .compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
61         public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
62         public final static Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
63         public final static Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
64         public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
65
66         public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
67         public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
68         public final static Integer SERVICE_TYPE_MAX_LENGTH = 400;
69         public final static Integer SERVICE_ROLE_MAX_LENGTH = 400;
70
71         public final static Integer TAG_MAX_LENGTH = 1024;
72         public final static Integer TAG_LIST_MAX_LENGTH = 1024;
73         public final static Integer VENDOR_NAME_MAX_LENGTH = 60;
74         public final static Pattern VENDOR_NAME_PATTERN = Pattern
75                         .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
76         public final static Integer VENDOR_RELEASE_MAX_LENGTH = 25;
77         public final static Pattern VENDOR_RELEASE_PATTERN = Pattern
78                         .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
79         public final static Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
80
81         public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
82
83         public final static Pattern DASH_PATTERN = Pattern.compile("[-]+");
84         public final static Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
85         public final static Pattern PLUS_PATTERN = Pattern.compile("[+]+");
86         public final static Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
87         public final static Pattern AMP_PATTERN = Pattern.compile("[&]+");
88         public final static Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
89         public final static Pattern APOST_PATTERN = Pattern.compile("[']+");
90         public final static Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
91         public final static Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
92         public final static Pattern COLON_PATTERN = Pattern.compile("[:]+");
93         public final static Pattern AT_PATTERN = Pattern.compile("[@]+");
94         public final static Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
95         public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<String>(
96                         Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
97
98         public final static Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
99         public final static Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
100         public final static Integer ARTIFACT_LABEL_LENGTH = 255;
101         public final static Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
102         public final static Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
103         public final static Integer CATEGORY_LABEL_MIN_LENGTH = 4;
104         public final static Integer CATEGORY_LABEL_MAX_LENGTH = 25;
105
106         public final static Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
107         public final static Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
108         public final static Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
109         public final static Integer CONSUMER_NAME_MAX_LENGTH = 255;
110         // public final static Pattern CONSUMER_NAME_PATTERN =
111         // Pattern.compile("^[\\w]{1}?[\\w\\.\\-]{0," + CONSUMER_NAME_MAX_LENGTH +
112         // "}?$");
113         public final static Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
114         public final static Integer CONSUMER_SALT_LENGTH = 32;
115         public final static Integer CONSUMER_PASSWORD_LENGTH = 64;
116         public final static Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
117         public final static Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
118         public final static Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
119         public final static Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
120         public final static Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
121
122         public final static Integer ARTIFACT_NAME_LENGTH = 255;
123         public final static Integer API_URL_LENGTH = 100;
124         public final static Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
125
126         public final static Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
127         public final static Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
128         public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
129         public final static Pattern FORWARDING_PATH_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH-1) + "}$");
130         
131         public final static Integer POLICY_MAX_LENGTH = 1024;
132         public final static Pattern POLICY_NAME_PATTERN = Pattern
133                         .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH-1) + "}$");
134
135         public static boolean validateArtifactLabel(String label) {
136                 return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
137         }
138         
139         public static boolean validateArtifactDisplayName(String displayName) {
140                 return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
141         }
142
143         public static boolean validateCategoryDisplayNameFormat(String label) {
144                 boolean res = true;
145                 if (label != null) {
146                         label = label.trim();
147                         res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
148                 }
149                 return res;
150         }
151
152         public static String normalizeCategoryName4Display(String str) {
153                 if (str != null) {
154                         str = str.trim();
155                         str = DASH_PATTERN.matcher(str).replaceAll("-");
156                         str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
157                         str = AMP_PATTERN.matcher(str).replaceAll("&");
158                         str = PLUS_PATTERN.matcher(str).replaceAll("+");
159                         str = DOT_PATTERN.matcher(str).replaceAll(".");
160                         str = APOST_PATTERN.matcher(str).replaceAll("'");
161                         str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
162                         str = EQUAL_PATTERN.matcher(str).replaceAll("=");
163                         str = COLON_PATTERN.matcher(str).replaceAll(":");
164                         str = AT_PATTERN.matcher(str).replaceAll("@");
165                         str = normaliseWhitespace(str);
166                         str = AND_PATTERN.matcher(str).replaceAll(" & ");
167
168                         // Case normalizing
169                         StringBuilder sb = new StringBuilder();
170                         String[] split = str.split(" ");
171                         for (int i = 0; i < split.length; i++) {
172                                 String splitted = split[i];
173                                 String lowerCase = splitted.toLowerCase();
174                                 // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
175                                 // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
176                                 // lowercased because it's first word)
177                                 // Agreed with Ella, 26/11/15
178                                 if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
179                                         sb.append(lowerCase);
180                                 } else {
181                                         sb.append(WordUtils.capitalize(splitted));
182                                 }
183                                 sb.append(" ");
184                         }
185                         str = sb.toString().trim();
186                 }
187                 return str;
188         }
189
190         public static String normalizeCategoryName4Uniqueness(String str) {
191                 return str.toLowerCase();
192         }
193
194         public static boolean validateCategoryDisplayNameLength(String label) {
195                 return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
196                                 && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
197         }
198
199         public static boolean validateProductFullNameLength(String fullName) {
200                 return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
201                                 && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
202         }
203
204         public static boolean validateArtifactLabelLength(String label) {
205                 return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
206         }
207
208         public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
209                 return resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
210         }
211
212         public static boolean validateResourceInstanceName(String resourceInstanceName) {
213                 return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
214         }
215
216         public static boolean validateUrlLength(String url) {
217                 return url.length() <= API_URL_LENGTH;
218         }
219
220         public static boolean validateArtifactNameLength(String artifactName) {
221                 return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
222         }
223
224         public static boolean validateComponentNamePattern(String componentName) {
225                 return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
226         }
227
228         public static boolean validateComponentNameLength(String componentName) {
229                 return componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
230         }
231
232         public static boolean validateIcon(String icon) {
233                 return ICON_PATTERN.matcher(icon).matches();
234         }
235
236         public static boolean validateIconLength(String icon) {
237                 return icon.length() <= ICON_MAX_LENGTH;
238         }
239
240         public static boolean validateProjectCode(String projectCode) {
241                 return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
242         }
243
244         public static boolean validateProjectCodeLegth(String projectCode) {
245                 return projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
246         }
247
248         public static boolean validateContactId(String contactId) {
249                 return CONTACT_ID_PATTERN.matcher(contactId).matches();
250         }
251
252         public static boolean validateCost(String cost) {
253                 return COST_PATTERN.matcher(cost).matches();
254         }
255
256         public static String removeHtmlTags(String str) {
257                 return Jsoup.clean(str, Whitelist.none());
258         }
259
260         public static String removeAllTags(String htmlText) {
261
262                 String stripped = TAGS_PATTERN.matcher(htmlText).replaceAll("").trim();
263                 return stripped;
264         }
265
266         public static String normaliseWhitespace(String str) {
267                 return StringUtil.normaliseWhitespace(str);
268         }
269
270         public static String stripOctets(String str) {
271                 return OCTET_PATTERN.matcher(str).replaceAll("");
272         }
273
274         public static String removeNoneUtf8Chars(String input) {
275                 return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
276         }
277
278         public static boolean validateIsEnglish(String input) {
279                 return ENGLISH_PATTERN.matcher(input).matches();
280         }
281
282         public static boolean validateIsAscii(String input) {
283
284                 boolean isAscii = CharMatcher.ASCII.matchesAllOf(input);
285
286                 return isAscii;
287         }
288
289         public static String convertHtmlTagsToEntities(String input) {
290                 return StringEscapeUtils.escapeHtml4(input);
291         }
292
293         public static List<String> removeDuplicateFromList(List<String> list) {
294                 Set<String> hs = new LinkedHashSet<>(list);
295                 list.clear();
296                 list.addAll(hs);
297                 return list;
298
299         }
300
301         public static boolean validateTagLength(String tag) {
302                 if (tag != null) {
303                         return tag.length() <= TAG_MAX_LENGTH;
304                 }
305                 return false;
306         }
307
308         public static boolean validateTagListLength(int tagListLength) {
309                 return tagListLength <= TAG_LIST_MAX_LENGTH;
310         }
311
312         public static boolean validateDescriptionLength(String description) {
313                 return description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
314         }
315
316         public static boolean validateStringNotEmpty(String value) {
317                 if ((value == null) || (value.isEmpty())) {
318                         return false;
319                 }
320                 return true;
321         }
322
323         public static boolean validateListNotEmpty(List<?> list) {
324                 if ((list == null) || (list.isEmpty())) {
325                         return false;
326                 }
327                 return true;
328         }
329
330         public static boolean validateVendorName(String vendorName) {
331                 return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
332         }
333
334         public static boolean validateVendorNameLength(String vendorName) {
335                 return vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
336         }
337
338         public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
339                 return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
340         }
341         
342         public static boolean validateVendorRelease(String vendorRelease) {
343                 return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
344         }
345
346         public static boolean validateVendorReleaseLength(String vendorRelease) {
347                 return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
348         }
349         
350         public static boolean validateServiceTypeLength(String serviceType) {
351                 return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
352         }
353         
354         public static boolean validateServiceRoleLength(String serviceRole) {
355                 return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
356         }
357
358
359
360         public static boolean hasBeenCertified(String version) {
361                 return NumberUtils.toDouble(version) >= 1;
362         }
363
364         public static String normaliseComponentName(String name) {
365                 String[] split = splitComponentName(name);
366                 StringBuffer sb = new StringBuffer();
367                 for (String splitElement : split) {
368                         sb.append(splitElement);
369                 }
370                 return sb.toString();
371
372         }
373
374         public static String normalizeComponentInstanceName(String name) {
375                 String[] split = splitComponentInstanceName(name);
376                 StringBuffer sb = new StringBuffer();
377                 for (String splitElement : split) {
378                         sb.append(splitElement);
379                 }
380                 return sb.toString();
381
382         }
383
384         private static String[] splitComponentName(String name) {
385                 String normalizedName = name.toLowerCase();
386                 normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
387                 String[] split = normalizedName.split(" ");
388                 return split;
389         }
390
391         private static String[] splitComponentInstanceName(String name) {
392                 String normalizedName = name.toLowerCase();
393                 normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
394                 String[] split = normalizedName.split(" ");
395                 return split;
396         }
397
398         public static String convertToSystemName(String name) {
399                 String[] split = splitComponentName(name);
400                 StringBuffer sb = new StringBuffer();
401                 for (String splitElement : split) {
402                         String capitalize = WordUtils.capitalize(splitElement);
403                         sb.append(capitalize);
404                 }
405                 return sb.toString();
406         }
407
408         public static String normalizeFileName(String filename) {
409                 // String[] split = filename.split(Pattern.quote(File.separator));
410                 // String name = "";
411                 //
412                 // name = split[split.length - 1];
413                 return cleanFileName(filename);
414
415         }
416
417         private static String cleanFileName(String str) {
418                 str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
419                 str = normaliseWhitespace(str);
420                 str = SPACE_PATTERN.matcher(str).replaceAll("-");
421                 str = DASH_PATTERN.matcher(str).replaceAll("-");
422                 str = StringUtils.strip(str, "-_ .");
423
424                 return str;
425         }
426
427         public static boolean validateUrl(String url) {
428
429                 UrlValidator urlValidator = new UrlValidator();
430                 if (!urlValidator.isValid(url)) {
431                         return false;
432                 }
433                 if (NONE_UTF8_PATTERN.matcher(url).find()) {
434                         return false;
435                 }
436
437                 if (URL_INVALIDE_PATTERN.matcher(url).find()) {
438                         return false;
439                 }
440                 return true;
441
442         }
443
444         public static String cleanArtifactDisplayName(String strIn) {
445                 String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
446                 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
447                 str = PLUS_PATTERN.matcher(str).replaceAll("+");
448                 str = normaliseWhitespace(str);
449                 str = str.trim();
450                 // str = str.replaceAll(" ", "");
451
452                 return str;
453         }
454
455         public static String normalizeArtifactLabel(String strIn) {
456
457                 String str = DASH_PATTERN.matcher(strIn).replaceAll("");
458                 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
459                 str = PLUS_PATTERN.matcher(str).replaceAll("");
460                 str = SPACE_PATTERN.matcher(str).replaceAll("");
461                 str = DOT_PATTERN.matcher(str).replaceAll("");
462                 str = str.toLowerCase();
463
464                 return str;
465         }
466
467         public static boolean validateAdditionalInformationKeyName(String str) {
468                 return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
469         }
470
471         public static String normalizeAdditionalInformation(String str) {
472                 if (str != null) {
473                         str = DASH_PATTERN.matcher(str).replaceAll("-");
474                         str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
475                         str = normaliseWhitespace(str);
476                 }
477                 return str;
478         }
479
480         public static boolean validateLength(String str, int length) {
481                 if (str == null) {
482                         return true;
483                 }
484                 return str.length() <= length;
485         }
486
487         public static boolean validateConsumerName(String consumerName) {
488                 return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
489         }
490
491         public static boolean isUTF8Str(String str) {
492                 if (NONE_UTF8_PATTERN.matcher(str).find()) {
493                         return false;
494                 }
495                 return true;
496         }
497
498         public static boolean validateConsumerPassSalt(String consumerSalt) {
499                 return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
500         }
501
502         public static boolean isFloatNumber(String number) {
503                 return FLOAT_PATTERN.matcher(number).matches();
504         }
505
506         public static boolean validateCertifiedVersion(String version) {
507                 return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
508         }
509
510         public static boolean validateMinorVersion(String version) {
511                 return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
512         }
513
514         public static String normaliseProductName(String name) {
515                 String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
516                 StringBuffer sb = new StringBuffer();
517                 for (String splitElement : split) {
518                         sb.append(splitElement);
519                 }
520                 return sb.toString();
521
522         }
523
524         private static String[] splitComponentName(Pattern pattern, String name) {
525                 String normalizedName = name.toLowerCase();
526                 normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
527                 String[] split = normalizedName.split(" ");
528                 return split;
529         }
530
531         public static String removeHtmlTagsOnly(String htmlText) {
532                 String stripped = HtmlCleaner.stripHtml(htmlText, false);
533                 return stripped;
534         }
535
536         public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
537                 return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();
538         }
539 }