X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fesr-server.git;a=blobdiff_plain;f=esr-mgr%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fesr%2Futil%2FExtsysUtil.java;h=3bd01772356055e9711705b8518d55f1678b5179;hp=81270536316398b7e59ed5e58475599e233e15e1;hb=ed26992f976741031237ead3a5dc0565d4318b05;hpb=0f4c91c98e9fe5e403c110a85375778b7fad04fb diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java index 8127053..3bd0177 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java @@ -16,54 +16,41 @@ package org.onap.aai.esr.util; import com.google.gson.Gson; - -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; - -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; +import java.util.List; import java.util.UUID; - -import org.onap.aai.esr.entity.aai.AuthInfo; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrSystemInfoList; public class ExtsysUtil { -// private final static Logger logger = LoggerFactory.getLogger(ExtsysUtil.class); - public static String generateId() { - return UUID.randomUUID().toString(); - } + public String generateId() { + return UUID.randomUUID().toString(); + } - public static boolean isNotEmpty(String str) { - return str != null && !"".equals(str) && str.length() > 0; - } + /** + * change object to str. + */ + public String objectToString(Object obj) { + Gson gson = new Gson(); + if (obj != null) { + return gson.toJson(obj); + } else { + return null; + } + } - /** - * change object to str. - */ - public static String objectToString(Object obj) { - Gson gson = new Gson(); - if (obj != null) { - return gson.toJson(obj); - } else { - return null; + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + return esrSystemInfoList; } - } - public static String getNowTime() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - return sdf.format(new Date()); - } - - public static EsrSystemInfoList getEsrSystemInfoList(AuthInfo authInfo) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - ArrayList authInfos = new ArrayList(); - authInfos.add(authInfo); - esrSystemInfo.setEsrSystemInfo(authInfos); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - return esrSystemInfoList; - } + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(List esrSystemInfo) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);; + return esrSystemInfoList; + } }