Index: web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java =================================================================== diff -u -r81a625197231c4d1dc3696cba807556fdced2246 -ref6681cf369a1b11e5e1e32530389398880a9e14 --- web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java (.../ArmsScheduler.java) (revision 81a625197231c4d1dc3696cba807556fdced2246) +++ web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java (.../ArmsScheduler.java) (revision ef6681cf369a1b11e5e1e32530389398880a9e14) @@ -13,6 +13,7 @@ import com.atlassian.jira.rest.client.api.JiraRestClient; import com.atlassian.jira.rest.client.api.domain.BasicProject; +import com.atlassian.jira.rest.client.api.domain.Project; import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; import com.atlassian.util.concurrent.Promise; import egovframework.api.arms.module_pdservice.model.PdServiceDTO; @@ -42,12 +43,8 @@ private final Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - @Qualifier("pdServiceJira") - private PdServiceJira pdServiceJira; + public static JiraRestClient getJiraRestClient() throws URISyntaxException, IOException { - public JiraRestClient getJiraRestClient() throws URISyntaxException, IOException { - final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); PropertiesReader propertiesReader = new PropertiesReader("egovframework/egovProps/globals.properties"); @@ -69,47 +66,6 @@ "Fixed delay task - " + System.currentTimeMillis() / 1000); } - @Scheduled(initialDelay = 1000, fixedDelay = 30000) //5m - public void set_jiraProject_toPdServiceJira() throws Exception { - final JiraRestClient restClient = getJiraRestClient(); - Promise> promise = restClient.getProjectClient().getAllProjects(); - Iterable allProject = promise.claim(); - - PdServiceJiraDTO pdServiceJiraDTOList = new PdServiceJiraDTO(); - pdServiceJiraDTOList.setOrder(Order.asc("c_id")); - List list = pdServiceJira.getChildNode(pdServiceJiraDTOList); - - for (BasicProject project: allProject) { - logger.info("project -> " + project.getName()); - logger.info("project -> " + project.getKey()); - logger.info("project -> " + project.getSelf()); - - boolean anyMatch = list.stream().anyMatch(dto -> - StringUtils.equals(dto.getC_jira_link(), project.getSelf().toString()) - ); - - if(anyMatch){ - logger.info("already registerd jira project = " + project.getSelf().toString()); - }else{ - PdServiceJiraDTO pdServiceJiraDTO = new PdServiceJiraDTO(); - pdServiceJiraDTO.setC_title(project.getName()); - pdServiceJiraDTO.setC_jira_id(project.getKey()); - pdServiceJiraDTO.setC_jira_key(project.getKey()); - pdServiceJiraDTO.setC_jira_name(project.getName()); - pdServiceJiraDTO.setC_jira_link(project.getSelf().toString()); - pdServiceJiraDTO.setRef(2L); - pdServiceJiraDTO.setC_type("default"); - - pdServiceJira.addNode(pdServiceJiraDTO); - } - } - } - - public void set_jiraProjectVersion_toPdServiceVersion() { - System.out.println( - "Fixed delay task - " + System.currentTimeMillis() / 1000); - } - public void set_ReqAdd_toJiraReqIssue() { System.out.println( "Fixed delay task - " + System.currentTimeMillis() / 1000); Index: web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraPriority.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraPriority.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraPriority.java (revision ef6681cf369a1b11e5e1e32530389398880a9e14) @@ -0,0 +1,4 @@ +package egovframework.api.arms.module_armsscheduler.component; + +public class ArmsScheduler_JiraPriority { +} Index: web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraProject.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraProject.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraProject.java (revision ef6681cf369a1b11e5e1e32530389398880a9e14) @@ -0,0 +1,72 @@ +package egovframework.api.arms.module_armsscheduler.component; + +import com.atlassian.jira.rest.client.api.JiraRestClient; +import com.atlassian.jira.rest.client.api.domain.BasicProject; +import com.atlassian.jira.rest.client.api.domain.Project; +import egovframework.api.arms.module_pdservicejira.model.PdServiceJiraDTO; +import egovframework.api.arms.module_pdservicejira.service.PdServiceJira; +import egovframework.com.ext.jstree.support.util.StringUtils; +import org.hibernate.criterion.Order; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class ArmsScheduler_JiraProject { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + @Qualifier("pdServiceJira") + private PdServiceJira pdServiceJira; + + @Scheduled(initialDelay = 10 * 60 * 1000, fixedDelay = 5 * 60 * 100) //10m 딜레이, 5m 단위 + public void set_jiraProject_toPdServiceJira() throws Exception { + final JiraRestClient restClient = ArmsScheduler.getJiraRestClient(); + Iterable allProject = restClient.getProjectClient().getAllProjects().claim(); + + PdServiceJiraDTO pdServiceJiraDTOList = new PdServiceJiraDTO(); + pdServiceJiraDTOList.setOrder(Order.asc("c_id")); + List list = pdServiceJira.getChildNode(pdServiceJiraDTOList); + + for (BasicProject project: allProject) { + logger.info("project -> " + project.getName()); + logger.info("project -> " + project.getKey()); + logger.info("project -> " + project.getSelf()); + + boolean anyMatch = list.stream().anyMatch(dto -> + StringUtils.equals(dto.getC_jira_link(), project.getSelf().toString()) + ); + + if(anyMatch){ + logger.info("already registerd jira project = " + project.getSelf().toString()); + }else{ + + String jira_Project_KEY = project.getKey(); + Project projectDetail = restClient.getProjectClient().getProject(jira_Project_KEY).claim(); + + PdServiceJiraDTO pdServiceJiraDTO = new PdServiceJiraDTO(); + pdServiceJiraDTO.setC_title(projectDetail.getName()); + pdServiceJiraDTO.setC_jira_id(projectDetail.getLead().getName()); + pdServiceJiraDTO.setC_jira_key(projectDetail.getKey()); + pdServiceJiraDTO.setC_jira_name(projectDetail.getName()); + pdServiceJiraDTO.setC_jira_link(projectDetail.getSelf().toString()); + pdServiceJiraDTO.setC_contents(projectDetail.getDescription()); + pdServiceJiraDTO.setC_jira_avatar_16(projectDetail.getComponents().toString()); + pdServiceJiraDTO.setC_jira_avatar_24(projectDetail.getIssueTypes().toString()); + pdServiceJiraDTO.setC_jira_avatar_32(projectDetail.getProjectRoles().toString()); + pdServiceJiraDTO.setC_jira_avatar_48(projectDetail.getVersions().toString()); + pdServiceJiraDTO.setRef(2L); + pdServiceJiraDTO.setC_type("default"); + + pdServiceJira.addNode(pdServiceJiraDTO); + } + } + } + +} Index: web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraVersion.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraVersion.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler_JiraVersion.java (revision ef6681cf369a1b11e5e1e32530389398880a9e14) @@ -0,0 +1,131 @@ +package egovframework.api.arms.module_armsscheduler.component; + +import com.atlassian.jira.rest.client.api.JiraRestClient; +import com.atlassian.jira.rest.client.api.domain.Version; +import com.atlassian.jira.rest.client.api.domain.input.VersionInput; +import com.atlassian.util.concurrent.Promise; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; +import egovframework.api.arms.module_pdservice.service.PdService; +import egovframework.api.arms.module_pdserviceconnect.model.PdServiceConnectDTO; +import egovframework.api.arms.module_pdserviceconnect.service.PdServiceConnect; +import egovframework.api.arms.module_pdservicejira.model.PdServiceJiraDTO; +import egovframework.api.arms.module_pdservicejira.service.PdServiceJira; +import egovframework.api.arms.module_pdserviceversion.model.PdServiceVersionDTO; +import egovframework.api.arms.module_pdserviceversion.service.PdServiceVersion; +import egovframework.api.arms.util.StringUtility; +import egovframework.com.cmm.util.string.StringUtil; +import egovframework.com.ext.jstree.support.util.StringUtils; +import org.hibernate.criterion.Order; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.sql.Timestamp; +import java.util.List; + +@Component +public class ArmsScheduler_JiraVersion { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + @Qualifier("pdServiceConnect") + private PdServiceConnect pdServiceConnect; + + @Autowired + @Qualifier("pdServiceJira") + private PdServiceJira pdServiceJira; + + @Autowired + @Qualifier("pdServiceVersion") + private PdServiceVersion pdServiceVersion; + + @Autowired + @Qualifier("pdService") + private PdService pdService; + + @Scheduled(initialDelay = 9 * 60 * 1000, fixedDelay = 3 * 60 * 1000) //9m 딜레이, 3m 단위 + public void set_PdServiceVersion_toJiraProjectVersion() throws Exception { + + final JiraRestClient restClient = ArmsScheduler.getJiraRestClient(); + + PdServiceConnectDTO pdServiceConnectDTOList = new PdServiceConnectDTO(); + pdServiceConnectDTOList.setOrder(Order.asc("c_id")); + List list = pdServiceConnect.getChildNode(pdServiceConnectDTOList); + + for( PdServiceConnectDTO pdServiceConnectDTO : list){ + String pdServiceId = pdServiceConnectDTO.getC_pdservice_id(); + String pdServiceVersionStr = pdServiceConnectDTO.getC_pdservice_version_id(); + String pdServiceJiraList = pdServiceConnectDTO.getC_pdservice_jira_ids(); + + pdServiceJiraList = StringUtils.remove(pdServiceJiraList, "\""); + pdServiceJiraList = StringUtils.remove(pdServiceJiraList, "]"); + pdServiceJiraList = StringUtils.remove(pdServiceJiraList, "["); + + logger.info("pdServiceJiraList => " + pdServiceJiraList); + + //제품(서비스) 정보를 가져온다 + String pdServiceName = ""; + if(StringUtils.isNotEmpty(pdServiceId)){ + + PdServiceDTO pdServiceDTO = new PdServiceDTO(); + pdServiceDTO.setC_id(StringUtility.toLong(pdServiceId)); + PdServiceDTO returnPdServiceDTO = pdService.getNode(pdServiceDTO); + pdServiceName = returnPdServiceDTO.getC_title(); + } + + //버전 정보를 가져온다. + String pdServiceVersionName = ""; + String pdServiceVersionStart = ""; + String pdServiceVersionEnd = ""; + if(StringUtils.isNotEmpty(pdServiceVersionStr)){ + + PdServiceVersionDTO pdServiceVersionDTO = new PdServiceVersionDTO(); + pdServiceVersionDTO.setC_id(StringUtility.toLong(pdServiceVersionStr)); + PdServiceVersionDTO returnPdServiceVersionDTO = pdServiceVersion.getNode(pdServiceVersionDTO); + pdServiceVersionName = returnPdServiceVersionDTO.getC_title(); + pdServiceVersionStart = returnPdServiceVersionDTO.getC_start_date(); + pdServiceVersionEnd = returnPdServiceVersionDTO.getC_end_date(); + } + + //지라 연결 정보가 있다는건 + if(StringUtils.isNotEmpty(pdServiceJiraList)){ + String[] pdServiceJiraArr = StringUtils.split(pdServiceJiraList, ","); + + //지라 연결 정보를 분리해서 + for (String pdServiceJiraID :pdServiceJiraArr) { + PdServiceJiraDTO pdServiceJiraDTO = new PdServiceJiraDTO(); + pdServiceJiraDTO.setC_id(StringUtility.toLong(pdServiceJiraID)); + + //지라 정보를 찾고 + PdServiceJiraDTO returnPdServiceJiraDTO = pdServiceJira.getNode(pdServiceJiraDTO); + + //찾은 정보를 기반으로 지라에 등록한다. + String projectKey = returnPdServiceJiraDTO.getC_jira_key(); + String versionStr = "[a-RMS]_" + StringUtility.deleteWhitespace(pdServiceName) + "_" + StringUtility.deleteWhitespace(pdServiceVersionName); + String description = "[a-RMS] 에서 관리하는 버전 정보 :: " + pdServiceVersionStart + "~" + pdServiceVersionEnd; + //DateTime releaseDate = new DateTime(pdServiceVersionEnd); + DateTime releaseDate = new DateTime("2022-12-31"); + boolean isArchived = false; + boolean isReleased = false; + + VersionInput createVersionTest = new VersionInput(projectKey, versionStr, description, releaseDate, isArchived, isReleased); + Version version = restClient.getVersionRestClient().createVersion(createVersionTest).claim(); + logger.info("version getName = " + version.getName()); + logger.info("version getDescription = " + version.getDescription()); + logger.info("version getId = " + version.getId()); + logger.info("version getReleaseDate = " + version.getReleaseDate()); + logger.info("version getSelf = " + version.getSelf()); + } + } + + } + } + +} Index: web-module/src/main/java/egovframework/api/arms/util/StringUtility.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/util/StringUtility.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/util/StringUtility.java (revision ef6681cf369a1b11e5e1e32530389398880a9e14) @@ -0,0 +1,476 @@ +package egovframework.api.arms.util; + + +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLDecoder; +import java.nio.ByteBuffer; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + + +public class StringUtility extends egovframework.com.ext.jstree.support.util.StringUtils { + + + + public static String nvl(String str, String defaultStr) { + return str == null ? defaultStr : str ; + } + + public static String[] nvl(String[] input) { + if(input == null) { + return new String[0]; + } + return input; + } + + public static String nvl2(String str, String defaultStr) { + return str == null ? defaultStr : (str == (null))?defaultStr: (str == "null") ?defaultStr:(str == "(null)") ?defaultStr:str ; + } + + + + public static String enterToBr(String str) { + str = replaceString(str); + return str == null ? "" : str.replaceAll("\n", "
"); + } + + public static String enterToNull(String str) { + return str == null ? "" : str.replaceAll("\n", ""); + } + + public static String decode (String msg, String type) throws UnsupportedEncodingException { + return URLDecoder.decode (msg, type); + } + + /** + * toString(); + * @param value + * @return + */ + public static String toString(int value) { + try { + return value+""; + } catch (Exception e) { + return ""; + } + } + + public static int toInt(String value) { + try { + return Integer.parseInt(value); + } catch (Exception e) { + return 0; + } + } + + public static long toLong(String value) { + try { + return Long.parseLong(value); + } catch (Exception e) { + return 0; + } + } + + public static String lpad(int value, int length, String prefix) { + try { + StringBuilder sb = new StringBuilder(); + String castValue = value + ""; + + for (int i = castValue.length(); i< length; i++) { + sb.append(prefix); + } + sb.append(castValue); + return sb.toString(); + } catch (Exception e) { + return ""; + } + } + + public static String rpad(int value, int length, String prefix) { + try { + StringBuilder sb = new StringBuilder(); + String castValue = value + ""; + sb.append(castValue); + for (int i = castValue.length(); i< length; i++) { + sb.append(prefix); + } + return sb.toString(); + } catch (Exception e) { + return ""; + } + } + + public static String cutText(String text, int length, String suffix) { + StringBuffer sb = new StringBuffer(); + + if (!text.isEmpty()) { + if (text.length() > length) { + sb.append(text.substring(0, length)).append(suffix); + } else { + sb.append(text); + } + } else { + sb.append(text); + } + return sb.toString(); + } + + //String이 비었거나 null인지 검사 + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + public static String replaceText(String text, String originTxt, String replaceTxt) { + return text.replaceAll(originTxt, replaceTxt); + } + + + public static String replaceBrTag(String text) { + return text.replaceAll("\\n", "
"); + } + + public static String removeAllTag(String txt) { + return txt.replaceAll("(?:)|(?:<(?:[^>'\"]*|\".*?\"|'.*?')+>)",""); + } + + + /** + * get String of java.util.Map keys and values to log + */ + public static String getDatasOfMap(Map map) { + StringBuffer buf = new StringBuffer(); + buf.append("getDatasOfMap() =>"); + Set set = map.keySet(); + Iterator iter = set.iterator(); + while(iter.hasNext()) { + String name = (String)iter.next(); + String value = (String)map.get(name); + buf.append("[").append(name).append("|").append(value).append("]"); + } + return buf.toString(); + } + + + public static boolean isNullCheck(String str) { + boolean bool = false; + + if(str != null && !"".equals(str)) { + bool = true; + } + + return bool; + } + + /** + * 검색 결과 날짜표기 MM/DD + * @param value + * @return + */ + public static String historyDate(String value) { + return !(nvl(value, "").length() == 0) && value.length() == 8 ? value = value.substring(4, 6) + "/" + value.substring(6, 8) : ""; + } + + + /** + * 검색 결과 날짜표기 YYYY.MM.DD + * @param value + * @return + */ + public static String historyDate2(String value) { + return !(nvl(value, "").length() == 0) && value.length() == 8 ? value = value.substring(0, 4) + "." + value.substring(4, 6) + "." + value.substring(6, 8) : ""; + } + /** + * 콤마 추가 + * @param data + * @return + */ + public static String addComma(long data) { + + return new DecimalFormat("#,###").format(data); + } + + /** + * 해당 URL 의 HTML 코드를 String 으로 가져옴 + * @param uri + * @return + */ + public static String getSource(String uri){ + String str=null; + try { + URL url = new URL( uri ); + URLConnection uc = url.openConnection(); + InputStream in = uc.getInputStream(); + int len = uc.getContentLength(); + byte buf[] = new byte[len]; + in.read(buf, 0, buf.length); + str = new String(buf); + } catch (Exception e){ + e.printStackTrace(); + } + return str; + } + /** + * 길이체크 + * @param min + * @param max + * @param str + * @return + */ + public static boolean chkLength (int min, int max, String str) { + int len = str.length (); + return len < min || len > max ; + } + /** + * 연속된 값 체크 + * @param str + * @param cmpCnt + * @return + */ + public static boolean chkSer (String str, int cmpCnt) { + ByteBuffer bf = ByteBuffer.wrap(str.getBytes()); + //연속된 개수 + int serCnt = 1; + //첫번째 문자코드 + int curr = bf.get (); + //에러 여부 + boolean flag = false; + + for (int i = bf.position(), last = bf.capacity(); i < last; i += 1) { + //임시 변수 + int tmp = bf.get(); + //첫번째 문자와 현재 문자의 차이가 1이면 + if ( Math.abs(curr - tmp) == 1 ) { + //연속 카운트 1증가 + serCnt += 1; + } else { + //카운트 리셋 + serCnt = 1; + } + //숫자 변경 + curr = tmp; + //연속횟수가 설정한 값과 같다면 종료 + /*if ( (flag = serCnt == cmpCnt) ) { + break; + }*/ + if ( serCnt == cmpCnt ) { + return flag; + } + } + return flag; + } + /** + * 반복값 체크 + * @param str + * @param cmpCnt + * @return + */ + public static boolean chkRpt (String str, int cmpCnt) { + ByteBuffer bf = ByteBuffer.wrap(str.getBytes()); + //반복된 개수 + int rptCnt = 1; + //첫번째 문자코드 + int curr = bf.get (); + //에러 여부 + boolean flag = false; + + for (int i = bf.position(), last = bf.capacity(); i < last; i += 1) { + //임시 변수 + int tmp = bf.get(); + //첫번째 문자와 현재 문자의 차이가 1이면 + if ( curr == tmp ) { + //연속 카운트 1증가 + rptCnt += 1; + } else { + //카운트 리셋 + rptCnt = 1; + } + //숫자 변경 + curr = tmp; + //연속횟수가 설정한 값과 같다면 종료 + //$ANALYSIS-IGNORE + if ( (flag = rptCnt == cmpCnt) ) { + break; + } + } + return flag; + } + /** + * 지정한 정보가 문자열에 지정한 개수 이상 포함되었는지 체크 + * @param cnt + * @param info + * @param str + * @return + */ + public static boolean chkInfo (int cnt, String info, String str) { + //에러 여부 + boolean flag = false; + + if (null == info) { + return flag; + } else { + for (int i = 0, length = info.length() - cnt + 1; i < length; i += 1) { + //입력값에 정보가 3자리 이상 포함되면 에러 + /*if ( (flag = str.indexOf(info.substring(i, i + cnt)) != -1) ) { + break; + }*/ + if ( str.indexOf(info.substring(i, i + cnt)) != -1 ) { + return flag; + } + } + } + return flag; + } + /** + * 지정한 Byte로 문자열을 자르고 지정한 말줄임 문자를 붙인다. + * @param raw + * @param len + * @param encoding + * @param prefix + * @return + */ + public static String stringByteCut(String raw, int len, String encoding, String prefix) { + if (raw == null) return null; + String[] ary = null; + String result = null; + try { + // raw 의 byte + byte[] rawBytes = raw.getBytes(encoding); + int rawLength = rawBytes.length; + + int index = 0; + int minus_byte_num = 0; + int offset = 0; + + int hangul_byte_num = encoding.equals("UTF-8") ? 3 : 2; + + if(rawLength > len){ + int aryLength = (rawLength / len) + (rawLength % len != 0 ? 1 : 0); + ary = new String[aryLength]; + + for(int i=0; i rawBytes.length){ + offset = rawBytes.length - index; + } + for(int j=0; j 57){ + return false; + } + } + return true; + } + + /** + * 특수문자를 웹 브라우저에서 정상적으로 보이기 위해 특수문자를 처리('<' -> & lT)하는 기능이다 + * @param str + * @return + */ + public static String replaceString(String str) { + String returnValue = ""; + if( str== null ) { + returnValue="" ; + } else { + str = str.replaceAll("&" , "&"); + str = str.replaceAll("<" , "<"); + str = str.replaceAll(">" , ">"); + str = str.replaceAll("\'" , "'"); + str = str.replaceAll("\"" , """); +// str = str.replaceAll("%" , "%"); +// str = str.replaceAll(" " , " "); +// str = str.replaceAll("\r" , " "); +// str = str.replaceAll("\n" , " "); +// str = str.replaceAll("\\(" , "("); +// str = str.replaceAll("\\)" , ")"); +// str = str.replaceAll("#" , "#"); + returnValue = str; + + } + return returnValue ; + } + + public static boolean adminYn(String str){ + return Pattern.matches("^[가-힣]*$", str); + } + + public static String getClientIp(HttpServletRequest request){ + String clientIp = StringUtility.nvl(request.getHeader("X-Forwarded-For"),""); + if(clientIp == null || clientIp.length() == 0){ + clientIp = StringUtility.nvl(request.getHeader("WL-Proxy-Client-IP"),""); + } + if(clientIp == null || clientIp.length() == 0){ + clientIp = StringUtility.nvl(request.getHeader("Proxy-Client-IP"),""); + } + if(clientIp == null || clientIp.length() == 0){ + clientIp = request.getRemoteAddr(); + } + return clientIp.trim(); + } + + public static String commaStr(Long num) { + String commaNum = NumberFormat.getInstance(Locale.US).format(num); + return commaNum; + } + + public static String commaStr(int num) { + String commaNum = NumberFormat.getInstance(Locale.US).format(num); + return commaNum; + } + + public static String nullTrim( String str ) { + if (str == null) { + str = ""; + } else { + str = str.trim(); + } + return str; + } + + +} \ No newline at end of file