From 7f535078ef80a7b7efa3e3325bfccb994fbd00e8 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 31 Aug 2017 15:16:38 -0400 Subject: Rename packages to org.onap in 1.4.0-SNAPSHOT 19 - remove openecomp 72 - remediate Sonar scan issues 79 - removed unwanted left menu under Report 90 - apply approved license text Issue: PORTAL-19, PORTAL-72, PORTAL-79, PORTAL-90 Change-Id: I41a0ef5fba623d2242574bd15f2d9fb8029a496c Signed-off-by: Christopher Lott (cl778h) --- .../portalsdk/analytics/util/HtmlStripper.java | 157 --------------------- 1 file changed, 157 deletions(-) delete mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java') diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java deleted file mode 100644 index 946eb242..00000000 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java +++ /dev/null @@ -1,157 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.util; - -import java.io.*; - -import org.openecomp.portalsdk.analytics.RaptorObject; - -public class HtmlStripper extends RaptorObject// this function can be accessed publicly -{ - - String filename; - final char TXT_END_TAG = '>'; - final char TXT_START_TAG = '<'; - - public String stripSpecialCharacters (String s) { - s = nvl(s); - StringBuffer sbuf = new StringBuffer(); - int c; - int prev_char = 0; - boolean inText = true; - for (int i = 0; i < s.length(); i++) { - // while c is not last character - c = s.charAt(i); - //System.out.println("444 Character " + (char)c + " int " + c); - if ((char) c == TXT_END_TAG) { - // if char == '>' text following - // it and not HTML tag - inText = true; - } else if ((char) c == TXT_START_TAG) { - // if char == '<' tag is - // following not text - inText = false; - } /*else if ((char)c == '\n') { - System.out.println("new line " + (char)c + " int " + c); - inText = false; - }*/ /*else if ((char) c == '&') { - // if char == '&' chars following - // are not text - inText = false; - }*/ - else if (inText) { - // if text write char to "text.txt" - //System.out.println("444444 Adding " + (char)c + " int " + c); - if (c >= 32 && c <= 122) { - if(c==32 || (c>32 && c<=47) || ( c>=58 && c<=64 )) { - if (c == 45) { - prev_char = 0; - sbuf.append((char) 45); - } - else if(prev_char != 95) { - prev_char = 95; - sbuf.append((char) 95); - } - } - else { - prev_char=0; - sbuf.append((char) c); - } - } - } - } - //System.out.println("\n\nFinished processing: " + s + "\n\n"); - //System.out.println("\n\nThe processed String : " + sbuf.toString() + "\n\n"); - return sbuf.toString(); - } - - public String stripHtml(String s) { - - //System.out.println("Starting to process: " + s + "\n\n"); // prints - s = nvl(s); - StringBuffer sbuf = new StringBuffer(); - int c; - boolean inText = true; - for (int i = 0; i < s.length(); i++) { - // while c is not last character - c = s.charAt(i); - if ((char) c == TXT_END_TAG) { - // if char == '>' text following - // it and not HTML tag - inText = true; - } else if ((char) c == TXT_START_TAG) { - // if char == '<' tag is - // following not text - inText = false; - } /*else if ((char)c == '\n') { - System.out.println("new line " + (char)c + " int " + c); - inText = false; - }*/ /*else if ((char) c == '&') { - // if char == '&' chars following - // are not text - inText = false; - }*/ - else if (inText) { - // if text write char to "text.txt" - if (c >= 32 && c <= 122) { - sbuf.append((char) c); - } - } - } - //System.out.println("\n\nFinished processing: " + s + "\n\n"); - //System.out.println("\n\nThe processed String : " + sbuf.toString() + "\n\n"); - int pos = 0 ; - while(sbuf.indexOf(" ")!=-1) { - pos = sbuf.indexOf(" "); - sbuf.replace(pos, pos+6, " "); - } - - return sbuf.toString(); - } - - - public String stripCSVHtml (String s) { - String s1 = stripHtml(s); - //s1 = Utils.replaceInString(s1, "\"", "\"\""); - s1 = s1.replaceAll("\"", "\"\""); - return s1; - } - - public static void main(String[] args) { - - String st = " Import: report name hello $ # " ; - System.out.println("hello " + new HtmlStripper().stripSpecialCharacters(st)); - StringBuffer strBuf = new StringBuffer(""); - strBuf.append("\n\n"); - strBuf.append(" \n"); - strBuf.append("\n"); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append(""); - strBuf.append("
Charge To Account ABBZ2
dateMonth 04/30/2008
Generated Date/Time 05/30/2008 06:15:16 PM GMT
Login Id: sundar
"); - new HtmlStripper().stripHtml(strBuf.toString()); - } -} -- cgit 1.2.3-korg