Merge branch 'master' of http://docs.nculture.org:30000/nculture/iams.nlib
This commit is contained in:
commit
b30483f9cf
@ -1,7 +1,7 @@
|
|||||||
package nlib.cmm;
|
package nlib.cmm;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -24,7 +24,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import nlib.cmm.exception.ErrorMessage;
|
import nlib.cmm.exception.ErrorMessage;
|
||||||
import nlib.cmm.service.NlibProperty;
|
|
||||||
import nlib.restful.service.DataApiResVO;
|
import nlib.restful.service.DataApiResVO;
|
||||||
import nlib.security.SecUserVO;
|
import nlib.security.SecUserVO;
|
||||||
import nlib.user.service.LoginService;
|
import nlib.user.service.LoginService;
|
||||||
@ -140,9 +139,12 @@ public class NlibCommonController {
|
|||||||
setter.invoke(loginVO, getter.invoke(newLoginVO));
|
setter.invoke(loginVO, getter.invoke(newLoginVO));
|
||||||
//log.debug("replaceNlibLoginVO > Method invoke : " + setterName + " : " + oldValue + " -> " + newValue);
|
//log.debug("replaceNlibLoginVO > Method invoke : " + setterName + " : " + oldValue + " -> " + newValue);
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(IllegalAccessException e) {
|
||||||
log.error("replaceNlibLoginVO > Method invoke error : " + setterName + ", " + getterName);
|
log.error("replaceNlibLoginVO > Method invoke IllegalAccessException : " + setterName + ", " + getterName);
|
||||||
e.printStackTrace();
|
} catch(IllegalArgumentException e) {
|
||||||
|
log.error("replaceNlibLoginVO > Method invoke IllegalArgumentException : " + setterName + ", " + getterName);
|
||||||
|
} catch(InvocationTargetException e) {
|
||||||
|
log.error("replaceNlibLoginVO > Method invoke InvocationTargetException : " + setterName + ", " + getterName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +199,9 @@ public class NlibCommonController {
|
|||||||
log.debug("RETURN DATA > json:" + jsonStr);
|
log.debug("RETURN DATA > json:" + jsonStr);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
||||||
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {}
|
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {
|
||||||
e.printStackTrace();
|
log.error("makeResponseEntityJson > JsonProcessingException내부 JsonProcessingException : " + ee.toString());
|
||||||
|
}
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +223,9 @@ public class NlibCommonController {
|
|||||||
log.debug("RETURN DATA > json:" + jsonStr);
|
log.debug("RETURN DATA > json:" + jsonStr);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
||||||
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {}
|
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {
|
||||||
e.printStackTrace();
|
log.error("makeResponseEntityJson > JsonProcessingException내부 JsonProcessingException : " + ee.toString());
|
||||||
|
}
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,8 +246,9 @@ public class NlibCommonController {
|
|||||||
log.debug("RETURN DATA > json:" + jsonStr);
|
log.debug("RETURN DATA > json:" + jsonStr);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
ErrorMessage eMsg = new ErrorMessage("ERR_JSON_CONVERT", "응답객체를 JSON으로 변환 처리 중 오류가 발생하였습니다. : " + e.toString());
|
||||||
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {}
|
try { jsonStr = mapper.writeValueAsString(eMsg); } catch (JsonProcessingException ee) {
|
||||||
e.printStackTrace();
|
log.error("makeResponseEntityJson > JsonProcessingException내부 JsonProcessingException : " + ee.toString());
|
||||||
|
}
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(headers).body(jsonStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package nlib.cmm.service;
|
package nlib.cmm.service;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@ -54,8 +55,6 @@ public class NlibProperty {
|
|||||||
String nlibPropPath = null;
|
String nlibPropPath = null;
|
||||||
int propCount = -1;
|
int propCount = -1;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if(properties == null) properties = new Properties();
|
if(properties == null) properties = new Properties();
|
||||||
else properties.clear();
|
else properties.clear();
|
||||||
|
|
||||||
@ -80,17 +79,13 @@ public class NlibProperty {
|
|||||||
|
|
||||||
propCount = properties.size();
|
propCount = properties.size();
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (FileNotFoundException ex) { // FileNotFoundException
|
||||||
if(properties != null) properties.clear();
|
if(properties != null) properties.clear();
|
||||||
log.error("Error in Loading NLIB Properties : " + nlibPropPath);
|
log.error("Error in Loading NLIB Properties FileNotFoundException : " + nlibPropPath);
|
||||||
ex.printStackTrace();
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
} catch (IOException ex) { // FileNotFoundException
|
||||||
|
|
||||||
} catch(Exception e) {
|
|
||||||
if(properties != null) properties.clear();
|
if(properties != null) properties.clear();
|
||||||
log.error("Error in Solving NLIB Properties Path : " + nlibPropPath);
|
log.error("Error in Loading NLIB Properties : IOException " + nlibPropPath);
|
||||||
e.printStackTrace();
|
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,11 +139,13 @@ public class NlibProperty {
|
|||||||
public static int getInt(String name, int defaultValue) {
|
public static int getInt(String name, int defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getInt(name);
|
return getInt(name);
|
||||||
|
} catch(NumberFormatException e) {
|
||||||
|
log.error("[속성값 읽기 오류] NumberFormatException : " + e.toString());
|
||||||
|
return defaultValue;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("[속성값 읽기 오류] " + e.toString());
|
log.error("[속성값 읽기 오류] 기타 오류 " + e.toString());
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class PagingVO {
|
|||||||
public void setPageIndex(String sPageIndex) {
|
public void setPageIndex(String sPageIndex) {
|
||||||
try {
|
try {
|
||||||
pageIndex = Integer.parseInt(sPageIndex);
|
pageIndex = Integer.parseInt(sPageIndex);
|
||||||
} catch(Exception e) {
|
} catch(NumberFormatException e) {
|
||||||
pageIndex = 1;
|
pageIndex = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class PagingVO {
|
|||||||
public void setPageSize(String sPageSize) {
|
public void setPageSize(String sPageSize) {
|
||||||
try {
|
try {
|
||||||
pageSize = Integer.parseInt(sPageSize);
|
pageSize = Integer.parseInt(sPageSize);
|
||||||
} catch(Exception e) {
|
} catch(NumberFormatException e) {
|
||||||
pageSize = NlibProperty.getInt("list.paging.page.size", 10);
|
pageSize = NlibProperty.getInt("list.paging.page.size", 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,7 +194,7 @@ public class MainController extends NlibCommonController {
|
|||||||
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
||||||
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
||||||
exists = true;
|
exists = true;
|
||||||
} catch(Exception e) {
|
} catch(IOException e) {
|
||||||
log.error("메인 화면 배너 관련 파일을 확인할 수 없습니다. : bannerId=" + bannerId);
|
log.error("메인 화면 배너 관련 파일을 확인할 수 없습니다. : bannerId=" + bannerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ public class MainController extends NlibCommonController {
|
|||||||
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
response.setContentType(mimetypesFileTypeMap.getContentType(bannerInfo.get("orignlFileNm")));
|
||||||
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
response.getOutputStream().write(Files.readAllBytes(Paths.get(fileName)));
|
||||||
exists = true;
|
exists = true;
|
||||||
} catch(Exception e) {
|
} catch(IOException e) {
|
||||||
log.error("메인 화면 배너 기본 배너 파일을 확인할 수 없습니다. : main.banner.img.path=" + NlibProperty.getString("main.banner.img.path"));
|
log.error("메인 화면 배너 기본 배너 파일을 확인할 수 없습니다. : main.banner.img.path=" + NlibProperty.getString("main.banner.img.path"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,9 +37,9 @@ public class XmlConverter {
|
|||||||
resMap = getElementValue(rootEleName, eventReader, null);
|
resMap = getElementValue(rootEleName, eventReader, null);
|
||||||
//log.debug("Converting XML to HashMap : Done >> " + resMap);
|
//log.debug("Converting XML to HashMap : Done >> " + resMap);
|
||||||
} catch (XMLStreamException e) {
|
} catch (XMLStreamException e) {
|
||||||
e.printStackTrace();
|
log.error("convert XMLStreamException : " + e.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("convert Error : " + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return resMap;
|
return resMap;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package nlib.util;
|
package nlib.util;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@ -126,7 +128,7 @@ public class StringUtil extends StringUtils {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(str.trim());
|
return Integer.parseInt(str.trim());
|
||||||
} catch(Exception e) {}
|
} catch(NumberFormatException e) { log.error("toNumber NumberFormatException : " + e.toString()); }
|
||||||
|
|
||||||
return defaultInt;
|
return defaultInt;
|
||||||
}
|
}
|
||||||
@ -169,8 +171,8 @@ public class StringUtil extends StringUtils {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
encodedStr = URLEncoder.encode(str, "UTF-8");
|
encodedStr = URLEncoder.encode(str, "UTF-8");
|
||||||
} catch(Exception e) {
|
} catch(UnsupportedEncodingException e) {
|
||||||
log.error("encodeUrl > Error while encoding for [" + str + "] " + e.toString());
|
log.error("encodeUrl > UnsupportedEncodingException while encoding for [" + str + "] " + e.toString());
|
||||||
encodedStr = str;
|
encodedStr = str;
|
||||||
}
|
}
|
||||||
return encodedStr;
|
return encodedStr;
|
||||||
@ -189,8 +191,8 @@ public class StringUtil extends StringUtils {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
decodedStr = URLDecoder.decode(str, "UTF-8");
|
decodedStr = URLDecoder.decode(str, "UTF-8");
|
||||||
} catch(Exception e) {
|
} catch(UnsupportedEncodingException e) {
|
||||||
log.error("encodeUrl > Error while encoding for [" + str + "] " + e.toString());
|
log.error("encodeUrl > UnsupportedEncodingException while encoding for [" + str + "] " + e.toString());
|
||||||
decodedStr = str;
|
decodedStr = str;
|
||||||
}
|
}
|
||||||
return decodedStr;
|
return decodedStr;
|
||||||
@ -241,8 +243,8 @@ public class StringUtil extends StringUtils {
|
|||||||
final URL urlObj = new URL(url);
|
final URL urlObj = new URL(url);
|
||||||
hostName = urlObj.getHost();
|
hostName = urlObj.getHost();
|
||||||
if(isEmpty(hostName)) return "";
|
if(isEmpty(hostName)) return "";
|
||||||
} catch(Exception e) {
|
} catch(MalformedURLException e) {
|
||||||
log.error("[ERROR] getHostName(..) : " + e.toString());
|
log.error("[ERROR] getHostName(..) : MalformedURLException " + e.toString());
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if("|localhost|nlib.nculture.org|nlib-dev.nculture.org|".contains(hostName)) hostName = "nlib";
|
if("|localhost|nlib.nculture.org|nlib-dev.nculture.org|".contains(hostName)) hostName = "nlib";
|
||||||
@ -291,51 +293,48 @@ public class StringUtil extends StringUtils {
|
|||||||
return defaultStr;
|
return defaultStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** * 이메일 masking 후 리턴<br> * 변환 실패시 입력값 그대로 리턴<br> * 이메일 아이디 앞 2자리 노출<br> */
|
/**
|
||||||
|
* 이메일 masking 후 리턴
|
||||||
|
*/
|
||||||
public static String maskEmail(String email) {
|
public static String maskEmail(String email) {
|
||||||
try{
|
|
||||||
if (StringUtils.isEmpty(email) || !email.contains("@")) {
|
if (StringUtils.isEmpty(email) || !email.contains("@")) {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] emailSplited = email.split("@");
|
String[] emailSplited = email.split("@");
|
||||||
if (emailSplited.length != 2) {
|
if (emailSplited.length != 2) {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
if(emailSplited[0].length() > 2){
|
|
||||||
|
if (!StringUtils.isEmpty(emailSplited[0]) && emailSplited[0].length() > 2) {
|
||||||
String str = "";
|
String str = "";
|
||||||
for(int i=2;emailSplited[0].length()>i;i++)
|
for (int i = 2; i < emailSplited[0].length(); i++) {
|
||||||
{
|
|
||||||
str += "*";
|
str += "*";
|
||||||
}
|
}
|
||||||
return email.substring(0, 2) + str + "@" + emailSplited[1];
|
return email.substring(0, 2) + str + "@" + emailSplited[1];
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e){
|
|
||||||
} return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** * 이름 masking 후 리턴<br> * 변환 실패시 입력값 그대로 리턴<br>*/
|
/** * 이름 masking 후 리턴<br> * 변환 실패시 입력값 그대로 리턴<br>*/
|
||||||
public static String maskName(String name) {
|
public static String maskName(String name) {
|
||||||
try{
|
|
||||||
if (StringUtils.isEmpty(name)) {
|
if (StringUtils.isEmpty(name)) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
if(name.length() == 2){
|
|
||||||
|
|
||||||
|
if (name.length() == 2) {
|
||||||
return name.substring(0, 1) + "*";
|
return name.substring(0, 1) + "*";
|
||||||
}
|
} else if (name.length() > 2) {
|
||||||
else if(name.length() >2){
|
|
||||||
String str = "";
|
String str = "";
|
||||||
for (int i = 2; name.length() > i; i++)
|
for (int i = 2; name.length() > i; i++)
|
||||||
str += "*";
|
str += "*";
|
||||||
return name.substring(0, 1) + str + name.substring(name.length() - 1, name.length());
|
return name.substring(0, 1) + str + name.substring(name.length() - 1, name.length());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e){
|
return name;
|
||||||
} return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSafeParamData(String value) {
|
public static String getSafeParamData(String value) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user