package nlib.util; import egovframework.com.utl.fcc.service.EgovFormBasedUUID; /** *
* @Class Name : UUID.java * * @Description : UUID를 생성한다. * * * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021) * ** * @ ------------ -------- --------------------------- * @ 수정일 수정자 수정내용 * @ ------------ -------- --------------------------- * @ 2021. 7. 13. KNKIM 최초 생성 * * * @author 이씨플라자 * DIGITALSHIP KNKIM * @since 2021. 7. 13. * @version 1.0 * */ public class UUID { /** * 새로운 UUID를 생성하여 리턴한다. * * @return */ public static String getNewUUID() { return EgovFormBasedUUID.randomUUID().toString(); } public static String getNewUUIDWithAlphaNum() { return getNewUUID().toUpperCase().replaceAll("-", ""); } public static String getNlibCommonID(String prefix, int length) { String articleID = getNewUUIDWithAlphaNum(); if(StringUtil.isNotEmpty(prefix)) articleID = prefix + "-" + articleID; if(length > 0 && length < articleID.length()) return articleID.substring(0, length); return articleID; } public static String getNewAttachFileId() { //return StringUtil.getTimeStamp("yyyyMMddhhmmss") + getNewUUIDWithAlphaNum(); return getNlibCommonID("AT", 35); } public static String getNewStreFileNm() { // NQ202109300311510712 return "NQ" + StringUtil.getTimeStamp() + getNlibCommonID(null, 5); } public static String getNewFileId() { // CF-DEA398CA0D0E45BF80077AB3872D5BE7 return getNlibCommonID("CF", 35); } /** * 파일용 UUID로 생성한 파일명을 리턴한다. * * @return */ public static String getPhysicalFileName() { return "F" + StringUtil.getTimeStamp() + "_" + getNewUUID().replaceAll("-", "").toUpperCase(); } }