Integrate aai-schema-ingest library into aai-core
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / util / AAIUtils.java
  */
 package org.onap.aai.util;
 
-import org.onap.aai.exceptions.AAIException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.TimeZone;
 
-import java.util.regex.Pattern;
+public class AAIUtils {
 
-public class AAIApiVersion {
-       
-       private static final Pattern versionPattern = Pattern.compile("(^|\\/)(v\\d+)\\/");
-       
-       private static final Pattern latestVersionPattern = Pattern.compile("(^|\\/)(latest)\\/");
-       
        /**
-        * Gets the.
+        * Null check.
         *
-        * @return the string
-        * @throws AAIException the AAI exception
+        * @param <T> the generic type
+        * @param iterable the iterable
+        * @return the iterable
         */
-       public static String get() throws AAIException {
-               
-               String apiVersion = null;
-               if (apiVersion == null || !apiVersion.startsWith("v")) {
-                       apiVersion = AAIConfig.get (AAIConstants.AAI_DEFAULT_API_VERSION_PROP, AAIConstants.AAI_DEFAULT_API_VERSION);
-                       //apiVersion = AAIConstants.AAI_DEFAULT_API_VERSION;
-               }
-               return apiVersion;
+       public static <T> Iterable<T> nullCheck(Iterable<T> iterable) {
+               return iterable == null ? Collections.<T>emptyList() : iterable;
        }
+
+       /**
+        * Gen date.
+        *
+        * @return the string
+        */
+       public static String genDate() {
+               Date date = new Date();
+               DateFormat formatter = new SimpleDateFormat("YYMMdd-HH:mm:ss:SSS");
+               formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
+               return formatter.format(date);
+       }       
 }