first commit
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
package egovframework.com.cmm;
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jdbc.support.lob.LobCreator;
|
||||
import org.springframework.jdbc.support.lob.LobHandler;
|
||||
import egovframework.rte.psl.orm.ibatis.support.AbstractLobTypeHandler;
|
||||
|
||||
/**
|
||||
* iBATIS TypeHandler implementation for Strings that get mapped to CLOBs.
|
||||
* Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time.
|
||||
*
|
||||
* <p>Particularly useful for storing Strings with more than 4000 characters in an
|
||||
* Oracle database (only possible via CLOBs), in combination with OracleLobHandler.
|
||||
*
|
||||
* <p>Can also be defined in generic iBATIS mappings, as DefaultLobCreator will
|
||||
* work with most JDBC-compliant database drivers. In this case, the field type
|
||||
* does not have to be BLOB: For databases like MySQL and MS SQL Server, any
|
||||
* large enough binary type will work.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1.5
|
||||
* @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#setLobHandler
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AltibaseClobStringTypeHandler extends AbstractLobTypeHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AltibaseClobStringTypeHandler.class);
|
||||
|
||||
/**
|
||||
* Constructor used by iBATIS: fetches config-time LobHandler from
|
||||
* SqlMapClientFactoryBean.
|
||||
* @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#getConfigTimeLobHandler
|
||||
*/
|
||||
public AltibaseClobStringTypeHandler() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler.
|
||||
*/
|
||||
protected AltibaseClobStringTypeHandler(LobHandler lobHandler) {
|
||||
super(lobHandler);
|
||||
}
|
||||
|
||||
protected void setParameterInternal(
|
||||
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
lobCreator.setClobAsString(ps, index, (String) value);
|
||||
}
|
||||
|
||||
|
||||
protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
|
||||
StringBuffer read_data = new StringBuffer("");
|
||||
int read_length;
|
||||
|
||||
char [] buf = new char[1024];
|
||||
|
||||
Reader rd = lobHandler.getClobAsCharacterStream(rs, index);
|
||||
try {
|
||||
while( (read_length=rd.read(buf)) != -1) {
|
||||
read_data.append(buf, 0, read_length);
|
||||
}
|
||||
} catch (IOException ie) {
|
||||
SQLException sqle = new SQLException(ie.getMessage());
|
||||
throw sqle;
|
||||
// 2011.10.10 보안점검 후속조치
|
||||
} finally {
|
||||
if (rd != null) {
|
||||
try {
|
||||
rd.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORE: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return read_data.toString();
|
||||
|
||||
//return lobHandler.getClobAsString(rs, index);
|
||||
}
|
||||
|
||||
public Object valueOf(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
185
src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java
Normal file
185
src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java
Normal file
@@ -0,0 +1,185 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.11 이삼섭 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ComDefaultCodeVO implements Serializable {
|
||||
/** 코드 ID */
|
||||
private String codeId = "";
|
||||
|
||||
/** 상세코드 */
|
||||
private String code = "";
|
||||
|
||||
/** 코드명 */
|
||||
private String codeNm = "";
|
||||
|
||||
/** 코드설명 */
|
||||
private String codeDc = "";
|
||||
|
||||
/** 특정테이블명 */
|
||||
private String tableNm = ""; //특정테이블에서 코드정보를추출시 사용
|
||||
|
||||
/** 상세 조건 여부 */
|
||||
private String haveDetailCondition = "N";
|
||||
|
||||
/** 상세 조건 */
|
||||
private String detailCondition = "";
|
||||
|
||||
/**
|
||||
* codeId attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeId
|
||||
*/
|
||||
public String getCodeId() {
|
||||
return codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeId attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeId
|
||||
* the codeId to set
|
||||
*/
|
||||
public void setCodeId(String codeId) {
|
||||
this.codeId = codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute를 리턴한다.
|
||||
*
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 값을 설정한다.
|
||||
*
|
||||
* @param code
|
||||
* the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeNm
|
||||
*/
|
||||
public String getCodeNm() {
|
||||
return codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeNm
|
||||
* the codeNm to set
|
||||
*/
|
||||
public void setCodeNm(String codeNm) {
|
||||
this.codeNm = codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeDc
|
||||
*/
|
||||
public String getCodeDc() {
|
||||
return codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeDc
|
||||
* the codeDc to set
|
||||
*/
|
||||
public void setCodeDc(String codeDc) {
|
||||
this.codeDc = codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* tableNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the tableNm
|
||||
*/
|
||||
public String getTableNm() {
|
||||
return tableNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* tableNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param tableNm
|
||||
* the tableNm to set
|
||||
*/
|
||||
public void setTableNm(String tableNm) {
|
||||
this.tableNm = tableNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* haveDetailCondition attribute를 리턴한다.
|
||||
*
|
||||
* @return the haveDetailCondition
|
||||
*/
|
||||
public String getHaveDetailCondition() {
|
||||
return haveDetailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* haveDetailCondition attribute 값을 설정한다.
|
||||
*
|
||||
* @param haveDetailCondition
|
||||
* the haveDetailCondition to set
|
||||
*/
|
||||
public void setHaveDetailCondition(String haveDetailCondition) {
|
||||
this.haveDetailCondition = haveDetailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* detailCondition attribute를 리턴한다.
|
||||
*
|
||||
* @return the detailCondition
|
||||
*/
|
||||
public String getDetailCondition() {
|
||||
return detailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* detailCondition attribute 값을 설정한다.
|
||||
*
|
||||
* @param detailCondition
|
||||
* the detailCondition to set
|
||||
*/
|
||||
public void setDetailCondition(String detailCondition) {
|
||||
this.detailCondition = detailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString 메소드를 대치한다.
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
}
|
||||
166
src/main/java/egovframework/com/cmm/ComDefaultVO.java
Normal file
166
src/main/java/egovframework/com/cmm/ComDefaultVO.java
Normal file
@@ -0,0 +1,166 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : ComDefaultVO.java
|
||||
* @Description : ComDefaultVO class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------- -------- ---------------------------
|
||||
* @ 2009.02.01 조재영 최초 생성
|
||||
*
|
||||
* @author 공통서비스 개발팀 조재영
|
||||
* @since 2009.02.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ComDefaultVO implements Serializable {
|
||||
|
||||
/** 검색조건 */
|
||||
private String searchCondition = "";
|
||||
|
||||
/** 검색Keyword */
|
||||
private String searchKeyword = "";
|
||||
|
||||
/** 검색사용여부 */
|
||||
private String searchUseYn = "";
|
||||
|
||||
/** 현재페이지 */
|
||||
private int pageIndex = 1;
|
||||
|
||||
/** 페이지갯수 */
|
||||
private int pageUnit = 10;
|
||||
|
||||
/** 페이지사이즈 */
|
||||
private int pageSize = 10;
|
||||
|
||||
/** firstIndex */
|
||||
private int firstIndex = 1;
|
||||
|
||||
/** lastIndex */
|
||||
private int lastIndex = 1;
|
||||
|
||||
/** recordCountPerPage */
|
||||
private int recordCountPerPage = 10;
|
||||
|
||||
/** 검색KeywordFrom */
|
||||
private String searchKeywordFrom = "";
|
||||
|
||||
/** 검색KeywordTo */
|
||||
private String searchKeywordTo = "";
|
||||
|
||||
public int getFirstIndex() {
|
||||
return firstIndex;
|
||||
}
|
||||
|
||||
public void setFirstIndex(int firstIndex) {
|
||||
this.firstIndex = firstIndex;
|
||||
}
|
||||
|
||||
public int getLastIndex() {
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
public void setLastIndex(int lastIndex) {
|
||||
this.lastIndex = lastIndex;
|
||||
}
|
||||
|
||||
public int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
public void setRecordCountPerPage(int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
public String getSearchCondition() {
|
||||
return searchCondition;
|
||||
}
|
||||
|
||||
public void setSearchCondition(String searchCondition) {
|
||||
this.searchCondition = searchCondition;
|
||||
}
|
||||
|
||||
public String getSearchKeyword() {
|
||||
return searchKeyword;
|
||||
}
|
||||
|
||||
public void setSearchKeyword(String searchKeyword) {
|
||||
this.searchKeyword = searchKeyword;
|
||||
}
|
||||
|
||||
public String getSearchUseYn() {
|
||||
return searchUseYn;
|
||||
}
|
||||
|
||||
public void setSearchUseYn(String searchUseYn) {
|
||||
this.searchUseYn = searchUseYn;
|
||||
}
|
||||
|
||||
public int getPageIndex() {
|
||||
return pageIndex;
|
||||
}
|
||||
|
||||
public void setPageIndex(int pageIndex) {
|
||||
this.pageIndex = pageIndex;
|
||||
}
|
||||
|
||||
public int getPageUnit() {
|
||||
return pageUnit;
|
||||
}
|
||||
|
||||
public void setPageUnit(int pageUnit) {
|
||||
this.pageUnit = pageUnit;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* searchKeywordFrom attribute를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSearchKeywordFrom() {
|
||||
return searchKeywordFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordFrom attribute 값을 설정한다.
|
||||
* @param searchKeywordFrom String
|
||||
*/
|
||||
public void setSearchKeywordFrom(String searchKeywordFrom) {
|
||||
this.searchKeywordFrom = searchKeywordFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordTo attribute를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSearchKeywordTo() {
|
||||
return searchKeywordTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordTo attribute 값을 설정한다.
|
||||
* @param searchKeywordTo String
|
||||
*/
|
||||
public void setSearchKeywordTo(String searchKeywordTo) {
|
||||
this.searchKeywordTo = searchKeywordTo;
|
||||
}
|
||||
}
|
||||
405
src/main/java/egovframework/com/cmm/EgovComCrossSiteHndlr.java
Normal file
405
src/main/java/egovframework/com/cmm/EgovComCrossSiteHndlr.java
Normal file
@@ -0,0 +1,405 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import javax.servlet.jsp.tagext.BodyTagSupport;
|
||||
|
||||
import org.apache.taglibs.standard.tag.common.core.Util;
|
||||
|
||||
/**
|
||||
* Cross-Site Scripting 체크하여 값을 되돌려 받는 핸들러 JSP TLD, 자바에서 사용가능
|
||||
*
|
||||
* @author 공통서비스 장동한
|
||||
* @since 2010.11.09
|
||||
* @version 1.0
|
||||
* @see <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2010.11.09 장동한 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EgovComCrossSiteHndlr extends BodyTagSupport {
|
||||
|
||||
/*
|
||||
* (One almost wishes XML and JSP could support "anonymous tags," given the
|
||||
* amount of trouble we had naming this one!) :-) - sb
|
||||
*/
|
||||
|
||||
// *********************************************************************
|
||||
// Internal state
|
||||
|
||||
protected Object value; // tag attribute
|
||||
protected String def; // tag attribute
|
||||
protected boolean escapeXml; // tag attribute
|
||||
private boolean needBody; // non-space body needed?
|
||||
|
||||
// *********************************************************************
|
||||
// Construction and initialization
|
||||
|
||||
private final String m_sDiffChar ="()[]{}\"',:;= \t\r\n%!+-";
|
||||
//private String m_sDiffChar ="()[]{}\"',:;=%!+-";
|
||||
private final String m_sArrDiffChar [] = {
|
||||
"(",")",
|
||||
"[","]",
|
||||
"{","}",
|
||||
""","'",
|
||||
",",":",
|
||||
";","=",
|
||||
" ","\t", //" ","\t",
|
||||
"\r","\n", //"\r","\n",
|
||||
"%","!",
|
||||
"+","-"
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new handler. As with TagSupport, subclasses should not
|
||||
* provide other constructors and are expected to call the superclass
|
||||
* constructor.
|
||||
*/
|
||||
public EgovComCrossSiteHndlr() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
// resets local state
|
||||
private void init() {
|
||||
value = def = null;
|
||||
escapeXml = true;
|
||||
needBody = false;
|
||||
}
|
||||
|
||||
// Releases any resources we may have (or inherit)
|
||||
public void release() {
|
||||
super.release();
|
||||
init();
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// Tag logic
|
||||
|
||||
// evaluates 'value' and determines if the body should be evaluted
|
||||
public int doStartTag() throws JspException {
|
||||
|
||||
needBody = false; // reset state related to 'default'
|
||||
this.bodyContent = null; // clean-up body (just in case container is
|
||||
// pooling tag handlers)
|
||||
|
||||
JspWriter out = pageContext.getOut();
|
||||
//System.out.println("EgovComCrossSiteFilter> ============================");
|
||||
try {
|
||||
// print value if available; otherwise, try 'default'
|
||||
if (value != null) {
|
||||
//System.out.println("EgovComCrossSiteFilter> =value");
|
||||
String sWriteEscapedXml = getWriteEscapedXml();
|
||||
//System.out.println("EgovComCrossSiteFilter sWriteEscapedXml>" + sWriteEscapedXml);
|
||||
out.print(sWriteEscapedXml);
|
||||
return SKIP_BODY;
|
||||
} else {
|
||||
// if we don't have a 'default' attribute, just go to the body
|
||||
if (def == null) {
|
||||
needBody = true;
|
||||
return EVAL_BODY_BUFFERED;
|
||||
}
|
||||
|
||||
//System.out.println("EgovComCrossSiteFilter def> ="+def);
|
||||
|
||||
// if we do have 'default', print it
|
||||
if (def != null) {
|
||||
// good 'default'
|
||||
out(pageContext, escapeXml, def);
|
||||
//System.out.println("EgovComCrossSiteFilter> ="+def);
|
||||
}
|
||||
return SKIP_BODY;
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new JspException(ex.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
// prints the body if necessary; reports errors
|
||||
public int doEndTag() throws JspException {
|
||||
try {
|
||||
//System.out.println("EgovComCrossSiteFilter ==== doEndTag");
|
||||
if (!needBody){
|
||||
return EVAL_PAGE; // nothing more to do
|
||||
}
|
||||
|
||||
// trim and print out the body
|
||||
if (bodyContent != null && bodyContent.getString() != null){
|
||||
//String sWriteEscapedXml = getWriteEscapedXml();
|
||||
//out2(pageContext, escapeXml, sWriteEscapedXml.toString());
|
||||
//System.out.println("EgovComCrossSiteFilter> end");
|
||||
//System.out.println("EgovComCrossSiteFilter sWriteEscapedXml > sWriteEscapedXml");
|
||||
out(pageContext, escapeXml, bodyContent.getString().trim());
|
||||
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
} catch (IOException ex) {
|
||||
throw new JspException(ex.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// Public utility methods
|
||||
|
||||
/**
|
||||
* Outputs <tt>text</tt> to <tt>pageContext</tt>'s current JspWriter. If
|
||||
* <tt>escapeXml</tt> is true, performs the following substring replacements
|
||||
* (to facilitate output to XML/HTML pages):
|
||||
*
|
||||
* & -> & < -> < > -> > " -> " ' -> '
|
||||
*
|
||||
* See also Util.escapeXml().
|
||||
*/
|
||||
public static void out(PageContext pageContext, boolean escapeXml,
|
||||
Object obj) throws IOException {
|
||||
JspWriter w = pageContext.getOut();
|
||||
|
||||
if (!escapeXml) {
|
||||
// write chars as is
|
||||
if (obj instanceof Reader) {
|
||||
Reader reader = (Reader) obj;
|
||||
char[] buf = new char[4096];
|
||||
int count;
|
||||
while ((count = reader.read(buf, 0, 4096)) != -1) {
|
||||
w.write(buf, 0, count);
|
||||
}
|
||||
} else {
|
||||
w.write(obj.toString());
|
||||
}
|
||||
} else {
|
||||
// escape XML chars
|
||||
if (obj instanceof Reader) {
|
||||
Reader reader = (Reader) obj;
|
||||
char[] buf = new char[4096];
|
||||
int count;
|
||||
while ((count = reader.read(buf, 0, 4096)) != -1) {
|
||||
writeEscapedXml(buf, count, w);
|
||||
}
|
||||
} else {
|
||||
String text = obj.toString();
|
||||
writeEscapedXml(text.toCharArray(), text.length(), w);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void out2(PageContext pageContext, boolean escapeXml,
|
||||
Object obj) throws IOException {
|
||||
JspWriter w = pageContext.getOut();
|
||||
|
||||
w.write(obj.toString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
private static void writeEscapedXml(char[] buffer, int length, JspWriter w)
|
||||
throws IOException {
|
||||
int start = 0;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
if (start < i) {
|
||||
w.write(buffer, start, i - start);
|
||||
}
|
||||
// add escaped xml
|
||||
w.write(escaped);
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// add rest of unescaped portion
|
||||
if (start < length) {
|
||||
w.write(buffer, start, length - start);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private String getWriteEscapedXml() throws IOException {
|
||||
String sRtn = "";
|
||||
|
||||
Object obj = this.value;
|
||||
|
||||
int start = 0;
|
||||
String text = obj.toString();
|
||||
|
||||
int length = text.length();
|
||||
char[] buffer = text.toCharArray();
|
||||
boolean booleanDiff = false;
|
||||
//String sDiffChar
|
||||
//String sArrDiffChar
|
||||
char[] cDiffChar = this.m_sDiffChar.toCharArray();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
|
||||
booleanDiff = false;
|
||||
|
||||
for(int k = 0; k < cDiffChar.length; k++){
|
||||
if(c == cDiffChar[k]){
|
||||
sRtn = sRtn + m_sArrDiffChar[k];
|
||||
booleanDiff = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(booleanDiff) continue;
|
||||
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
//if (start < i) {
|
||||
// sRtn = sRtn + text.substring(start, i - start);
|
||||
//}
|
||||
// add escaped xml
|
||||
//sRtn = sRtn + escaped;
|
||||
//System.out.println(buffer[i]+" :: " + escaped);
|
||||
for (int j = 0; j < escaped.length; j++) {
|
||||
//System.out.println(buffer[i]+" :>: " + escaped[j]);
|
||||
sRtn = sRtn + escaped[j];
|
||||
}
|
||||
//sRtn = sRtn+ escaped.toString();
|
||||
//sRtn = sRtn + String.valueOf(buffer[i]);
|
||||
start = i + 1;
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}
|
||||
|
||||
return sRtn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private String getWriteEscapedXml(String sWriteString) throws IOException {
|
||||
|
||||
String sRtn = "";
|
||||
|
||||
Object obj = sWriteString;
|
||||
|
||||
int start = 0;
|
||||
String text = obj.toString();
|
||||
|
||||
int length = text.length();
|
||||
char[] buffer = text.toCharArray();
|
||||
boolean booleanDiff = false;
|
||||
//String sDiffChar
|
||||
//String sArrDiffChar
|
||||
char[] cDiffChar = this.m_sDiffChar.toCharArray();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
|
||||
booleanDiff = false;
|
||||
|
||||
for(int k = 0; k < cDiffChar.length; k++){
|
||||
if(c == cDiffChar[k]){
|
||||
sRtn = sRtn + m_sArrDiffChar[k];
|
||||
booleanDiff = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(booleanDiff) continue;
|
||||
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
//if (start < i) {
|
||||
// sRtn = sRtn + text.substring(start, i - start);
|
||||
//}
|
||||
// add escaped xml
|
||||
//sRtn = sRtn + escaped;
|
||||
//System.out.println(buffer[i]+" :: " + escaped);
|
||||
for (int j = 0; j < escaped.length; j++) {
|
||||
//System.out.println(buffer[i]+" :>: " + escaped[j]);
|
||||
sRtn = sRtn + escaped[j];
|
||||
}
|
||||
//sRtn = sRtn+ escaped.toString();
|
||||
//sRtn = sRtn + String.valueOf(buffer[i]);
|
||||
start = i + 1;
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}
|
||||
|
||||
return sRtn;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setDefault(String def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setEscapeXml(boolean escapeXml) {
|
||||
this.escapeXml = escapeXml;
|
||||
}
|
||||
|
||||
/** 2011.10.10 cmd 라인상에서 편의제공을 위해 제공, 필요없을시 삭제하여도 무방함
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
|
||||
EgovComCrossSiteHndlr egovComCrossSiteHndlr = new EgovComCrossSiteHndlr();
|
||||
|
||||
egovComCrossSiteHndlr.value = "TRNSMIT";
|
||||
|
||||
String sCrossSiteHndlr = egovComCrossSiteHndlr.getWriteEscapedXml();
|
||||
//System.out.println("writeEscapedXml " + egovComCrossSiteHndlr.getWriteEscapedXml());
|
||||
/*
|
||||
System.out.println("sCrossSiteHndlr|"+ sCrossSiteHndlr + "|");
|
||||
|
||||
try{
|
||||
System.out.println("TRY TEST 1");
|
||||
throw new Exception();
|
||||
}catch(Exception e){
|
||||
System.out.println("TRY TEST 2");
|
||||
}finally{
|
||||
System.out.println("TRY TEST 3");
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
48
src/main/java/egovframework/com/cmm/EgovComExcepHndlr.java
Normal file
48
src/main/java/egovframework/com/cmm/EgovComExcepHndlr.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovComExcepHndlr.java
|
||||
* @Description : 공통서비스의 exception 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 13. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 13.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class EgovComExcepHndlr implements ExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComExcepHndlr.class);
|
||||
|
||||
/*
|
||||
@Resource(name = "otherSSLMailSender")
|
||||
private SimpleSSLMail mailSender;
|
||||
*/
|
||||
/**
|
||||
* 발생된 Exception을 처리한다.
|
||||
*/
|
||||
public void occur(Exception ex, String packageName) {
|
||||
//log.debug(" EgovServiceExceptionHandler run...............");
|
||||
|
||||
/*
|
||||
try {
|
||||
mailSender. send(ex, packageName);
|
||||
log.debug(" sending a alert mail is completed ");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(packageName, ex);
|
||||
}
|
||||
*/
|
||||
|
||||
LOGGER.error(packageName, ex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class EgovComOthersExcepHndlr implements ExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComOthersExcepHndlr.class);
|
||||
|
||||
public void occur(Exception exception, String packageName) {
|
||||
//log.debug(" EgovServiceExceptionHandler run...............");
|
||||
LOGGER.error(packageName, exception);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* EgovComUtil 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011.09.15
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011.09.15 서준식 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Service("egovUtil")
|
||||
public class EgovComponentChecker extends EgovAbstractServiceImpl implements ApplicationContextAware{
|
||||
|
||||
|
||||
public static ApplicationContext context;
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void setApplicationContext(ApplicationContext context)
|
||||
throws BeansException {
|
||||
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Spring MVC에서 설정한 빈이 아닌 서비스 빈(컴포넌트)만을 검색할 수 있음
|
||||
*
|
||||
*/
|
||||
public static boolean hasComponent(String componentName){
|
||||
|
||||
try{
|
||||
Object component = context.getBean(componentName);
|
||||
|
||||
if(component == null){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
||||
}catch(NoSuchBeanDefinitionException ex){// 해당 컴포넌트를 찾을 수없을 경우 false반환
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
55
src/main/java/egovframework/com/cmm/EgovMessageSource.java
Normal file
55
src/main/java/egovframework/com/cmm/EgovMessageSource.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* 메시지 리소스 사용을 위한 MessageSource 인터페이스 및 ReloadableResourceBundleMessageSource 클래스의 구현체
|
||||
* @author 공통서비스 개발팀 이문준
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.11 이문준 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovMessageSource extends ReloadableResourceBundleMessageSource implements MessageSource {
|
||||
|
||||
private ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @param reloadableResourceBundleMessageSource - resource MessageSource
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public void setReloadableResourceBundleMessageSource(ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource) {
|
||||
this.reloadableResourceBundleMessageSource = reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
||||
return reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 정의된 메세지 조회
|
||||
* @param code - 메세지 코드
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage(String code) {
|
||||
return getReloadableResourceBundleMessageSource().getMessage(code, null, Locale.getDefault());
|
||||
}
|
||||
|
||||
}
|
||||
109
src/main/java/egovframework/com/cmm/EgovWebUtil.java
Normal file
109
src/main/java/egovframework/com/cmm/EgovWebUtil.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 교차접속 스크립트 공격 취약성 방지(파라미터 문자열 교체)
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.10.10 한성곤 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovWebUtil {
|
||||
public static String clearXSSMinimum(String value) {
|
||||
if (value == null || value.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String returnValue = value;
|
||||
|
||||
returnValue = returnValue.replaceAll("&", "&");
|
||||
returnValue = returnValue.replaceAll("<", "<");
|
||||
returnValue = returnValue.replaceAll(">", ">");
|
||||
returnValue = returnValue.replaceAll("\"", """);
|
||||
returnValue = returnValue.replaceAll("\'", "'");
|
||||
returnValue = returnValue.replaceAll(".", ".");
|
||||
returnValue = returnValue.replaceAll("%2E", ".");
|
||||
returnValue = returnValue.replaceAll("%2F", "/");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String clearXSSMaximum(String value) {
|
||||
String returnValue = value;
|
||||
returnValue = clearXSSMinimum(returnValue);
|
||||
|
||||
returnValue = returnValue.replaceAll("%00", null);
|
||||
|
||||
returnValue = returnValue.replaceAll("%", "%");
|
||||
|
||||
// \\. => .
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
|
||||
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
|
||||
returnValue = returnValue.replaceAll("\\./", ""); // ./
|
||||
returnValue = returnValue.replaceAll("%2F", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String filePathBlackList(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
|
||||
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 행안부 보안취약점 점검 조치 방안.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String filePathReplaceAll(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
returnValue = returnValue.replaceAll("/", "");
|
||||
returnValue = returnValue.replaceAll("\\", "");
|
||||
returnValue = returnValue.replaceAll("\\.\\.", ""); // ..
|
||||
returnValue = returnValue.replaceAll("&", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String filePathWhiteList(String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isIPAddress(String str) {
|
||||
Pattern ipPattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
|
||||
|
||||
return ipPattern.matcher(str).matches();
|
||||
}
|
||||
|
||||
public static String removeCRLF(String parameter) {
|
||||
return parameter.replaceAll("\r", "").replaceAll("\n", "");
|
||||
}
|
||||
|
||||
public static String removeSQLInjectionRisk(String parameter) {
|
||||
return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("%", "").replaceAll(";", "").replaceAll("-", "").replaceAll("\\+", "").replaceAll(",", "");
|
||||
}
|
||||
|
||||
public static String removeOSCmdRisk(String parameter) {
|
||||
return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("|", "").replaceAll(";", "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
/**
|
||||
* ImagePaginationRenderer.java 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011. 9. 16.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011. 9. 16. 서준식 이미지 경로에 ContextPath추가
|
||||
* </pre>
|
||||
*/
|
||||
public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware{
|
||||
|
||||
private ServletContext servletContext;
|
||||
|
||||
public ImagePaginationRenderer() {
|
||||
|
||||
}
|
||||
|
||||
public void initVariables(){
|
||||
firstPageLabel = "<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/icon/icon_prevend.gif\" alt=\"처음\" border=\"0\"/></a> ";
|
||||
previousPageLabel = "<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/icon/icon_prev.gif\" alt=\"이전\" border=\"0\"/></a> ";
|
||||
currentPageLabel = "<strong>{0}</strong> ";
|
||||
otherPageLabel = "<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \">{2}</a> ";
|
||||
nextPageLabel = "<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/icon/icon_next.gif\" alt=\"다음\" border=\"0\"/></a> ";
|
||||
lastPageLabel = "<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/icon/icon_nextend.gif\" alt=\"마지막\" border=\"0\"/></a> ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
this.servletContext = servletContext;
|
||||
initVariables();
|
||||
}
|
||||
|
||||
}
|
||||
50
src/main/java/egovframework/com/cmm/IncludedCompInfoVO.java
Normal file
50
src/main/java/egovframework/com/cmm/IncludedCompInfoVO.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
/**
|
||||
* IncludedInfo annotation을 바탕으로 화면에 표시할 정보를 구성하기 위한 VO 클래스
|
||||
* @author 공통컴포넌트 정진오
|
||||
* @since 2011.08.26
|
||||
* @version 2.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.08.26 정진오 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class IncludedCompInfoVO {
|
||||
|
||||
private String name;
|
||||
private String listUrl;
|
||||
private int order;
|
||||
private int gid;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getListUrl() {
|
||||
return listUrl;
|
||||
}
|
||||
public void setListUrl(String listUrl) {
|
||||
this.listUrl = listUrl;
|
||||
}
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
public int getGid() {
|
||||
return gid;
|
||||
}
|
||||
public void setGid(int gid) {
|
||||
this.gid = gid;
|
||||
}
|
||||
}
|
||||
282
src/main/java/egovframework/com/cmm/LoginVO.java
Normal file
282
src/main/java/egovframework/com/cmm/LoginVO.java
Normal file
@@ -0,0 +1,282 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Class Name : LoginVO.java
|
||||
* @Description : Login VO class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------- -------- ---------------------------
|
||||
* @ 2009.03.03 박지욱 최초 생성
|
||||
*
|
||||
* @author 공통서비스 개발팀 박지욱
|
||||
* @since 2009.03.03
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class LoginVO implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8274004534207618049L;
|
||||
|
||||
/** 아이디 */
|
||||
private String id;
|
||||
/** 이름 */
|
||||
private String name;
|
||||
/** 주민등록번호 */
|
||||
private String ihidNum;
|
||||
/** 이메일주소 */
|
||||
private String email;
|
||||
/** 비밀번호 */
|
||||
private String password;
|
||||
/** 비밀번호 힌트 */
|
||||
private String passwordHint;
|
||||
/** 비밀번호 정답 */
|
||||
private String passwordCnsr;
|
||||
/** 사용자구분 */
|
||||
private String userSe;
|
||||
/** 조직(부서)ID */
|
||||
private String orgnztId;
|
||||
/** 조직(부서)명 */
|
||||
private String orgnztNm;
|
||||
/** 고유아이디 */
|
||||
private String uniqId;
|
||||
/** 로그인 후 이동할 페이지 */
|
||||
private String url;
|
||||
/** 사용자 IP정보 */
|
||||
private String ip;
|
||||
/** GPKI인증 DN */
|
||||
private String dn;
|
||||
|
||||
private String tel;
|
||||
|
||||
private String positionNm;
|
||||
|
||||
private String tmpPassword;
|
||||
|
||||
/**
|
||||
* id attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* id attribute 값을 설정한다.
|
||||
* @param id String
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* name attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* name attribute 값을 설정한다.
|
||||
* @param name String
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* ihidNum attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getIhidNum() {
|
||||
return ihidNum;
|
||||
}
|
||||
/**
|
||||
* ihidNum attribute 값을 설정한다.
|
||||
* @param ihidNum String
|
||||
*/
|
||||
public void setIhidNum(String ihidNum) {
|
||||
this.ihidNum = ihidNum;
|
||||
}
|
||||
/**
|
||||
* email attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
/**
|
||||
* email attribute 값을 설정한다.
|
||||
* @param email String
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
/**
|
||||
* password attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
/**
|
||||
* password attribute 값을 설정한다.
|
||||
* @param password String
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
/**
|
||||
* passwordHint attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPasswordHint() {
|
||||
return passwordHint;
|
||||
}
|
||||
/**
|
||||
* passwordHint attribute 값을 설정한다.
|
||||
* @param passwordHint String
|
||||
*/
|
||||
public void setPasswordHint(String passwordHint) {
|
||||
this.passwordHint = passwordHint;
|
||||
}
|
||||
/**
|
||||
* passwordCnsr attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPasswordCnsr() {
|
||||
return passwordCnsr;
|
||||
}
|
||||
/**
|
||||
* passwordCnsr attribute 값을 설정한다.
|
||||
* @param passwordCnsr String
|
||||
*/
|
||||
public void setPasswordCnsr(String passwordCnsr) {
|
||||
this.passwordCnsr = passwordCnsr;
|
||||
}
|
||||
/**
|
||||
* userSe attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUserSe() {
|
||||
return userSe;
|
||||
}
|
||||
/**
|
||||
* userSe attribute 값을 설정한다.
|
||||
* @param userSe String
|
||||
*/
|
||||
public void setUserSe(String userSe) {
|
||||
this.userSe = userSe;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getOrgnztId() {
|
||||
return orgnztId;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 값을 설정한다.
|
||||
* @param orgnztId String
|
||||
*/
|
||||
public void setOrgnztId(String orgnztId) {
|
||||
this.orgnztId = orgnztId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUniqId() {
|
||||
return uniqId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 값을 설정한다.
|
||||
* @param uniqId String
|
||||
*/
|
||||
public void setUniqId(String uniqId) {
|
||||
this.uniqId = uniqId;
|
||||
}
|
||||
/**
|
||||
* url attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
/**
|
||||
* url attribute 값을 설정한다.
|
||||
* @param url String
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
/**
|
||||
* ip attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
/**
|
||||
* ip attribute 값을 설정한다.
|
||||
* @param ip String
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
/**
|
||||
* dn attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getDn() {
|
||||
return dn;
|
||||
}
|
||||
/**
|
||||
* dn attribute 값을 설정한다.
|
||||
* @param dn String
|
||||
*/
|
||||
public void setDn(String dn) {
|
||||
this.dn = dn;
|
||||
}
|
||||
/**
|
||||
* @return the orgnztNm
|
||||
*/
|
||||
public String getOrgnztNm() {
|
||||
return orgnztNm;
|
||||
}
|
||||
/**
|
||||
* @param orgnztNm the orgnztNm to set
|
||||
*/
|
||||
public void setOrgnztNm(String orgnztNm) {
|
||||
this.orgnztNm = orgnztNm;
|
||||
}
|
||||
|
||||
|
||||
public String getTel() {
|
||||
return this.tel;
|
||||
}
|
||||
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public String getPositionNm() {
|
||||
return this.positionNm;
|
||||
}
|
||||
|
||||
public void setPositionNm(String positionNm) {
|
||||
this.positionNm = positionNm;
|
||||
}
|
||||
|
||||
public String getTmpPassword() {
|
||||
return this.tmpPassword;
|
||||
}
|
||||
|
||||
public void setTmpPassword(String tmpPassword) {
|
||||
this.tmpPassword = tmpPassword;
|
||||
}
|
||||
}
|
||||
|
||||
120
src/main/java/egovframework/com/cmm/SessionVO.java
Normal file
120
src/main/java/egovframework/com/cmm/SessionVO.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 세션 VO 클래스
|
||||
* @author 공통서비스 개발팀 박지욱
|
||||
* @since 2009.03.06
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.06 박지욱 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SessionVO implements Serializable {
|
||||
|
||||
/** 아이디 */
|
||||
private String sUserId;
|
||||
/** 이름 */
|
||||
private String sUserNm;
|
||||
/** 이메일 */
|
||||
private String sEmail;
|
||||
/** 사용자구분 */
|
||||
private String sUserSe;
|
||||
/** 조직(부서)ID */
|
||||
private String orgnztId;
|
||||
/** 고유아이디 */
|
||||
private String uniqId;
|
||||
/**
|
||||
* sUserId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserId() {
|
||||
return sUserId;
|
||||
}
|
||||
/**
|
||||
* sUserId attribute 값을 설정한다.
|
||||
* @param sUserId String
|
||||
*/
|
||||
public void setSUserId(String userId) {
|
||||
sUserId = userId;
|
||||
}
|
||||
/**
|
||||
* sUserNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserNm() {
|
||||
return sUserNm;
|
||||
}
|
||||
/**
|
||||
* sUserNm attribute 값을 설정한다.
|
||||
* @param sUserNm String
|
||||
*/
|
||||
public void setSUserNm(String userNm) {
|
||||
sUserNm = userNm;
|
||||
}
|
||||
/**
|
||||
* sEmail attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSEmail() {
|
||||
return sEmail;
|
||||
}
|
||||
/**
|
||||
* sEmail attribute 값을 설정한다.
|
||||
* @param sEmail String
|
||||
*/
|
||||
public void setSEmail(String email) {
|
||||
sEmail = email;
|
||||
}
|
||||
/**
|
||||
* sUserSe attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserSe() {
|
||||
return sUserSe;
|
||||
}
|
||||
/**
|
||||
* sUserSe attribute 값을 설정한다.
|
||||
* @param sUserSe String
|
||||
*/
|
||||
public void setSUserSe(String userSe) {
|
||||
sUserSe = userSe;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getOrgnztId() {
|
||||
return orgnztId;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 값을 설정한다.
|
||||
* @param orgnztId String
|
||||
*/
|
||||
public void setOrgnztId(String orgnztId) {
|
||||
this.orgnztId = orgnztId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUniqId() {
|
||||
return uniqId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 값을 설정한다.
|
||||
* @param uniqId String
|
||||
*/
|
||||
public void setUniqId(String uniqId) {
|
||||
this.uniqId = uniqId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package egovframework.com.cmm.annotation;
|
||||
|
||||
/**
|
||||
* 컴포넌트의 포함 정보 표현을 위한 annotation 클래스
|
||||
* 기본적으로 Controller 클래스에 annotation을 부여하되,
|
||||
* 하나의 Controller에 여러 개의 목록성 url mapping이 제공되는 경우에는
|
||||
* 메소드에 annotation을 부여한다.
|
||||
* @author 공통컴포넌트 정진오
|
||||
* @since 2011.08.26
|
||||
* @version 2.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.08.26 정진오 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface IncludedInfo {
|
||||
String name() default ""; // 컴포넌트의 한글 이름
|
||||
String listUrl() default ""; // 컴포넌트의 목록정보조회를 위한 URL
|
||||
int order() default 0; // 자동 생성되는 메뉴 목록에 표시되는 순서
|
||||
int gid() default 0; // 컴포넌트의 Group ID(대분류 구분)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2008-2009 MOPAS(MINISTRY OF SECURITY AND PUBLIC ADMINISTRATION).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package egovframework.com.cmm.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class HTMLTagFilter implements Filter{
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private FilterConfig config;
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
chain.doFilter(new HTMLTagFilterRequestWrapper((HttpServletRequest)request), response);
|
||||
}
|
||||
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright 2008-2009 MOPAS(MINISTRY OF SECURITY AND PUBLIC ADMINISTRATION).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package egovframework.com.cmm.filter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
|
||||
public class HTMLTagFilterRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
public HTMLTagFilterRequestWrapper(HttpServletRequest request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
public String[] getParameterValues(String parameter) {
|
||||
|
||||
String[] values = super.getParameterValues(parameter);
|
||||
|
||||
if(values==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i] != null) {
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
for (int j = 0; j < values[i].length(); j++) {
|
||||
char c = values[i].charAt(j);
|
||||
switch (c) {
|
||||
case '<':
|
||||
strBuff.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
//case '&':
|
||||
//strBuff.append("&");
|
||||
//break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
break;
|
||||
default:
|
||||
strBuff.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
values[i] = strBuff.toString();
|
||||
} else {
|
||||
values[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public String getParameter(String parameter) {
|
||||
|
||||
String value = super.getParameter(parameter);
|
||||
|
||||
if(value==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char c = value.charAt(i);
|
||||
switch (c) {
|
||||
case '<':
|
||||
strBuff.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
case '&':
|
||||
strBuff.append("&");
|
||||
break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
break;
|
||||
default:
|
||||
strBuff.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = strBuff.toString();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package egovframework.com.cmm.interceptor;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
/**
|
||||
* 인증여부 체크 인터셉터
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011.07.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.07.01 서준식 최초 생성
|
||||
* 2011.09.07 서준식 인증이 필요없는 URL을 패스하는 로직 추가
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
||||
public class AuthenticInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
/**
|
||||
* 세션에 계정정보(LoginVO)가 있는지 여부로 인증 여부를 체크한다.
|
||||
* 계정정보(LoginVO)가 없다면, 로그인 페이지로 이동한다.
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
String uri = request.getRequestURI();
|
||||
|
||||
//세션 체크 제외 URL
|
||||
if (uri.equals("/login.do") ||
|
||||
uri.equals("/") ||
|
||||
uri.equals("/actionLoginSys.do") ||
|
||||
uri.equals("/js/") ||
|
||||
uri.equals("/images/")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
|
||||
if (loginVO == null) {
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().println("<script>alert('세션이 종료되었습니다. 다시 로그인해주세요.'); location.href='/login.do';</script>");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package egovframework.com.cmm.interceptor;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
/**
|
||||
* 사용자IP 체크 인터셉터
|
||||
* @author 유지보수팀 이기하
|
||||
* @since 2013.03.28
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2013.03.28 이기하 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class IpObtainInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
String clientIp = request.getRemoteAddr();
|
||||
|
||||
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
|
||||
if (loginVO != null) {
|
||||
loginVO.setIp(clientIp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
194
src/main/java/egovframework/com/cmm/service/CmmnDetailCode.java
Normal file
194
src/main/java/egovframework/com/cmm/service/CmmnDetailCode.java
Normal file
@@ -0,0 +1,194 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 공통상세코드 모델 클래스
|
||||
* @author 공통서비스 개발팀 이중호
|
||||
* @since 2009.04.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.04.01 이중호 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class CmmnDetailCode implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* 코드ID
|
||||
*/
|
||||
private String codeId = "";
|
||||
|
||||
/*
|
||||
* 코드ID명
|
||||
*/
|
||||
private String codeIdNm = "";
|
||||
|
||||
/*
|
||||
* 코드
|
||||
*/
|
||||
private String code = "";
|
||||
|
||||
/*
|
||||
* 코드명
|
||||
*/
|
||||
private String codeNm = "";
|
||||
|
||||
/*
|
||||
* 코드설명
|
||||
*/
|
||||
private String codeDc = "";
|
||||
|
||||
/*
|
||||
* 사용여부
|
||||
*/
|
||||
private String useAt = "";
|
||||
|
||||
/*
|
||||
* 최초등록자ID
|
||||
*/
|
||||
private String frstRegisterId = "";
|
||||
|
||||
/*
|
||||
* 최종수정자ID
|
||||
*/
|
||||
private String lastUpdusrId = "";
|
||||
|
||||
/**
|
||||
* codeId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeId() {
|
||||
return codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeId attribute 값을 설정한다.
|
||||
* @param codeId String
|
||||
*/
|
||||
public void setCodeId(String codeId) {
|
||||
this.codeId = codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeIdNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeIdNm() {
|
||||
return codeIdNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeIdNm attribute 값을 설정한다.
|
||||
* @param codeIdNm String
|
||||
*/
|
||||
public void setCodeIdNm(String codeIdNm) {
|
||||
this.codeIdNm = codeIdNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 값을 설정한다.
|
||||
* @param code String
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeNm() {
|
||||
return codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 값을 설정한다.
|
||||
* @param codeNm String
|
||||
*/
|
||||
public void setCodeNm(String codeNm) {
|
||||
this.codeNm = codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeDc() {
|
||||
return codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 값을 설정한다.
|
||||
* @param codeDc String
|
||||
*/
|
||||
public void setCodeDc(String codeDc) {
|
||||
this.codeDc = codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* useAt attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUseAt() {
|
||||
return useAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* useAt attribute 값을 설정한다.
|
||||
* @param useAt String
|
||||
*/
|
||||
public void setUseAt(String useAt) {
|
||||
this.useAt = useAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* frstRegisterId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getFrstRegisterId() {
|
||||
return frstRegisterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* frstRegisterId attribute 값을 설정한다.
|
||||
* @param frstRegisterId String
|
||||
*/
|
||||
public void setFrstRegisterId(String frstRegisterId) {
|
||||
this.frstRegisterId = frstRegisterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* lastUpdusrId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getLastUpdusrId() {
|
||||
return lastUpdusrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* lastUpdusrId attribute 값을 설정한다.
|
||||
* @param lastUpdusrId String
|
||||
*/
|
||||
public void setLastUpdusrId(String lastUpdusrId) {
|
||||
this.lastUpdusrId = lastUpdusrId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기 위한 서비스 인터페이스
|
||||
* @author 공통서비스 개발팀 이삼섭
|
||||
* @since 2009.04.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.11 이삼섭 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface EgovCmmUseService {
|
||||
|
||||
/**
|
||||
* 공통코드를 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return List(코드)
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
* ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다.
|
||||
*
|
||||
* @param voList
|
||||
* @return Map(코드)
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception;
|
||||
|
||||
/**
|
||||
* 조직정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 조직정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
* 그룹정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 그룹정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngService.java
|
||||
* @Description : 파일정보의 관리를 위한 서비스 인터페이스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public interface EgovFileMngService {
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<FileVO> selectFileInfs(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception;
|
||||
}
|
||||
421
src/main/java/egovframework/com/cmm/service/EgovFileMngUtil.java
Normal file
421
src/main/java/egovframework/com/cmm/service/EgovFileMngUtil.java
Normal file
@@ -0,0 +1,421 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import egovframework.com.cmm.EgovWebUtil;
|
||||
import egovframework.com.cmm.util.EgovResourceCloseHelper;
|
||||
|
||||
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngUtil.java
|
||||
* @Description : 메시지 처리 관련 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.02.13 이삼섭 최초 생성
|
||||
* 2011.08.09 서준식 utl.fcc패키지와 Dependency제거를 위해 getTimeStamp()메서드 추가
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 02. 13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Component("EgovFileMngUtil")
|
||||
public class EgovFileMngUtil {
|
||||
|
||||
public static final int BUFF_SIZE = 2048;
|
||||
|
||||
@Resource(name = "egovFileIdGnrService")
|
||||
private EgovIdGnrService idgenService;
|
||||
|
||||
/**
|
||||
* 첨부파일에 대한 목록 정보를 취득한다.
|
||||
*
|
||||
* @param files
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<FileVO> parseFileInf(Map<String, MultipartFile> files, String KeyStr, int fileKeyParam, String atchFileId, String storePath) throws Exception {
|
||||
int fileKey = fileKeyParam;
|
||||
|
||||
String storePathString = "";
|
||||
String atchFileIdString = "";
|
||||
|
||||
if ("".equals(storePath) || storePath == null) {
|
||||
storePathString = EgovProperties.getProperty("Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = EgovProperties.getProperty(storePath);
|
||||
}
|
||||
|
||||
if ("".equals(atchFileId) || atchFileId == null) {
|
||||
atchFileIdString = idgenService.getNextStringId();
|
||||
} else {
|
||||
atchFileIdString = atchFileId;
|
||||
}
|
||||
|
||||
File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString));
|
||||
|
||||
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
|
||||
Iterator<Entry<String, MultipartFile>> itr = files.entrySet().iterator();
|
||||
MultipartFile file;
|
||||
String filePath = "";
|
||||
List<FileVO> result = new ArrayList<FileVO>();
|
||||
FileVO fvo;
|
||||
|
||||
while (itr.hasNext()) {
|
||||
Entry<String, MultipartFile> entry = itr.next();
|
||||
|
||||
file = entry.getValue();
|
||||
String orginFileName = file.getOriginalFilename();
|
||||
|
||||
//--------------------------------------
|
||||
// 원 파일명이 없는 경우 처리
|
||||
// (첨부가 되지 않은 input file type)
|
||||
//--------------------------------------
|
||||
if ("".equals(orginFileName)) {
|
||||
continue;
|
||||
}
|
||||
////------------------------------------
|
||||
|
||||
int index = orginFileName.lastIndexOf(".");
|
||||
//String fileName = orginFileName.substring(0, index);
|
||||
String fileExt = orginFileName.substring(index + 1);
|
||||
String newName = KeyStr + getTimeStamp() + fileKey;
|
||||
long size = file.getSize();
|
||||
|
||||
if (!"".equals(orginFileName)) {
|
||||
filePath = storePathString + File.separator + newName;
|
||||
file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath)));
|
||||
}
|
||||
|
||||
fvo = new FileVO();
|
||||
fvo.setFileExtsn(fileExt);
|
||||
fvo.setFileStreCours(storePathString);
|
||||
fvo.setFileMg(Long.toString(size));
|
||||
fvo.setOrignlFileNm(orginFileName);
|
||||
fvo.setStreFileNm(newName);
|
||||
fvo.setAtchFileId(atchFileIdString);
|
||||
fvo.setFileSn(String.valueOf(fileKey));
|
||||
|
||||
result.add(fvo);
|
||||
|
||||
fileKey++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일을 서버에 저장한다.
|
||||
*
|
||||
* @param file
|
||||
* @param newName
|
||||
* @param stordFilePath
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void writeUploadedFile(MultipartFile file, String newName, String stordFilePath) throws Exception {
|
||||
InputStream stream = null;
|
||||
OutputStream bos = null;
|
||||
|
||||
try {
|
||||
stream = file.getInputStream();
|
||||
File cFile = new File(stordFilePath);
|
||||
|
||||
if (!cFile.isDirectory()) {
|
||||
boolean _flag = cFile.mkdir();
|
||||
if (!_flag) {
|
||||
throw new IOException("Directory creation Failed ");
|
||||
}
|
||||
}
|
||||
|
||||
bos = new FileOutputStream(stordFilePath + File.separator + newName);
|
||||
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[BUFF_SIZE];
|
||||
|
||||
while ((bytesRead = stream.read(buffer, 0, BUFF_SIZE)) != -1) {
|
||||
bos.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(bos, stream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버의 파일을 다운로드한다.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void downFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
String downFileName = "";
|
||||
String orgFileName = "";
|
||||
|
||||
if ((String) request.getAttribute("downFile") == null) {
|
||||
downFileName = "";
|
||||
} else {
|
||||
downFileName = (String) request.getAttribute("downFile");
|
||||
}
|
||||
|
||||
if ((String) request.getAttribute("orgFileName") == null) {
|
||||
orgFileName = "";
|
||||
} else {
|
||||
orgFileName = (String) request.getAttribute("orginFile");
|
||||
}
|
||||
|
||||
orgFileName = orgFileName.replaceAll("\r", "").replaceAll("\n", "");
|
||||
|
||||
File file = new File(EgovWebUtil.filePathBlackList(downFileName));
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[BUFF_SIZE]; //buffer size 2K.
|
||||
|
||||
response.setContentType("application/x-msdownload");
|
||||
response.setHeader("Content-Disposition:", "attachment; filename=" + new String(orgFileName.getBytes(), "UTF-8"));
|
||||
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
|
||||
BufferedInputStream fin = null;
|
||||
BufferedOutputStream outs = null;
|
||||
|
||||
try {
|
||||
fin = new BufferedInputStream(new FileInputStream(file));
|
||||
outs = new BufferedOutputStream(response.getOutputStream());
|
||||
int read = 0;
|
||||
|
||||
while ((read = fin.read(buffer)) != -1) {
|
||||
outs.write(buffer, 0, read);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(outs, fin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부로 등록된 파일을 서버에 업로드한다.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HashMap<String, String> uploadFile(MultipartFile file) throws Exception {
|
||||
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
//Write File 이후 Move File????
|
||||
String newName = "";
|
||||
String stordFilePath = EgovProperties.getProperty("Globals.fileStorePath");
|
||||
String orginFileName = file.getOriginalFilename();
|
||||
|
||||
int index = orginFileName.lastIndexOf(".");
|
||||
//String fileName = orginFileName.substring(0, _index);
|
||||
String fileExt = orginFileName.substring(index + 1);
|
||||
long size = file.getSize();
|
||||
|
||||
//newName 은 Naming Convention에 의해서 생성
|
||||
newName = getTimeStamp(); // 2012.11 KISA 보안조치
|
||||
writeFile(file, newName, stordFilePath);
|
||||
//storedFilePath는 지정
|
||||
map.put(Globals.ORIGIN_FILE_NM, orginFileName);
|
||||
map.put(Globals.UPLOAD_FILE_NM, newName);
|
||||
map.put(Globals.FILE_EXT, fileExt);
|
||||
map.put(Globals.FILE_PATH, stordFilePath);
|
||||
map.put(Globals.FILE_SIZE, String.valueOf(size));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 실제 물리적인 경로에 생성한다.
|
||||
*
|
||||
* @param file
|
||||
* @param newName
|
||||
* @param stordFilePath
|
||||
* @throws Exception
|
||||
*/
|
||||
protected static void writeFile(MultipartFile file, String newName, String stordFilePath) throws Exception {
|
||||
InputStream stream = null;
|
||||
OutputStream bos = null;
|
||||
|
||||
try {
|
||||
stream = file.getInputStream();
|
||||
File cFile = new File(EgovWebUtil.filePathBlackList(stordFilePath));
|
||||
|
||||
if (!cFile.isDirectory())
|
||||
cFile.mkdir();
|
||||
|
||||
bos = new FileOutputStream(EgovWebUtil.filePathBlackList(stordFilePath + File.separator + newName));
|
||||
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[BUFF_SIZE];
|
||||
|
||||
while ((bytesRead = stream.read(buffer, 0, BUFF_SIZE)) != -1) {
|
||||
bos.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(bos, stream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버 파일에 대하여 다운로드를 처리한다.
|
||||
*
|
||||
* @param response
|
||||
* @param streFileNm 파일저장 경로가 포함된 형태
|
||||
* @param orignFileNm
|
||||
* @throws Exception
|
||||
*/
|
||||
public void downFile(HttpServletResponse response, String streFileNm, String orignFileNm) throws Exception {
|
||||
String downFileName = streFileNm;
|
||||
String orgFileName = orignFileNm;
|
||||
|
||||
File file = new File(downFileName);
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
int fSize = (int) file.length();
|
||||
if (fSize > 0) {
|
||||
BufferedInputStream in = null;
|
||||
|
||||
try {
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
String mimetype = "application/x-msdownload";
|
||||
|
||||
//response.setBufferSize(fSize);
|
||||
response.setContentType(mimetype);
|
||||
response.setHeader("Content-Disposition:", "attachment; filename=" + orgFileName);
|
||||
response.setContentLength(fSize);
|
||||
//response.setHeader("Content-Transfer-Encoding","binary");
|
||||
//response.setHeader("Pragma","no-cache");
|
||||
//response.setHeader("Expires","0");
|
||||
FileCopyUtils.copy(in, response.getOutputStream());
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(in);
|
||||
}
|
||||
response.getOutputStream().flush();
|
||||
response.getOutputStream().close();
|
||||
}
|
||||
|
||||
/*
|
||||
String uploadPath = propertiesService.getString("fileDir");
|
||||
|
||||
File uFile = new File(uploadPath, requestedFile);
|
||||
int fSize = (int) uFile.length();
|
||||
|
||||
if (fSize > 0) {
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile));
|
||||
|
||||
String mimetype = "text/html";
|
||||
|
||||
//response.setBufferSize(fSize);
|
||||
response.setContentType(mimetype);
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + requestedFile + "\"");
|
||||
response.setContentLength(fSize);
|
||||
|
||||
FileCopyUtils.copy(in, response.getOutputStream());
|
||||
in.close();
|
||||
response.getOutputStream().flush();
|
||||
response.getOutputStream().close();
|
||||
} else {
|
||||
response.setContentType("text/html");
|
||||
PrintWriter printwriter = response.getWriter();
|
||||
printwriter.println("<html>");
|
||||
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + requestedFile + "</h2>");
|
||||
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
|
||||
printwriter.println("<br><br><br>© webAccess");
|
||||
printwriter.println("</html>");
|
||||
printwriter.flush();
|
||||
printwriter.close();
|
||||
}
|
||||
//*/
|
||||
|
||||
/*
|
||||
response.setContentType("application/x-msdownload");
|
||||
response.setHeader("Content-Disposition:", "attachment; filename=" + new String(orgFileName.getBytes(),"UTF-8" ));
|
||||
response.setHeader("Content-Transfer-Encoding","binary");
|
||||
response.setHeader("Pragma","no-cache");
|
||||
response.setHeader("Expires","0");
|
||||
|
||||
BufferedInputStream fin = new BufferedInputStream(new FileInputStream(file));
|
||||
BufferedOutputStream outs = new BufferedOutputStream(response.getOutputStream());
|
||||
int read = 0;
|
||||
|
||||
while ((read = fin.read(b)) != -1) {
|
||||
outs.write(b,0,read);
|
||||
}
|
||||
log.debug(this.getClass().getName()+" BufferedOutputStream Write Complete!!! ");
|
||||
|
||||
outs.close();
|
||||
fin.close();
|
||||
//*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 컴포넌트 utl.fcc 패키지와 Dependency제거를 위해 내부 메서드로 추가 정의함
|
||||
* 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
|
||||
*
|
||||
* @param
|
||||
* @return Timestamp 값
|
||||
* @see
|
||||
*/
|
||||
private static String getTimeStamp() {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
|
||||
String pattern = "yyyyMMddhhmmssSSS";
|
||||
|
||||
SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
rtnStr = sdfCurrent.format(ts.getTime());
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
}
|
||||
178
src/main/java/egovframework/com/cmm/service/EgovProperties.java
Normal file
178
src/main/java/egovframework/com/cmm/service/EgovProperties.java
Normal file
@@ -0,0 +1,178 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import egovframework.com.cmm.EgovWebUtil;
|
||||
import egovframework.com.cmm.util.EgovResourceCloseHelper;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Class Name : EgovProperties.java
|
||||
* Description : UTF-8 기반 properties 읽기 전용 수정 버전
|
||||
*/
|
||||
public class EgovProperties {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovProperties.class);
|
||||
|
||||
// 파일구분자
|
||||
final static String FILE_SEPARATOR = System.getProperty("file.separator");
|
||||
|
||||
// 프로퍼티 파일의 물리적 위치
|
||||
public static final String RELATIVE_PATH_PREFIX =
|
||||
EgovProperties.class.getResource("").getPath()
|
||||
.substring(0, EgovProperties.class.getResource("").getPath().lastIndexOf("com"));
|
||||
|
||||
public static final String GLOBALS_PROPERTIES_FILE =
|
||||
RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + "globals.properties";
|
||||
|
||||
/**
|
||||
* UTF-8 로 Properties 를 읽는 공통 메서드
|
||||
*/
|
||||
private static Properties loadProperties(String filePath) throws IOException {
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = null;
|
||||
|
||||
try {
|
||||
fis = new FileInputStream(EgovWebUtil.filePathBlackList(filePath));
|
||||
props.load(new InputStreamReader(new BufferedInputStream(fis), "UTF-8"));
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* Globals 전용 상대경로 프로퍼티 → 절대경로 변환
|
||||
*/
|
||||
public static String getPathProperty(String keyName) {
|
||||
LOGGER.debug("getPathProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName);
|
||||
|
||||
try {
|
||||
Properties props = loadProperties(GLOBALS_PROPERTIES_FILE);
|
||||
|
||||
String value = props.getProperty(keyName);
|
||||
if (value == null) return "";
|
||||
|
||||
value = value.trim();
|
||||
return RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + value;
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Property file IO exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Globals 전용 프로퍼티 가져오기
|
||||
*/
|
||||
public static String getProperty(String keyName) {
|
||||
LOGGER.debug("getProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName);
|
||||
|
||||
try {
|
||||
Properties props = loadProperties(GLOBALS_PROPERTIES_FILE);
|
||||
String value = props.getProperty(keyName);
|
||||
|
||||
if (value == null) return "";
|
||||
return value.trim();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Property file IO exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본값 제공 버전
|
||||
*/
|
||||
public static String getPropertyByDefault(String keyName, String defaultValue) {
|
||||
LOGGER.debug("getProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName);
|
||||
|
||||
try {
|
||||
Properties props = loadProperties(GLOBALS_PROPERTIES_FILE);
|
||||
|
||||
String value = props.getProperty(keyName);
|
||||
if (value == null) return defaultValue;
|
||||
|
||||
return value.trim();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Property file IO exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 파일에서 상대경로 프로퍼티 읽기
|
||||
*/
|
||||
public static String getPathProperty(String fileName, String key) {
|
||||
try {
|
||||
Properties props = loadProperties(fileName);
|
||||
String value = props.getProperty(key);
|
||||
|
||||
if (value == null) return "";
|
||||
|
||||
return RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + value;
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Property file IO exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 파일에서 지정 키값 읽기
|
||||
*/
|
||||
public static String getProperty(String fileName, String key) {
|
||||
try {
|
||||
Properties props = loadProperties(fileName);
|
||||
String value = props.getProperty(key);
|
||||
|
||||
if (value == null) return "";
|
||||
return value.trim();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Property file IO exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로퍼티 파일 전체 key-value 리스트 반환
|
||||
*/
|
||||
public static ArrayList<Map<String, String>> loadPropertyFile(String property) {
|
||||
ArrayList<Map<String, String>> keyList = new ArrayList<>();
|
||||
FileInputStream fis = null;
|
||||
|
||||
String src = property.replace('\\', File.separatorChar).replace('/', File.separatorChar);
|
||||
|
||||
try {
|
||||
File srcFile = new File(EgovWebUtil.filePathBlackList(src));
|
||||
if (!srcFile.exists()) {
|
||||
return keyList;
|
||||
}
|
||||
|
||||
Properties props = loadProperties(src);
|
||||
|
||||
Enumeration<?> plist = props.propertyNames();
|
||||
while (plist.hasMoreElements()) {
|
||||
String key = (String) plist.nextElement();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(key, props.getProperty(key));
|
||||
keyList.add(map);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return keyList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EgovUserDetailsService {
|
||||
|
||||
/**
|
||||
* 인증된 사용자객체를 VO형식으로 가져온다.
|
||||
* @return Object - 사용자 ValueObject
|
||||
*/
|
||||
public Object getAuthenticatedUser();
|
||||
|
||||
/**
|
||||
* 인증된 사용자의 권한 정보를 가져온다.
|
||||
* 예) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY]
|
||||
* @return List - 사용자 권한정보 목록
|
||||
*/
|
||||
public List<String> getAuthorities();
|
||||
|
||||
/**
|
||||
* 인증된 사용자 여부를 체크한다.
|
||||
* @return Boolean - 인증된 사용자 여부(TRUE / FALSE)
|
||||
*/
|
||||
public Boolean isAuthenticated();
|
||||
|
||||
}
|
||||
240
src/main/java/egovframework/com/cmm/service/FileVO.java
Normal file
240
src/main/java/egovframework/com/cmm/service/FileVO.java
Normal file
@@ -0,0 +1,240 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : FileVO.java
|
||||
* @Description : 파일정보 처리를 위한 VO 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FileVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 첨부파일 아이디
|
||||
*/
|
||||
public String atchFileId = "";
|
||||
/**
|
||||
* 생성일자
|
||||
*/
|
||||
public String creatDt = "";
|
||||
/**
|
||||
* 파일내용
|
||||
*/
|
||||
public String fileCn = "";
|
||||
/**
|
||||
* 파일확장자
|
||||
*/
|
||||
public String fileExtsn = "";
|
||||
/**
|
||||
* 파일크기
|
||||
*/
|
||||
public String fileMg = "";
|
||||
/**
|
||||
* 파일연번
|
||||
*/
|
||||
public String fileSn = "";
|
||||
/**
|
||||
* 파일저장경로
|
||||
*/
|
||||
public String fileStreCours = "";
|
||||
/**
|
||||
* 원파일명
|
||||
*/
|
||||
public String orignlFileNm = "";
|
||||
/**
|
||||
* 저장파일명
|
||||
*/
|
||||
public String streFileNm = "";
|
||||
|
||||
/**
|
||||
* atchFileId attribute를 리턴한다.
|
||||
*
|
||||
* @return the atchFileId
|
||||
*/
|
||||
public String getAtchFileId() {
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* atchFileId attribute 값을 설정한다.
|
||||
*
|
||||
* @param atchFileId
|
||||
* the atchFileId to set
|
||||
*/
|
||||
public void setAtchFileId(String atchFileId) {
|
||||
this.atchFileId = atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute를 리턴한다.
|
||||
*
|
||||
* @return the creatDt
|
||||
*/
|
||||
public String getCreatDt() {
|
||||
return creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute 값을 설정한다.
|
||||
*
|
||||
* @param creatDt
|
||||
* the creatDt to set
|
||||
*/
|
||||
public void setCreatDt(String creatDt) {
|
||||
this.creatDt = creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileCn
|
||||
*/
|
||||
public String getFileCn() {
|
||||
return fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileCn
|
||||
* the fileCn to set
|
||||
*/
|
||||
public void setFileCn(String fileCn) {
|
||||
this.fileCn = fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileExtsn
|
||||
*/
|
||||
public String getFileExtsn() {
|
||||
return fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileExtsn
|
||||
* the fileExtsn to set
|
||||
*/
|
||||
public void setFileExtsn(String fileExtsn) {
|
||||
this.fileExtsn = fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileMg
|
||||
*/
|
||||
public String getFileMg() {
|
||||
return fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileMg
|
||||
* the fileMg to set
|
||||
*/
|
||||
public void setFileMg(String fileMg) {
|
||||
this.fileMg = fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileSn
|
||||
*/
|
||||
public String getFileSn() {
|
||||
return fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileSn
|
||||
* the fileSn to set
|
||||
*/
|
||||
public void setFileSn(String fileSn) {
|
||||
this.fileSn = fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileStreCours
|
||||
*/
|
||||
public String getFileStreCours() {
|
||||
return fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileStreCours
|
||||
* the fileStreCours to set
|
||||
*/
|
||||
public void setFileStreCours(String fileStreCours) {
|
||||
this.fileStreCours = fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the orignlFileNm
|
||||
*/
|
||||
public String getOrignlFileNm() {
|
||||
return orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param orignlFileNm
|
||||
* the orignlFileNm to set
|
||||
*/
|
||||
public void setOrignlFileNm(String orignlFileNm) {
|
||||
this.orignlFileNm = orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the streFileNm
|
||||
*/
|
||||
public String getStreFileNm() {
|
||||
return streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param streFileNm
|
||||
* the streFileNm to set
|
||||
*/
|
||||
public void setStreFileNm(String streFileNm) {
|
||||
this.streFileNm = streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString 메소드를 대치한다.
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
}
|
||||
58
src/main/java/egovframework/com/cmm/service/Globals.java
Normal file
58
src/main/java/egovframework/com/cmm/service/Globals.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
/**
|
||||
* Class Name : Globals.java
|
||||
* Description : 시스템 구동 시 프로퍼티를 통해 사용될 전역변수를 정의한다.
|
||||
* Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.19 박지욱 최초 생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 박지욱
|
||||
* @since 2009. 01. 19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
public class Globals {
|
||||
//OS 유형
|
||||
public static final String OS_TYPE = EgovProperties.getProperty("Globals.OsType");
|
||||
//DB 유형
|
||||
public static final String DB_TYPE = EgovProperties.getProperty("Globals.DbType");
|
||||
//메인 페이지
|
||||
public static final String MAIN_PAGE = EgovProperties.getProperty("Globals.MainPage");
|
||||
//ShellFile 경로
|
||||
public static final String SHELL_FILE_PATH = EgovProperties.getPathProperty("Globals.ShellFilePath");
|
||||
//퍼로퍼티 파일 위치
|
||||
public static final String CONF_PATH = EgovProperties.getPathProperty("Globals.ConfPath");
|
||||
//Server정보 프로퍼티 위치
|
||||
public static final String SERVER_CONF_PATH = EgovProperties.getPathProperty("Globals.ServerConfPath");
|
||||
//Client정보 프로퍼티 위치
|
||||
public static final String CLIENT_CONF_PATH = EgovProperties.getPathProperty("Globals.ClientConfPath");
|
||||
//파일포맷 정보 프로퍼티 위치
|
||||
public static final String FILE_FORMAT_PATH = EgovProperties.getPathProperty("Globals.FileFormatPath");
|
||||
|
||||
//파일 업로드 원 파일명
|
||||
public static final String ORIGIN_FILE_NM = "originalFileName";
|
||||
//파일 확장자
|
||||
public static final String FILE_EXT = "fileExtension";
|
||||
//파일크기
|
||||
public static final String FILE_SIZE = "fileSize";
|
||||
//업로드된 파일명
|
||||
public static final String UPLOAD_FILE_NM = "uploadFileName";
|
||||
//파일경로
|
||||
public static final String FILE_PATH = "filePath";
|
||||
|
||||
//메일발송요청 XML파일경로
|
||||
public static final String MAIL_REQUEST_PATH = EgovProperties.getPathProperty("Globals.MailRequestPath");
|
||||
//메일발송응답 XML파일경로
|
||||
public static final String MAIL_RESPONSE_PATH = EgovProperties.getPathProperty("Globals.MailRResponsePath");
|
||||
|
||||
// G4C 연결용 IP (localhost)
|
||||
public static final String LOCAL_IP = EgovProperties.getProperty("Globals.LocalIp");
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
import egovframework.com.cmm.service.CmmnDetailCode;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Class Name : CmmUseDAO.java
|
||||
* @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 데이터 접근 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 11. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 11.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Repository("cmmUseDAO")
|
||||
public class CmmUseDAO extends EgovComAbstractDAO {
|
||||
|
||||
/**
|
||||
* 주어진 조건에 따른 공통코드를 불러온다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectCmmCodeDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드로 사용할 조직정보를 를 불러온다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectOgrnztIdDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드로 사용할그룹정보를 를 불러온다.
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectGroupIdDetail", vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
import egovframework.com.cmm.service.CmmnDetailCode;
|
||||
import egovframework.com.cmm.service.EgovCmmUseService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovCmmUseServiceImpl.java
|
||||
* @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 서비스 구현 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 11. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 11.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Service("EgovCmmUseService")
|
||||
public class EgovCmmUseServiceImpl extends EgovAbstractServiceImpl implements EgovCmmUseService {
|
||||
|
||||
@Resource(name = "cmmUseDAO")
|
||||
private CmmUseDAO cmmUseDAO;
|
||||
|
||||
/**
|
||||
* 공통코드를 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectCmmCodeDetail(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다.
|
||||
*
|
||||
* @param voList
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception {
|
||||
ComDefaultCodeVO vo;
|
||||
Map<String, List<CmmnDetailCode>> map = new HashMap<String, List<CmmnDetailCode>>();
|
||||
|
||||
Iterator<?> iter = voList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (ComDefaultCodeVO)iter.next();
|
||||
map.put(vo.getCodeId(), cmmUseDAO.selectCmmCodeDetail(vo));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 조직정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 조직정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectOgrnztIdDetail(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 그룹정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectGroupIdDetail(vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractDAO;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
/**
|
||||
* EgovComAbstractDAO.java 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011. 9. 23.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011. 9. 23. 서준식 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
public abstract class EgovComAbstractDAO extends EgovAbstractDAO{
|
||||
|
||||
@Resource(name="egov.sqlMapClient")
|
||||
public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {
|
||||
super.setSuperSqlMapClient(sqlMapClient);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngServiceImpl.java
|
||||
* @Description : 파일정보의 관리를 위한 구현 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Service("EgovFileMngService")
|
||||
public class EgovFileMngServiceImpl extends EgovAbstractServiceImpl implements EgovFileMngService {
|
||||
|
||||
@Resource(name = "FileManageDAO")
|
||||
private FileManageDAO fileMngDAO;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInfs(java.util.List)
|
||||
*/
|
||||
public void deleteFileInfs(List<?> fvoList) throws Exception {
|
||||
fileMngDAO.deleteFileInfs(fvoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#insertFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public String insertFileInf(FileVO fvo) throws Exception {
|
||||
String atchFileId = fvo.getAtchFileId();
|
||||
|
||||
fileMngDAO.insertFileInf(fvo);
|
||||
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#insertFileInfs(java.util.List)
|
||||
*/
|
||||
public String insertFileInfs(List<?> fvoList) throws Exception {
|
||||
String atchFileId = "";
|
||||
|
||||
if (fvoList.size() != 0) {
|
||||
atchFileId = fileMngDAO.insertFileInfs(fvoList);
|
||||
}
|
||||
if (atchFileId == "") {
|
||||
atchFileId = null;
|
||||
}
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInfs(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public List<FileVO> selectFileInfs(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.selectFileInfs(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#updateFileInfs(java.util.List)
|
||||
*/
|
||||
public void updateFileInfs(List<?> fvoList) throws Exception {
|
||||
//Delete & Insert
|
||||
fileMngDAO.updateFileInfs(fvoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public void deleteFileInf(FileVO fvo) throws Exception {
|
||||
fileMngDAO.deleteFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.selectFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#getMaxFileSN(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.getMaxFileSN(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteAllFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception {
|
||||
fileMngDAO.deleteAllFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileListByFileNm(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public Map<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception {
|
||||
List<FileVO> result = fileMngDAO.selectFileListByFileNm(fvo);
|
||||
int cnt = fileMngDAO.selectFileListCntByFileNm(fvo);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("resultList", result);
|
||||
map.put("resultCnt", Integer.toString(cnt));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectImageFileList(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
|
||||
return fileMngDAO.selectImageFileList(vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.service.EgovUserDetailsService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011. 8. 12.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* 개정이력(Modification Information)
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011. 8. 12. 서준식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovTestUserDetailsServiceImpl extends EgovAbstractServiceImpl implements
|
||||
EgovUserDetailsService {
|
||||
|
||||
@Override
|
||||
public Object getAuthenticatedUser() {
|
||||
|
||||
LoginVO loginVO = new LoginVO();
|
||||
loginVO.setId("TEST1");
|
||||
loginVO.setPassword("raHLBnHFcunwNzcDcfad4PhD11hHgXSUr7fc1Jk9uoQ=");
|
||||
loginVO.setUserSe("USR");
|
||||
loginVO.setEmail("egovframe@nia.or.kr");
|
||||
loginVO.setIhidNum("");
|
||||
loginVO.setName("더미사용자");
|
||||
loginVO.setOrgnztId("ORGNZT_0000000000000");
|
||||
loginVO.setUniqId("USRCNFRM_00000000000");
|
||||
return loginVO;
|
||||
|
||||
// return
|
||||
// RequestContextHolder.getRequestAttributes().getAttribute("loginVO",
|
||||
// RequestAttributes.SCOPE_SESSION);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAuthorities() {
|
||||
|
||||
// 권한 설정을 리턴한다.
|
||||
|
||||
List<String> listAuth = new ArrayList<String>();
|
||||
listAuth.add("IS_AUTHENTICATED_ANONYMOUSLY");
|
||||
listAuth.add("IS_AUTHENTICATED_FULLY");
|
||||
listAuth.add("IS_AUTHENTICATED_REMEMBERED");
|
||||
listAuth.add("ROLE_ADMIN");
|
||||
listAuth.add("ROLE_ANONYMOUS");
|
||||
listAuth.add("ROLE_RESTRICTED");
|
||||
listAuth.add("ROLE_USER");
|
||||
|
||||
return listAuth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isAuthenticated() {
|
||||
// 인증된 유저인지 확인한다.
|
||||
|
||||
/*if (RequestContextHolder.getRequestAttributes() == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes().getAttribute(
|
||||
"loginVO", RequestAttributes.SCOPE_SESSION) == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.service.EgovUserDetailsService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011. 6. 25.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* 개정이력(Modification Information)
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011. 8. 12. 서준식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovUserDetailsSessionServiceImpl extends EgovAbstractServiceImpl implements EgovUserDetailsService {
|
||||
|
||||
public Object getAuthenticatedUser() {
|
||||
if (RequestContextHolder.getRequestAttributes() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return RequestContextHolder.getRequestAttributes().getAttribute("loginVO", RequestAttributes.SCOPE_SESSION);
|
||||
|
||||
}
|
||||
|
||||
public List<String> getAuthorities() {
|
||||
|
||||
// 권한 설정을 리턴한다.
|
||||
List<String> listAuth = new ArrayList<String>();
|
||||
|
||||
return listAuth;
|
||||
}
|
||||
|
||||
public Boolean isAuthenticated() {
|
||||
// 인증된 유저인지 확인한다.
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes() == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes().getAttribute("loginVO", RequestAttributes.SCOPE_SESSION) == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngDAO.java
|
||||
* @Description : 파일정보 관리를 위한 데이터 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Repository("FileManageDAO")
|
||||
public class FileManageDAO extends EgovComAbstractDAO {
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInfs(List<?> fileList) throws Exception {
|
||||
FileVO vo = (FileVO) fileList.get(0);
|
||||
String atchFileId = vo.getAtchFileId();
|
||||
|
||||
insert("FileManageDAO.insertFileMaster", vo);
|
||||
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param vo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void insertFileInf(FileVO vo) throws Exception {
|
||||
insert("FileManageDAO.insertFileMaster", vo);
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateFileInfs(List<?> fileList) throws Exception {
|
||||
FileVO vo;
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInfs(List<?> fileList) throws Exception {
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
FileVO vo;
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
|
||||
delete("FileManageDAO.deleteFileDetail", vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInf(FileVO fvo) throws Exception {
|
||||
delete("FileManageDAO.deleteFileDetail", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectFileInfs(FileVO vo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectFileList", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception {
|
||||
return (Integer) select("FileManageDAO.getMaxFileSN", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception {
|
||||
return (FileVO) select("FileManageDAO.selectFileInf", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception {
|
||||
update("FileManageDAO.deleteCOMTNFILE", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectFileListByFileNm(FileVO fvo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectFileListByFileNm", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록 전체 건수를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int selectFileListCntByFileNm(FileVO fvo) throws Exception {
|
||||
return (Integer) select("FileManageDAO.selectFileListCntByFileNm", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectImageFileList", vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package egovframework.com.cmm.taglibs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.util.EgovDoubleSubmitHelper;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* TagSupport to support to double submit preventer
|
||||
* @author Vincent Han
|
||||
* @since 2014.08.07
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.08.07 표준프레임워크센터 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class DoubleSubmitTag extends TagSupport {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DoubleSubmitTag.class);
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 5242217605452312594L;
|
||||
|
||||
private String tokenKey = EgovDoubleSubmitHelper.DEFAULT_TOKEN_KEY;
|
||||
|
||||
public String getTokenKey() {
|
||||
return tokenKey;
|
||||
}
|
||||
|
||||
public void setTokenKey(String tokenKey) {
|
||||
this.tokenKey = tokenKey;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public int doStartTag() throws JspException {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
|
||||
HttpSession session = request.getSession();
|
||||
|
||||
Map<String, String> map = null;
|
||||
|
||||
if (session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY) == null) {
|
||||
map = new HashMap<String, String>();
|
||||
|
||||
session.setAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY, map);
|
||||
} else {
|
||||
map = (Map<String, String>) session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY);
|
||||
}
|
||||
|
||||
// First call (check session)
|
||||
if (map.get(tokenKey) == null) {
|
||||
|
||||
map.put(tokenKey, EgovDoubleSubmitHelper.getNewUUID());
|
||||
|
||||
LOGGER.debug("[Double Submit] session token created({}) : {}", tokenKey, map.get(tokenKey));
|
||||
}
|
||||
|
||||
buffer.append("<input type='hidden' name='").append(EgovDoubleSubmitHelper.PARAMETER_NAME).append("' value='").append(map.get(tokenKey)).append("'/>");
|
||||
|
||||
try {
|
||||
pageContext.getOut().print(buffer.toString());
|
||||
} catch (IOException e) {
|
||||
throw new JspTagException("Error: IOException while writing to the user");
|
||||
}
|
||||
|
||||
return SKIP_BODY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Utility class to support to logging information
|
||||
* @author Vincent Han
|
||||
* @since 2014.09.18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.09.18 표준프레임워크센터 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovBasicLogger {
|
||||
private static final Level IGNORE_INFO_LEVEL = Level.OFF;
|
||||
private static final Level DEBUG_INFO_LEVEL = Level.FINEST;
|
||||
private static final Level INFO_INFO_LEVEL = Level.INFO;
|
||||
|
||||
private static final Logger ignoreLogger = Logger.getLogger("ignore");
|
||||
private static final Logger debugLogger = Logger.getLogger("debug");
|
||||
private static final Logger infoLogger = Logger.getLogger("info");
|
||||
|
||||
/**
|
||||
* 기록이나 처리가 불필요한 경우 사용.
|
||||
* @param message
|
||||
* @param exception
|
||||
*/
|
||||
public static void ignore(String message, Exception exception) {
|
||||
if (exception == null) {
|
||||
ignoreLogger.log(IGNORE_INFO_LEVEL, message);
|
||||
} else {
|
||||
ignoreLogger.log(IGNORE_INFO_LEVEL, message, exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 기록이나 처리가 불필요한 경우 사용.
|
||||
* @param message
|
||||
* @param exception
|
||||
*/
|
||||
public static void ignore(String message) {
|
||||
ignore(message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 디버그 정보를 기록하는 경우 사용.
|
||||
* @param message
|
||||
* @param exception
|
||||
*/
|
||||
public static void debug(String message, Exception exception) {
|
||||
if (exception == null) {
|
||||
debugLogger.log(DEBUG_INFO_LEVEL, message);
|
||||
} else {
|
||||
debugLogger.log(DEBUG_INFO_LEVEL, message, exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 디버그 정보를 기록하는 경우 사용.
|
||||
* @param message
|
||||
* @param exception
|
||||
*/
|
||||
public static void debug(String message) {
|
||||
debug(message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일반적이 정보를 기록하는 경우 사용.
|
||||
* @param message
|
||||
* @param exception
|
||||
*/
|
||||
public static void info(String message) {
|
||||
infoLogger.log(INFO_INFO_LEVEL, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
/**
|
||||
* Utility class to support to double submit preventer
|
||||
* @author Vincent Han
|
||||
* @since 2014.08.07
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.08.07 표준프레임워크센터 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovDoubleSubmitHelper {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovDoubleSubmitHelper.class);
|
||||
|
||||
public final static String SESSION_TOKEN_KEY = "egovframework.double.submit.preventer.session.key";
|
||||
|
||||
public final static String PARAMETER_NAME = "egovframework.double.submit.preventer.parameter.name";
|
||||
|
||||
public final static String DEFAULT_TOKEN_KEY = "DEFAULT";
|
||||
|
||||
public static String getNewUUID() {
|
||||
return UUID.randomUUID().toString().toUpperCase();
|
||||
}
|
||||
|
||||
public static boolean checkAndSaveToken() {
|
||||
return checkAndSaveToken(DEFAULT_TOKEN_KEY);
|
||||
}
|
||||
|
||||
public static boolean checkAndSaveToken(String tokenKey) {
|
||||
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
HttpSession session = request.getSession();
|
||||
|
||||
// check session...
|
||||
if (session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY) == null) {
|
||||
throw new RuntimeException("Double Submit Preventer TagLig isn't set. Check JSP.");
|
||||
}
|
||||
|
||||
String parameter = request.getParameter(EgovDoubleSubmitHelper.PARAMETER_NAME);
|
||||
|
||||
// check parameter
|
||||
if (parameter == null) {
|
||||
throw new RuntimeException("Double Submit Preventer parameter isn't set. Check JSP.");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> map = (Map<String, String>) session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY);
|
||||
|
||||
if (parameter.equals(map.get(tokenKey))) {
|
||||
|
||||
LOGGER.debug("[Double Submit] session token ({}) equals to parameter token.", tokenKey);
|
||||
|
||||
map.put(tokenKey, getNewUUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGGER.debug("[Double Submit] session token ({}) isn't equal to parameter token.", tokenKey);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovHttpRequestHelper.java
|
||||
* @Description : HTTP Request 정보 취득 Helper 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2014.09.11 표준프레임워크 최초생성
|
||||
* @author Vincent Han
|
||||
* @since 2014.09.11
|
||||
* @version 3.5
|
||||
* @see <pre>
|
||||
* web.xml 상에 다음과 같은 Listener 등록 필요
|
||||
* <listener>
|
||||
* <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
|
||||
* </listener>
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovHttpRequestHelper {
|
||||
|
||||
public static boolean isInHttpRequest() {
|
||||
try {
|
||||
getCurrentRequest();
|
||||
} catch (IllegalStateException ise) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static HttpServletRequest getCurrentRequest() {
|
||||
ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
|
||||
|
||||
return sra.getRequest();
|
||||
}
|
||||
|
||||
public static String getRequestIp() {
|
||||
return getCurrentRequest().getRemoteAddr();
|
||||
}
|
||||
|
||||
public static String getRequestURI() {
|
||||
return getCurrentRequest().getRequestURI();
|
||||
}
|
||||
|
||||
public static HttpSession getCurrentSession() {
|
||||
return getCurrentRequest().getSession();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Wrapper;
|
||||
|
||||
/**
|
||||
* Utility class to support to close resources
|
||||
* @author Vincent Han
|
||||
* @since 2014.09.18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.09.18 표준프레임워크센터 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovResourceCloseHelper {
|
||||
/**
|
||||
* Resource close 처리.
|
||||
* @param resources
|
||||
*/
|
||||
public static void close(Closeable ... resources) {
|
||||
for (Closeable resource : resources) {
|
||||
if (resource != null) {
|
||||
try {
|
||||
resource.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JDBC 관련 resource 객체 close 처리
|
||||
* @param objects
|
||||
*/
|
||||
public static void closeDBObjects(Wrapper ... objects) {
|
||||
for (Object object : objects) {
|
||||
if (object != null) {
|
||||
if (object instanceof ResultSet) {
|
||||
try {
|
||||
((ResultSet)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else if (object instanceof Statement) {
|
||||
try {
|
||||
((Statement)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else if (object instanceof Connection) {
|
||||
try {
|
||||
((Connection)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Wrapper type is not found : " + object.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Socket 관련 resource 객체 close 처리
|
||||
* @param objects
|
||||
*/
|
||||
public static void closeSocketObjects(Socket socket, ServerSocket server) {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.shutdownOutput();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!");
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (server != null) {
|
||||
try {
|
||||
server.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Socket 관련 resource 객체 close 처리
|
||||
*
|
||||
* @param sockets
|
||||
*/
|
||||
public static void closeSockets(Socket ... sockets) {
|
||||
for (Socket socket : sockets) {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.shutdownOutput();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!");
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
/**
|
||||
* @Class Name : UrlRewriteFilter.java
|
||||
* @Description : UrlRewriteFilter Class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ --------- --------- -------------------------------
|
||||
* @ 2014.09.30 최초생성
|
||||
*
|
||||
* @author 전자정부 표준프레임워크 유지보수
|
||||
* @since 2014. 09.30
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* Copyright (C) by MOPAS All right reserved.
|
||||
*/
|
||||
public class EgovUrlRewriteFilter implements Filter {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private FilterConfig config;
|
||||
|
||||
private String targetURI;
|
||||
private String httpsPort;
|
||||
private String httpPort;
|
||||
|
||||
private String[] uriPatterns;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
|
||||
String delimiter = ",";
|
||||
this.config = config;
|
||||
|
||||
this.targetURI = config.getInitParameter("targetURI");
|
||||
this.httpsPort = config.getInitParameter("httpsPort");
|
||||
this.httpPort = config.getInitParameter("httpPort");
|
||||
|
||||
this.uriPatterns = targetURI.split(delimiter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
|
||||
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
|
||||
String uri = req.getRequestURI();
|
||||
String getProtocol = req.getScheme();
|
||||
String getDomain = req.getServerName();
|
||||
|
||||
AntPathMatcher pm = new AntPathMatcher();
|
||||
|
||||
for (String uriPattern : uriPatterns) {
|
||||
|
||||
if (pm.match(uriPattern.trim(), uri)) {
|
||||
|
||||
if (getProtocol.toLowerCase().equals("http")) {
|
||||
|
||||
response.setContentType("text/html");
|
||||
|
||||
String httpsPath = "https" + "://" + getDomain + ":" + httpsPort + uri;
|
||||
String site = new String(httpsPath);
|
||||
res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
|
||||
res.setHeader("Location", site);
|
||||
|
||||
}
|
||||
|
||||
}else if(getProtocol.toLowerCase().equals("https")){
|
||||
|
||||
response.setContentType("text/html");
|
||||
|
||||
String httpPath = "http" + "://" + getDomain + ":" + httpPort + uri;
|
||||
|
||||
String site = new String(httpPath);
|
||||
res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
|
||||
res.setHeader("Location", site);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
chain.doFilter(req, res);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
this.targetURI = null;
|
||||
this.httpsPort = null;
|
||||
this.httpPort = null;
|
||||
this.uriPatterns = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.service.EgovUserDetailsService;
|
||||
|
||||
/**
|
||||
* EgovUserDetails Helper 클래스
|
||||
*
|
||||
* @author sjyoon
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2009.03.10 sjyoon 최초 생성
|
||||
* 2011.07.01 서준식 interface 생성후 상세 로직의 분리
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovUserDetailsHelper {
|
||||
|
||||
static EgovUserDetailsService egovUserDetailsService;
|
||||
|
||||
public EgovUserDetailsService getEgovUserDetailsService() {
|
||||
return egovUserDetailsService;
|
||||
}
|
||||
|
||||
public void setEgovUserDetailsService(EgovUserDetailsService egovUserDetailsService) {
|
||||
EgovUserDetailsHelper.egovUserDetailsService = egovUserDetailsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 인증된 사용자객체를 VO형식으로 가져온다.
|
||||
* @return Object - 사용자 ValueObject
|
||||
*/
|
||||
public static Object getAuthenticatedUser() {
|
||||
return egovUserDetailsService.getAuthenticatedUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* 인증된 사용자의 권한 정보를 가져온다.
|
||||
*
|
||||
* @return List - 사용자 권한정보 목록
|
||||
*/
|
||||
public static List<String> getAuthorities() {
|
||||
return egovUserDetailsService.getAuthorities();
|
||||
}
|
||||
|
||||
/**
|
||||
* 인증된 사용자 여부를 체크한다.
|
||||
* @return Boolean - 인증된 사용자 여부(TRUE / FALSE)
|
||||
*/
|
||||
public static Boolean isAuthenticated() {
|
||||
return egovUserDetailsService.isAuthenticated();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.support.WebBindingInitializer;
|
||||
import org.springframework.web.context.request.WebRequest;
|
||||
|
||||
public class EgovBindingInitializer implements WebBindingInitializer {
|
||||
|
||||
|
||||
public void initBinder(WebDataBinder binder, WebRequest request) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
dateFormat.setLenient(false);
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
|
||||
binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
/**
|
||||
* 컴포넌트 설치 후 설치된 컴포넌트들을 IncludedInfo annotation을 통해 찾아낸 후
|
||||
* 화면에 표시할 정보를 처리하는 Controller 클래스
|
||||
* <Notice>
|
||||
* 개발시 메뉴 구조가 잡히기 전에 배포파일들에 포함된 공통 컴포넌트들의 목록성 화면에
|
||||
* URL을 제공하여 개발자가 편하게 활용하도록 하기 위해 작성된 것으로,
|
||||
* 실제 운영되는 시스템에서는 적용해서는 안 됨
|
||||
* 실 운영 시에는 삭제해서 배포해도 좋음
|
||||
* <Disclaimer>
|
||||
* 운영시에 본 컨트롤을 사용하여 메뉴를 구성하는 경우 성능 문제를 일으키거나
|
||||
* 사용자별 메뉴 구성에 오류를 발생할 수 있음
|
||||
* @author 공통컴포넌트 정진오
|
||||
* @since 2011.08.26
|
||||
* @version 2.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.08.26 정진오 최초 생성
|
||||
* 2011.09.16 서준식 컨텐츠 페이지 생성
|
||||
* 2011.09.26 이기하 header, footer 페이지 생성
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import egovframework.com.cmm.IncludedCompInfoVO;
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.annotation.IncludedInfo;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class EgovComIndexController implements ApplicationContextAware, InitializingBean {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComIndexController.class);
|
||||
|
||||
private Map<Integer, IncludedCompInfoVO> map;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
|
||||
LOGGER.info("EgovComIndexController setApplicationContext method has called!");
|
||||
}
|
||||
|
||||
@RequestMapping("/index.do")
|
||||
public String index(ModelMap model) {
|
||||
return "egovframework/com/cmm/EgovUnitMain";
|
||||
}
|
||||
|
||||
@RequestMapping("/EgovTop.do")
|
||||
public String top() {
|
||||
return "egovframework/com/cmm/EgovUnitTop";
|
||||
}
|
||||
|
||||
@RequestMapping("/EgovBottom.do")
|
||||
public String bottom() {
|
||||
return "egovframework/com/cmm/EgovUnitBottom";
|
||||
}
|
||||
|
||||
@RequestMapping("/EgovContent.do")
|
||||
public String setContent(ModelMap model) {
|
||||
|
||||
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
model.addAttribute("loginVO", loginVO);
|
||||
|
||||
return "egovframework/com/cmm/EgovUnitContent";
|
||||
}
|
||||
|
||||
@RequestMapping("/EgovLeft.do")
|
||||
public String setLeftMenu(ModelMap model) {
|
||||
|
||||
/* 최초 한 번만 실행하여 map에 저장해 놓는다. */
|
||||
if (map == null) {
|
||||
map = new TreeMap<Integer, IncludedCompInfoVO>();
|
||||
RequestMapping rmAnnotation;
|
||||
IncludedInfo annotation;
|
||||
IncludedCompInfoVO zooVO;
|
||||
|
||||
/*
|
||||
* EgovLoginController가 AOP Proxy되는 바람에 클래스를 reflection으로 가져올 수 없음
|
||||
*/
|
||||
try {
|
||||
Class<?> loginController = Class.forName("egovframework.com.uat.uia.web.EgovLoginController");
|
||||
Method[] methods = loginController.getMethods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
annotation = methods[i].getAnnotation(IncludedInfo.class);
|
||||
|
||||
if (annotation != null) {
|
||||
LOGGER.debug("Found @IncludedInfo Method : {}", methods[i]);
|
||||
zooVO = new IncludedCompInfoVO();
|
||||
zooVO.setName(annotation.name());
|
||||
zooVO.setOrder(annotation.order());
|
||||
zooVO.setGid(annotation.gid());
|
||||
|
||||
rmAnnotation = methods[i].getAnnotation(RequestMapping.class);
|
||||
if ("".equals(annotation.listUrl()) && rmAnnotation != null) {
|
||||
zooVO.setListUrl(rmAnnotation.value()[0]);
|
||||
} else {
|
||||
zooVO.setListUrl(annotation.listUrl());
|
||||
}
|
||||
map.put(zooVO.getOrder(), zooVO);
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOGGER.error("No egovframework.com.uat.uia.web.EgovLoginController!!");
|
||||
}
|
||||
/* 여기까지 AOP Proxy로 인한 코드 */
|
||||
|
||||
/*@Controller Annotation 처리된 클래스를 모두 찾는다.*/
|
||||
Map<String, Object> myZoos = applicationContext.getBeansWithAnnotation(Controller.class);
|
||||
LOGGER.debug("How many Controllers : ", myZoos.size());
|
||||
for (final Object myZoo : myZoos.values()) {
|
||||
Class<? extends Object> zooClass = myZoo.getClass();
|
||||
|
||||
Method[] methods = zooClass.getMethods();
|
||||
LOGGER.debug("Controller Detected {}", zooClass);
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
annotation = methods[i].getAnnotation(IncludedInfo.class);
|
||||
|
||||
if (annotation != null) {
|
||||
//LOG.debug("Found @IncludedInfo Method : " + methods[i] );
|
||||
zooVO = new IncludedCompInfoVO();
|
||||
zooVO.setName(annotation.name());
|
||||
zooVO.setOrder(annotation.order());
|
||||
zooVO.setGid(annotation.gid());
|
||||
/*
|
||||
* 목록형 조회를 위한 url 매핑은 @IncludedInfo나 @RequestMapping에서 가져온다
|
||||
*/
|
||||
rmAnnotation = methods[i].getAnnotation(RequestMapping.class);
|
||||
if ("".equals(annotation.listUrl())) {
|
||||
zooVO.setListUrl(rmAnnotation.value()[0]);
|
||||
} else {
|
||||
zooVO.setListUrl(annotation.listUrl());
|
||||
}
|
||||
|
||||
map.put(zooVO.getOrder(), zooVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.addAttribute("resultList", map.values());
|
||||
|
||||
LOGGER.debug("EgovComIndexController index is called ");
|
||||
|
||||
return "egovframework/com/cmm/EgovUnitLeft";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovComUtlController.java
|
||||
* @Description : 공통유틸리티성 작업을 위한 Controller
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------- -------- ---------------------------
|
||||
* @ 2009.03.02 조재영 최초 생성
|
||||
* @ 2011.10.07 이기하 .action -> .do로 변경하면서 동일 매핑이 되어 삭제처리
|
||||
*
|
||||
* @author 공통서비스 개발팀 조재영
|
||||
* @since 2009.03.02
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class EgovComUtlController {
|
||||
|
||||
//@Resource(name = "egovUserManageService")
|
||||
//private EgovUserManageService egovUserManageService;
|
||||
|
||||
/** EgovPropertyService */
|
||||
@Resource(name = "propertiesService")
|
||||
protected EgovPropertyService propertiesService;
|
||||
|
||||
/**
|
||||
* JSP 호출작업만 처리하는 공통 함수
|
||||
*/
|
||||
@RequestMapping(value="/EgovPageLink.do")
|
||||
public String moveToPage(@RequestParam("link") String linkPage){
|
||||
String link = linkPage;
|
||||
// service 사용하여 리턴할 결과값 처리하는 부분은 생략하고 단순 페이지 링크만 처리함
|
||||
if (linkPage==null || linkPage.equals("")){
|
||||
link="egovframework/com/cmm/egovError";
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* validato rule dynamic Javascript
|
||||
*/
|
||||
@RequestMapping("/validator.do")
|
||||
public String validate(){
|
||||
return "egovframework/com/cmm/validator";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
import egovframework.com.cmm.util.EgovBasicLogger;
|
||||
import egovframework.com.cmm.util.EgovResourceCloseHelper;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 파일 다운로드를 위한 컨트롤러 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------ -------- ---------------------------
|
||||
* 2009.03.25 이삼섭 최초 생성
|
||||
* 2014.02.24 이기하 IE11 브라우저 한글 파일 다운로드시 에러 수정
|
||||
*
|
||||
* Copyright (C) 2009 by MOPAS All right reserved.
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
public class EgovFileDownloadController {
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
/**
|
||||
* 브라우저 구분 얻기.
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposition 지정하기.
|
||||
*
|
||||
* @param filename
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String browser = getBrowser(request);
|
||||
|
||||
String dispositionPrefix = "attachment; filename=";
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < filename.length(); i++) {
|
||||
char c = filename.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
} else {
|
||||
throw new IOException("Not supported browser");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename);
|
||||
|
||||
if ("Opera".equals(browser)) {
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다.
|
||||
*
|
||||
* @param commandMap
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/cmm/fms/FileDown.do")
|
||||
public void cvplFileDownload(@RequestParam Map<String, Object> commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
String atchFileId = (String) commandMap.get("atchFileId");
|
||||
String fileSn = (String) commandMap.get("fileSn");
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
|
||||
if (isAuthenticated) {
|
||||
|
||||
FileVO fileVO = new FileVO();
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
fileVO.setFileSn(fileSn);
|
||||
FileVO fvo = fileService.selectFileInf(fileVO);
|
||||
|
||||
File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm());
|
||||
long fSize = uFile.length();
|
||||
|
||||
if (fSize > 0) {
|
||||
String mimetype = "application/x-msdownload";
|
||||
|
||||
//response.setBufferSize(fSize); // OutOfMemeory 발생
|
||||
response.setContentType(mimetype);
|
||||
//response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fvo.getOrignlFileNm(), "utf-8") + "\"");
|
||||
setDisposition(fvo.getOrignlFileNm(), request, response);
|
||||
//response.setContentLength(fSize);
|
||||
|
||||
/*
|
||||
* FileCopyUtils.copy(in, response.getOutputStream());
|
||||
* in.close();
|
||||
* response.getOutputStream().flush();
|
||||
* response.getOutputStream().close();
|
||||
*/
|
||||
BufferedInputStream in = null;
|
||||
BufferedOutputStream out = null;
|
||||
|
||||
try {
|
||||
in = new BufferedInputStream(new FileInputStream(uFile));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
} catch (IOException ex) {
|
||||
// 다음 Exception 무시 처리
|
||||
// Connection reset by peer: socket write error
|
||||
EgovBasicLogger.ignore("IO Exception", ex);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(in, out);
|
||||
}
|
||||
|
||||
} else {
|
||||
response.setContentType("application/x-msdownload");
|
||||
|
||||
PrintWriter printwriter = response.getWriter();
|
||||
|
||||
printwriter.println("<html>");
|
||||
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + fvo.getOrignlFileNm() + "</h2>");
|
||||
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
|
||||
printwriter.println("<br><br><br>© webAccess");
|
||||
printwriter.println("</html>");
|
||||
|
||||
printwriter.flush();
|
||||
printwriter.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 파일 조회, 삭제, 다운로드 처리를 위한 컨트롤러 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.25 이삼섭 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
public class EgovFileMngController {
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
/**
|
||||
* 첨부파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectFileInfs.do")
|
||||
public String selectFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap, ModelMap model) throws Exception {
|
||||
String atchFileId = (String)commandMap.get("param_atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
model.addAttribute("updateFlag", "N");
|
||||
model.addAttribute("fileListCnt", result.size());
|
||||
model.addAttribute("atchFileId", atchFileId);
|
||||
|
||||
return "egovframework/com/cmm/fms/EgovFileList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일 변경을 위한 수정페이지로 이동한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectFileInfsForUpdate.do")
|
||||
public String selectFileInfsForUpdate(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap,
|
||||
//SessionVO sessionVO,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
String atchFileId = (String)commandMap.get("param_atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
|
||||
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
model.addAttribute("updateFlag", "Y");
|
||||
model.addAttribute("fileListCnt", result.size());
|
||||
model.addAttribute("atchFileId", atchFileId);
|
||||
|
||||
return "egovframework/com/cmm/fms/EgovFileList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일에 대한 삭제를 처리한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param returnUrl
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/deleteFileInfs.do")
|
||||
public String deleteFileInf(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam("returnUrl") String returnUrl,
|
||||
//SessionVO sessionVO,
|
||||
HttpServletRequest request,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
|
||||
if (isAuthenticated) {
|
||||
fileService.deleteFileInf(fileVO);
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// contextRoot가 있는 경우 제외 시켜야 함
|
||||
//--------------------------------------------
|
||||
////return "forward:/cmm/fms/selectFileInfs.do";
|
||||
//return "forward:" + returnUrl;
|
||||
|
||||
if ("".equals(request.getContextPath()) || "/".equals(request.getContextPath())) {
|
||||
return "forward:" + returnUrl;
|
||||
}
|
||||
|
||||
if (returnUrl.startsWith(request.getContextPath())) {
|
||||
return "forward:" + returnUrl.substring(returnUrl.indexOf("/", 1));
|
||||
} else {
|
||||
return "forward:" + returnUrl;
|
||||
}
|
||||
////------------------------------------------
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 첨부파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectImageFileInfs.do")
|
||||
public String selectImageFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap,
|
||||
//SessionVO sessionVO,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
String atchFileId = (String)commandMap.get("atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
List<FileVO> result = fileService.selectImageFileList(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
|
||||
return "egovframework/com/cmm/fms/EgovImgFileList";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.SessionVO;
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
import egovframework.com.cmm.util.EgovResourceCloseHelper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* @Class Name : EgovImageProcessController.java
|
||||
* @Description :
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- --------- -------------------
|
||||
* 2009.04.02 이삼섭 최초생성
|
||||
* 2014.03.31 유지보수 fileSn 오류수정
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 4. 2.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Controller
|
||||
public class EgovImageProcessController extends HttpServlet {
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovImageProcessController.class);
|
||||
|
||||
/**
|
||||
* 첨부된 이미지에 대한 미리보기 기능을 제공한다.
|
||||
*
|
||||
* @param atchFileId
|
||||
* @param fileSn
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/getImage.do")
|
||||
public void getImageInf(SessionVO sessionVO, ModelMap model, @RequestParam Map<String, Object> commandMap, HttpServletResponse response) throws Exception {
|
||||
|
||||
//@RequestParam("atchFileId") String atchFileId,
|
||||
//@RequestParam("fileSn") String fileSn,
|
||||
String atchFileId = (String)commandMap.get("atchFileId");
|
||||
String fileSn = (String)commandMap.get("fileSn");
|
||||
|
||||
FileVO vo = new FileVO();
|
||||
|
||||
vo.setAtchFileId(atchFileId);
|
||||
vo.setFileSn(fileSn);
|
||||
|
||||
//------------------------------------------------------------
|
||||
// fileSn이 없는 경우 마지막 파일 참조
|
||||
//------------------------------------------------------------
|
||||
if (fileSn == null || fileSn.equals("")) {
|
||||
int newMaxFileSN = fileService.getMaxFileSN(vo);
|
||||
vo.setFileSn(Integer.toString(newMaxFileSN - 1));
|
||||
}
|
||||
//------------------------------------------------------------
|
||||
|
||||
FileVO fvo = fileService.selectFileInf(vo);
|
||||
|
||||
//String fileLoaction = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||
|
||||
File file = null;
|
||||
FileInputStream fis = null;
|
||||
|
||||
BufferedInputStream in = null;
|
||||
ByteArrayOutputStream bStream = null;
|
||||
|
||||
try {
|
||||
file = new File(fvo.getFileStreCours(), fvo.getStreFileNm());
|
||||
fis = new FileInputStream(file);
|
||||
|
||||
in = new BufferedInputStream(fis);
|
||||
bStream = new ByteArrayOutputStream();
|
||||
|
||||
int imgByte;
|
||||
while ((imgByte = in.read()) != -1) {
|
||||
bStream.write(imgByte);
|
||||
}
|
||||
|
||||
String type = "";
|
||||
|
||||
if (fvo.getFileExtsn() != null && !"".equals(fvo.getFileExtsn())) {
|
||||
if ("jpg".equals(fvo.getFileExtsn().toLowerCase())) {
|
||||
type = "image/jpeg";
|
||||
} else {
|
||||
type = "image/" + fvo.getFileExtsn().toLowerCase();
|
||||
}
|
||||
type = "image/" + fvo.getFileExtsn().toLowerCase();
|
||||
|
||||
} else {
|
||||
LOGGER.debug("Image fileType is null.");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", type);
|
||||
response.setContentLength(bStream.size());
|
||||
|
||||
bStream.writeTo(response.getOutputStream());
|
||||
|
||||
response.getOutputStream().flush();
|
||||
response.getOutputStream().close();
|
||||
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(bStream, in, fis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the ";License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS"; BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
|
||||
/**
|
||||
* 실행환경의 파일업로드 처리를 위한 기능 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.25 이삼섭 최초 생성
|
||||
* 2011.06.11 서준식 스프링 3.0 업그레이드 API변경으로인한 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovMultipartResolver extends CommonsMultipartResolver {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovMultipartResolver.class);
|
||||
|
||||
public EgovMultipartResolver() {}
|
||||
|
||||
/**
|
||||
* 첨부파일 처리를 위한 multipart resolver를 생성한다.
|
||||
*
|
||||
* @param servletContext
|
||||
*/
|
||||
public EgovMultipartResolver(ServletContext servletContext) {
|
||||
super(servletContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* multipart에 대한 parsing을 처리한다.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
protected MultipartParsingResult parseFileItems(List fileItems, String encoding) {
|
||||
|
||||
//스프링 3.0변경으로 수정한 부분
|
||||
MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<String, MultipartFile>();
|
||||
Map<String, String[]> multipartParameters = new HashMap<String, String[]>();
|
||||
|
||||
// Extract multipart files and multipart parameters.
|
||||
for (Iterator<?> it = fileItems.iterator(); it.hasNext();) {
|
||||
FileItem fileItem = (FileItem)it.next();
|
||||
|
||||
if (fileItem.isFormField()) {
|
||||
|
||||
String value = null;
|
||||
if (encoding != null) {
|
||||
try {
|
||||
value = fileItem.getString(encoding);
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
LOGGER.warn("Could not decode multipart item '{}' with encoding '{}': using platform default"
|
||||
, fileItem.getFieldName(), encoding);
|
||||
value = fileItem.getString();
|
||||
}
|
||||
} else {
|
||||
value = fileItem.getString();
|
||||
}
|
||||
String[] curParam = (String[])multipartParameters.get(fileItem.getFieldName());
|
||||
if (curParam == null) {
|
||||
// simple form field
|
||||
multipartParameters.put(fileItem.getFieldName(), new String[] { value });
|
||||
} else {
|
||||
// array of simple form fields
|
||||
String[] newParam = StringUtils.addStringToArray(curParam, value);
|
||||
multipartParameters.put(fileItem.getFieldName(), newParam);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (fileItem.getSize() > 0) {
|
||||
// multipart file field
|
||||
CommonsMultipartFile file = new CommonsMultipartFile(fileItem);
|
||||
|
||||
//스프링 3.0 업그레이드 API변경으로인한 수정
|
||||
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
|
||||
fileList.add(file);
|
||||
|
||||
if (multipartFiles.put(fileItem.getName(), fileList) != null) { // CHANGED!!
|
||||
throw new MultipartException("Multiple files for field name [" + file.getName() + "] found - not supported by MultipartResolver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return new MultipartParsingResult(multipartFiles, multipartParameters, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user