Remove Code from cadi, it is now in authz
[aaf/cadi.git] / core / src / main / java / org / onap / aaf / cadi / util / Vars.java
diff --git a/core/src/main/java/org/onap/aaf/cadi/util/Vars.java b/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
deleted file mode 100644 (file)
index af8cf86..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.util;\r
-\r
-import java.util.List;\r
-\r
-public class Vars {\r
-       /**\r
-        * Simplified Conversion based on typical use of getting AT&T style RESTful Error Messages\r
-        * @param text\r
-        * @param vars\r
-        * @return\r
-        */\r
-       public static String convert(final String text, final List<String> vars) {\r
-               String[] array = new String[vars.size()];\r
-               StringBuilder sb = new StringBuilder();\r
-               convert(sb,text,vars.toArray(array));\r
-               return sb.toString();\r
-       }\r
-       /**\r
-        * Convert a format string with "%s" into AT&T RESTful Error %1 %2 (number) format\r
-        * If "holder" is passed in, it is built with full Message extracted (typically for Logging)\r
-        * @param holder\r
-        * @param text\r
-        * @param vars\r
-        * @return\r
-        */\r
-       public static String convert(final StringBuilder holder, final String text, final String ... vars) {\r
-               StringBuilder sb = null;\r
-               int idx,index=0,prev = 0;\r
-               \r
-               if(text.contains("%s")) {\r
-                       sb = new StringBuilder();\r
-               }\r
-               \r
-               StringBuilder[] sbs = new StringBuilder[] {sb,holder};\r
-               boolean replace, clearIndex = false;\r
-               int c;\r
-               while((idx=text.indexOf('%',prev))>=0) {\r
-                       replace = false;\r
-                       if(clearIndex) {\r
-                               index=0;\r
-                       }\r
-                       if(sb!=null) {\r
-                               sb.append(text,prev,idx);\r
-                       }\r
-                       if(holder!=null) {\r
-                               holder.append(text,prev,idx);\r
-                       }\r
-                       \r
-                       boolean go = true;\r
-                       while(go) {\r
-                               if(text.length()>++idx) {\r
-                                       switch(c=text.charAt(idx)) {\r
-                                               case '0': case '1': case '2': case '3': case '4': \r
-                                               case '5': case '6': case '7': case '8': case '9':\r
-                                                       index *=10;\r
-                                                       index +=(c-'0');\r
-                                                       clearIndex=replace=true;\r
-                                                       continue;\r
-                                               case 's':\r
-                                                       ++index;\r
-                                                       replace = true;\r
-                                                       continue;\r
-                                               default:\r
-                                                       break;\r
-                                       }\r
-                               }\r
-                               prev = idx;\r
-                               go=false;\r
-                               if(replace) {\r
-                                       if(sb!=null) {\r
-                                               sb.append('%');\r
-                                               sb.append(index);\r
-                                       }\r
-                                       if(index<=vars.length) {\r
-                                               if(holder!=null) {\r
-                                                       holder.append(vars[index-1]);\r
-                                               }\r
-                                       }\r
-                               } else {\r
-                                       for(StringBuilder s : sbs) {\r
-                                               if(s!=null) {\r
-                                                       s.append("%");\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               if(sb!=null) {\r
-                       sb.append(text,prev,text.length());\r
-               }\r
-               if(holder!=null) {\r
-                       holder.append(text,prev,text.length());\r
-               }\r
-\r
-               return sb==null?text:sb.toString();\r
-       }\r
-\r
-}\r