addInfoItem 기능 추가
This commit is contained in:
parent
da6920107b
commit
96e122971f
@ -1,117 +1,139 @@
|
|||||||
package nlib.restful.service;
|
package nlib.restful.service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* @Class Name : DataApiReqVO.java
|
* @Class Name : DataApiReqVO.java
|
||||||
*
|
*
|
||||||
* @Description : RESTful API 요청 VO
|
* @Description : RESTful API 요청 VO
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @ ------------ -------- ---------------------------
|
* @ ------------ -------- ---------------------------
|
||||||
* @ 수정일 수정자 수정내용
|
* @ 수정일 수정자 수정내용
|
||||||
* @ ------------ -------- ---------------------------
|
* @ ------------ -------- ---------------------------
|
||||||
* @ 2021. 6. 22. KNKIM 최초 생성
|
* @ 2021. 6. 22. KNKIM 최초 생성
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
* @since 2021. 6. 22.
|
* @since 2021. 6. 22.
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataApiReqVO {
|
public class DataApiReqVO {
|
||||||
|
|
||||||
public static final int DEFAULT_PAGE_SIZE = 10;
|
public static final int DEFAULT_PAGE_SIZE = 10;
|
||||||
public static final int DEFAULT_PAGE_NO = 1;
|
public static final int DEFAULT_PAGE_NO = 1;
|
||||||
|
|
||||||
/* 처리결과 */
|
/* 처리결과 */
|
||||||
private String authKey; /* 로그인키 */
|
private String authKey; /* 로그인키 */
|
||||||
|
|
||||||
/* 페이징 정보 */
|
/* 페이징 정보 */
|
||||||
private int pageNo = 0; /* 요청 페이지 번호 */
|
private int pageNo = 0; /* 요청 페이지 번호 */
|
||||||
private int pageRows = 0; /* 페이지별 표출할 레코드 수 */
|
private int pageRows = 0; /* 페이지별 표출할 레코드 수 */
|
||||||
|
|
||||||
/* 기본정보 */
|
/* 기본정보 */
|
||||||
private HashMap<String, Object> info = null;
|
private HashMap<String, Object> info = null;
|
||||||
|
|
||||||
public boolean hasInfo() {
|
public boolean hasInfo() {
|
||||||
return (info != null && info.size() > 0);
|
return (info != null && info.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 요청업무ID 및 처리URI */
|
/* 요청업무ID 및 처리URI */
|
||||||
int reqMethod; /* 요청메소드구분값 */
|
int reqMethod; /* 요청메소드구분값 */
|
||||||
String reqUrl; /* 요청업무ID에 대한 통합시스템의 응답 처리 프로그램 URI */
|
String reqUrl; /* 요청업무ID에 대한 통합시스템의 응답 처리 프로그램 URI */
|
||||||
|
|
||||||
// GET/SET
|
// GET/SET
|
||||||
public String getAuthKey() {
|
public String getAuthKey() {
|
||||||
return authKey;
|
return authKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthKey(String authKey) {
|
public void setAuthKey(String authKey) {
|
||||||
this.authKey = authKey;
|
this.authKey = authKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPageNo() {
|
public int getPageNo() {
|
||||||
return (pageNo < 1 ? DEFAULT_PAGE_NO : pageNo);
|
return (pageNo < 1 ? DEFAULT_PAGE_NO : pageNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageNo(int pageNo) {
|
public void setPageNo(int pageNo) {
|
||||||
this.pageNo = pageNo;
|
this.pageNo = pageNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageNo(String pageNo) {
|
public void setPageNo(String pageNo) {
|
||||||
try {
|
try {
|
||||||
this.pageNo = Integer.parseInt(pageNo);
|
this.pageNo = Integer.parseInt(pageNo);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
this.pageNo = DEFAULT_PAGE_NO;
|
this.pageNo = DEFAULT_PAGE_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPageRows() {
|
public int getPageRows() {
|
||||||
return (pageRows < 1 ? DEFAULT_PAGE_SIZE : pageRows);
|
return (pageRows < 1 ? DEFAULT_PAGE_SIZE : pageRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageRows(String pageRows) {
|
public void setPageRows(String pageRows) {
|
||||||
try {
|
try {
|
||||||
this.pageRows = Integer.parseInt(pageRows);
|
this.pageRows = Integer.parseInt(pageRows);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
this.pageRows = DEFAULT_PAGE_SIZE;
|
this.pageRows = DEFAULT_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageRows(int pageRows) {
|
public void setPageRows(int pageRows) {
|
||||||
this.pageRows = pageRows;
|
this.pageRows = pageRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getInfo() {
|
public HashMap<String, Object> getInfo() {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInfo(HashMap<String, Object> info) {
|
public void setInfo(HashMap<String, Object> info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReqUrl() {
|
public String getReqUrl() {
|
||||||
return reqUrl;
|
return reqUrl;
|
||||||
}
|
}
|
||||||
public void setReqUrl(String reqUrl) {
|
public void setReqUrl(String reqUrl) {
|
||||||
this.reqUrl = reqUrl;
|
this.reqUrl = reqUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getReqMethod() {
|
public int getReqMethod() {
|
||||||
return reqMethod;
|
return reqMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReqMethod(int reqMethod) {
|
public void setReqMethod(int reqMethod) {
|
||||||
this.reqMethod = reqMethod;
|
this.reqMethod = reqMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void addInfoItem(String key, String value) {
|
||||||
|
if(key == null) return;
|
||||||
|
|
||||||
|
if(info == null) info = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
info.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfoItem(String key) {
|
||||||
|
if(key == null) return null;
|
||||||
|
if(info == null) return null;
|
||||||
|
|
||||||
|
return (String)info.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeInfoItem(String key) {
|
||||||
|
if(key == null) return;
|
||||||
|
if(info == null) return;
|
||||||
|
|
||||||
|
info.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,126 +1,134 @@
|
|||||||
package nlib.restful.service;
|
package nlib.restful.service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import nlib.util.StringUtil;
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* @Class Name : DataApiResVO.java
|
* @Class Name : DataApiResVO.java
|
||||||
*
|
*
|
||||||
* @Description : RESTful API 응답 VO
|
* @Description : RESTful API 응답 VO
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @ ------------ -------- ---------------------------
|
* @ ------------ -------- ---------------------------
|
||||||
* @ 수정일 수정자 수정내용
|
* @ 수정일 수정자 수정내용
|
||||||
* @ ------------ -------- ---------------------------
|
* @ ------------ -------- ---------------------------
|
||||||
* @ 2021. 6. 22. KNKIM 최초 생성
|
* @ 2021. 6. 22. KNKIM 최초 생성
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
||||||
* @since 2021. 6. 22.
|
* @since 2021. 6. 22.
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataApiResVO {
|
public class DataApiResVO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 생성자
|
* 생성자
|
||||||
*/
|
*/
|
||||||
public DataApiResVO() {
|
public DataApiResVO() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 생성자
|
* 생성자
|
||||||
*
|
*
|
||||||
* @param resultCode
|
* @param resultCode
|
||||||
* @param resultMessage
|
* @param resultMessage
|
||||||
*/
|
*/
|
||||||
public DataApiResVO(String resultCode, String resultMessage) {
|
public DataApiResVO(String resultCode, String resultMessage) {
|
||||||
this.resultCode = resultCode;
|
this.resultCode = resultCode;
|
||||||
this.resultMessage = resultMessage;
|
this.resultMessage = resultMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 처리결과 */
|
/* 처리결과 */
|
||||||
String resultCode; /* 결과코드 */
|
String resultCode; /* 결과코드 */
|
||||||
String resultMessage; /* 결과내용(오류내용) */
|
String resultMessage; /* 결과내용(오류내용) */
|
||||||
|
|
||||||
/* 페이징 정보 */
|
/* 페이징 정보 */
|
||||||
int pageNo = 0; /* 요청 페이지 번호 */
|
int pageNo = 0; /* 요청 페이지 번호 */
|
||||||
int pageTotCount = 0; /* 페이지총수 */
|
int pageTotCount = 0; /* 페이지총수 */
|
||||||
|
|
||||||
/* 기본/추가 정보 */
|
/* 기본/추가 정보 */
|
||||||
HashMap<String, Object> info = null;
|
HashMap<String, Object> info = null;
|
||||||
|
|
||||||
/* 목록정보 */
|
/* 목록정보 */
|
||||||
int recordTotCount = 0; /* 총 레코드수 */
|
int recordTotCount = 0; /* 총 레코드수 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 응답 처리결과가 성공인지의 여부를 리턴한다.
|
* 응답 처리결과가 성공인지의 여부를 리턴한다.
|
||||||
* 결과코드(resultCode)의 값이 "S"로 시작하는 경우 true 리턴한다.
|
* 결과코드(resultCode)의 값이 "S"로 시작하는 경우 true 리턴한다.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isSuccess() {
|
public boolean isSuccess() {
|
||||||
if(StringUtil.isEmpty(resultCode)) return false;
|
if(StringUtil.isEmpty(resultCode)) return false;
|
||||||
return (resultCode.trim().charAt(0) == 'S');
|
return (resultCode.trim().charAt(0) == 'S');
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET/SET
|
// GET/SET
|
||||||
|
|
||||||
public String getResultCode() {
|
public String getResultCode() {
|
||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
||||||
public void setResultCode(String resultCode) {
|
public void setResultCode(String resultCode) {
|
||||||
this.resultCode = resultCode;
|
this.resultCode = resultCode;
|
||||||
}
|
}
|
||||||
public String getResultMessage() {
|
public String getResultMessage() {
|
||||||
return resultMessage;
|
return resultMessage;
|
||||||
}
|
}
|
||||||
public void setResultMessage(String resultMessage) {
|
public void setResultMessage(String resultMessage) {
|
||||||
this.resultMessage = resultMessage;
|
this.resultMessage = resultMessage;
|
||||||
}
|
}
|
||||||
public int getPageNo() {
|
public int getPageNo() {
|
||||||
return pageNo;
|
return pageNo;
|
||||||
}
|
}
|
||||||
public void setPageNo(int pageNo) {
|
public void setPageNo(int pageNo) {
|
||||||
this.pageNo = pageNo;
|
this.pageNo = pageNo;
|
||||||
}
|
}
|
||||||
public int getPageTotCount() {
|
public int getPageTotCount() {
|
||||||
return pageTotCount;
|
return pageTotCount;
|
||||||
}
|
}
|
||||||
public void setPageTotCount(int pageTotCount) {
|
public void setPageTotCount(int pageTotCount) {
|
||||||
this.pageTotCount = pageTotCount;
|
this.pageTotCount = pageTotCount;
|
||||||
}
|
}
|
||||||
public HashMap<String, Object> getInfo() {
|
public HashMap<String, Object> getInfo() {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
public void setInfo(HashMap<String, Object> info) {
|
public void setInfo(HashMap<String, Object> info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
public int getRecordTotCount() {
|
public int getRecordTotCount() {
|
||||||
return recordTotCount;
|
return recordTotCount;
|
||||||
}
|
}
|
||||||
public void setRecordTotCount(int recordTotCount) {
|
public void setRecordTotCount(int recordTotCount) {
|
||||||
this.recordTotCount = recordTotCount;
|
this.recordTotCount = recordTotCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 반복되는 목록용 리스트 정보를 가져온다.
|
* 반복되는 목록용 리스트 정보를 가져온다.
|
||||||
* - RESTful API : "<results>"요소로 반복되는 요소를 반환한다.
|
* - RESTful API : "<results>"요소로 반복되는 요소를 반환한다.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<HashMap<String, String>> getList() {
|
public List<HashMap<String, String>> getList() {
|
||||||
if(info == null) return null;
|
if(info == null) return null;
|
||||||
return (List<HashMap<String, String>>)info.get("results");
|
return (List<HashMap<String, String>>)info.get("results");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public String getInfoItem(String key) {
|
||||||
|
if(key == null) return null;
|
||||||
|
if(info == null) return null;
|
||||||
|
|
||||||
|
return (String)info.get(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user