Index: .idea/sonarIssues.xml =================================================================== diff -u -r1541cad1a7a67980258eecab2dc37a1fe92e3731 -r29fd864ddfe9ed46b56befbfdb21e46913b2043e --- .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 1541cad1a7a67980258eecab2dc37a1fe92e3731) +++ .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -1133,6 +1133,11 @@ + + + + + Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/package-info.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/package-info.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/package-info.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author Administrator + * + */ +package egovframework.com.ext.jstree; \ No newline at end of file Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/JsTreeHibernateController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/JsTreeHibernateController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/JsTreeHibernateController.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,280 @@ +package egovframework.com.ext.jstree.springHibernate.core.controller; + +import java.util.HashMap; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.util.StringUtils; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; + +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateDTO; +import egovframework.com.ext.jstree.springHibernate.core.util.Util_TitleChecker; +import egovframework.com.ext.jstree.springHibernate.core.validation.group.AddNode; +import egovframework.com.ext.jstree.springHibernate.core.validation.group.AlterNode; +import egovframework.com.ext.jstree.springHibernate.core.validation.group.AlterNodeType; +import egovframework.com.ext.jstree.springHibernate.core.validation.group.MoveNode; +import egovframework.com.ext.jstree.springHibernate.core.validation.group.RemoveNode; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import egovframework.com.ext.jstree.support.util.ParameterParser; + +@Controller +@RequestMapping(value = {"/com/ext/jstree/springHibernate/core"}) +public class JsTreeHibernateController extends GenericAbstractController { + + @Autowired + private JsTreeHibernateService jsTreeHibernateService; + + /** + * jstree Spring + myBatis 버전의 첫페이지를 요청한다. + * + * @return String jstreeSolutionSpringVersion 페이지를 + */ + @IncludedInfo(name = "jsTree Spring-Hibernate", + listUrl = "/com/ext/jstree/springHibernate/core/getJsTreeView.do", + order = 3360, + gid = 313) + @RequestMapping("/getJsTreeView.do") + public String jsTreeSpringHibernate() { + return "egovframework/com/ext/jstree/springHibernateVersion"; + } + + @RequestMapping("/csrf.do") + public String jsTreeCSRFtoJson() { + return "egovframework/com/ext/jstree/csrf"; + } + + /** + * 자식노드를 요청한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return String + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/getChildNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(JsTreeHibernateDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", new Long(parser.get("c_id"))); + List list = jsTreeHibernateService.getChildNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getPaginatedChildNode.do", method = RequestMethod.GET) + public ModelAndView getPaginatedChildNode(JsTreeHibernateDTO paginatedJsTreeHibernateDTO, ModelMap model, + HttpServletRequest request) throws Exception { + + if (paginatedJsTreeHibernateDTO.getC_id() <= 0 || paginatedJsTreeHibernateDTO.getPageIndex() <= 0 + || paginatedJsTreeHibernateDTO.getPageUnit() <= 0 || paginatedJsTreeHibernateDTO.getPageSize() <= 0) { + throw new RuntimeException(); + } + paginatedJsTreeHibernateDTO.setWhere("c_parentid", paginatedJsTreeHibernateDTO.getC_id()); + List resultChildNodes = jsTreeHibernateService.getPaginatedChildNode(paginatedJsTreeHibernateDTO); + paginatedJsTreeHibernateDTO.getPaginationInfo().setTotalRecordCount(resultChildNodes.size()); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + HashMap resultMap = Maps.newHashMap(); + resultMap.put("paginationInfo", paginatedJsTreeHibernateDTO.getPaginationInfo()); + resultMap.put("result", resultChildNodes); + modelAndView.addObject("result", resultMap); + return modelAndView; + } + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/searchNode.do", method = RequestMethod.GET) + public ModelAndView searchNode(JsTreeHibernateDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (!StringUtils.hasText(request.getParameter("searchString"))) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhereLike("c_title", parser.get("parser")); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateService.searchNode(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 추가한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/addNode.do", method = RequestMethod.POST) + public ModelAndView addNode(@Validated(value = AddNode.class) JsTreeHibernateDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateService.addNode(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 삭제한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/removeNode.do", method = RequestMethod.POST) + public ModelAndView removeNode(@Validated(value = RemoveNode.class) JsTreeHibernateDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setStatus(jsTreeHibernateService.removeNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + private void setJsonDefaultSetting(JsTreeHibernateDTO jsTreeHibernateDTO) { + long defaultSettingValue = 0; + jsTreeHibernateDTO.setC_parentid(defaultSettingValue); + jsTreeHibernateDTO.setC_position(defaultSettingValue); + jsTreeHibernateDTO.setC_left(defaultSettingValue); + jsTreeHibernateDTO.setC_right(defaultSettingValue); + jsTreeHibernateDTO.setC_level(defaultSettingValue); + jsTreeHibernateDTO.setRef(defaultSettingValue); + } + + /** + * 노드를 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNode.do", method = RequestMethod.POST) + public ModelAndView alterNode(@Validated(value = AlterNode.class) JsTreeHibernateDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + jsTreeHibernateDTO.setStatus(jsTreeHibernateService.alterNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + /** + * 노드의 타입을 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return ModelAndView + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNodeType.do", method = RequestMethod.POST) + public ModelAndView alterNodeType(@Validated(value = AlterNodeType.class) JsTreeHibernateDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateService.alterNodeType(jsTreeHibernateDTO); + setJsonDefaultSetting(jsTreeHibernateDTO); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + /** + * 노드를 이동한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + * @throws ReflectiveOperationException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/moveNode.do", method = RequestMethod.POST) + public ModelAndView moveNode(@Validated(value = MoveNode.class) JsTreeHibernateDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model, HttpServletRequest request) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateService.moveNode(jsTreeHibernateDTO, request); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/analyzeNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(ModelMap model) { + model.addAttribute("analyzeResult", ""); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", "ture"); + return modelAndView; + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateAbstractDao.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateAbstractDao.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateAbstractDao.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,483 @@ +package egovframework.com.ext.jstree.springHibernate.core.dao; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Resource; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.collections.CollectionUtils; +import org.hibernate.CacheMode; +import org.hibernate.Criteria; +import org.hibernate.LockMode; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.ProjectionList; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.orm.hibernate4.HibernateCallback; +import org.springframework.orm.hibernate4.support.HibernateDaoSupport; + +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; + +@SuppressWarnings("unchecked") +public abstract class JsTreeHibernateAbstractDao extends HibernateDaoSupport { + + @Resource(name = "sessionFactory") + public void init(SessionFactory sessionFactory) { + this.setSessionFactory(sessionFactory); + } + protected abstract Class getEntityClass(); + + protected Session getCurrentSession() { + return getHibernateTemplate().getSessionFactory().getCurrentSession(); + } + + public DetachedCriteria createDetachedCriteria(Class clazz) { + return DetachedCriteria.forClass(clazz); + } + + public DetachedCriteria createDetachedCriteria() { + return DetachedCriteria.forClass(getEntityClass()); + } + + private DetachedCriteria getCriteria(T extractSearchDTO) { + DetachedCriteria criteria = DetachedCriteria.forClass(getEntityClass()); + for (Criterion criterion : extractSearchDTO.getCriterions()) { + criteria.add(criterion); + } + return criteria; + } + + public T getUnique(Long id) { + return getHibernateTemplate().get(getEntityClass(), id); + } + + public T getUnique(Criterion criterion) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + detachedCriteria.add(criterion); + List list = (List) getHibernateTemplate().findByCriteria(detachedCriteria); + if (list.isEmpty()) { + return null; + } + return (T) list.get(0); + } + + public T getUnique(T extractSearchDTO) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : extractSearchDTO.getCriterions()) { + detachedCriteria.add(c); + } + List list = (List) getHibernateTemplate().findByCriteria(detachedCriteria); + if (list.isEmpty()) { + return null; + } + return (T) list.get(0); + } + + public T getUnique(Criterion... criterions) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterions) { + detachedCriteria.add(c); + } + List list = (List) getHibernateTemplate().findByCriteria(detachedCriteria); + if (list.isEmpty()) { + return null; + } + return (T) list.get(0); + } + + public T getUnique(List criterion) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterion) { + detachedCriteria.add(c); + } + List list = (List) getHibernateTemplate().findByCriteria(detachedCriteria); + if (list.isEmpty()) { + return null; + } + return (T) list.get(0); + } + + public List getList() { + DetachedCriteria criteria = DetachedCriteria.forClass(getEntityClass()); + List list = (List) getHibernateTemplate().findByCriteria(criteria); + if (list.isEmpty()) { + return null; + } + return list; + } + + public List getList(DetachedCriteria detachedCriteria, int limit, int offset) { + return (List) getHibernateTemplate().findByCriteria(detachedCriteria, offset, limit); + } + + public List getList(T extractSearchDTO) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Order order : extractSearchDTO.getOrder()) { + detachedCriteria.addOrder(order); + } + for (Criterion criterion : extractSearchDTO.getCriterions()) { + detachedCriteria.add(criterion); + } + List list = (List) getHibernateTemplate().findByCriteria(detachedCriteria, extractSearchDTO.getFirstIndex(), + extractSearchDTO.getLastIndex()); + if (list.isEmpty()) { + return new ArrayList<>(); + } + return list; + } + + public List getList(T extractSearchDTO, Criterion... criterion) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterion) { + detachedCriteria.add(c); + } + for (Order order : extractSearchDTO.getOrder()) { + detachedCriteria.addOrder(order); + } + return (List) getHibernateTemplate().findByCriteria(detachedCriteria, extractSearchDTO.getFirstIndex(), + extractSearchDTO.getLastIndex()); + } + + public List getList(Criterion... criterions) { + DetachedCriteria criteria = createDetachedCriteria(); + for (Criterion criterion : criterions) { + criteria.add(criterion); + } + List list = (List) getHibernateTemplate().findByCriteria(criteria); + if (list.isEmpty()) { + return new ArrayList<>(); + } + return list; + } + + public List getList(List criterions, List orders) { + DetachedCriteria criteria = createDetachedCriteria(); + for (Criterion criterion : criterions) { + criteria.add(criterion); + } + for (Order order : orders) { + criteria.addOrder(order); + } + List list = (List) getHibernateTemplate().findByCriteria(criteria); + if (list.isEmpty()) { + return new ArrayList<>(); + } + return list; + } + + public List getGroupByList(T extractSearchDTO, String target) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Order order : extractSearchDTO.getOrder()) { + detachedCriteria.addOrder(order); + } + for (Criterion criterion : extractSearchDTO.getCriterions()) { + detachedCriteria.add(criterion); + } + ProjectionList projectList = Projections.projectionList(); + projectList.add(Projections.groupProperty(target)); + detachedCriteria.setProjection(projectList); + return (List) getHibernateTemplate().findByCriteria(detachedCriteria, extractSearchDTO.getFirstIndex(), + extractSearchDTO.getLastIndex()); + } + + public Map getGroupByList(T extractSearchDTO, String groupProperty, String sumProperty) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + Map result = new HashMap(); + for (Criterion criterion : extractSearchDTO.getCriterions()) { + detachedCriteria.add(criterion); + } + ProjectionList projectList = Projections.projectionList(); + projectList.add(Projections.property(groupProperty)); + projectList.add(Projections.sum(sumProperty)); + projectList.add(Projections.groupProperty(groupProperty)); + detachedCriteria.setProjection(projectList); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + detachedCriteria.setProjection(null); + if (null == l || l.size() == 0) { + return result; + } else { + Iterator ite = l.iterator(); + while (ite.hasNext()) { + Object[] objects = (Object[]) ite.next(); + result.put((String) objects[0], (Long) objects[1]); + } + } + return result; + } + + public int getGroupByCount(T extractSearchDTO, String tagert) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion criterion : extractSearchDTO.getCriterions()) { + detachedCriteria.add(criterion); + } + ProjectionList projectList = Projections.projectionList(); + projectList.add(Projections.groupProperty(tagert)); + detachedCriteria.setProjection(projectList); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + detachedCriteria.setProjection(null); + if (null == l || l.size() == 0) { + return 0; + } else { + return l.size(); + } + } + + + public List getListWithoutPaging(Order order) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + detachedCriteria.addOrder(order); + + return (List) getHibernateTemplate().findByCriteria(detachedCriteria); + } + + public List getListWithoutPaging(Order order, Criterion... criterion) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterion) { + detachedCriteria.add(c); + } + detachedCriteria.addOrder(order); + + return (List) getHibernateTemplate().findByCriteria(detachedCriteria); + } + + public List getListWithoutPaging(DetachedCriteria detachedCriteria) { + return (List) getHibernateTemplate().findByCriteria(detachedCriteria); + } + + public int getCount(Criterion... criterions) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterions) { + detachedCriteria.add(c); + } + + detachedCriteria.setProjection(Projections.rowCount()); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + + if (l.size() == 0) { + return 0; + } + + Long total = (Long) l.get(0); + detachedCriteria.setProjection(null); + return total.intValue(); + } + + public int getCount(T extractSearchDTO) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + + for (Criterion c : extractSearchDTO.getCriterions()) { + detachedCriteria.add(c); + } + + detachedCriteria.setProjection(Projections.rowCount()); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + + if (null == l || l.size() == 0) { + return 0; + } + + Long total = (Long) l.get(0); + detachedCriteria.setProjection(null); + return total.intValue(); + } + + public int getCount(T extractSearchDTO, List criterions) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + + for (Criterion c : criterions) { + detachedCriteria.add(c); + } + + detachedCriteria.setProjection(Projections.rowCount()); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + + Long total = (Long) l.get(0); + detachedCriteria.setProjection(null); + return total.intValue(); + } + + public int getCount(List criterions) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + for (Criterion c : criterions) { + detachedCriteria.add(c); + } + + detachedCriteria.setProjection(Projections.rowCount()); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + + Long total = (Long) l.get(0); + detachedCriteria.setProjection(null); + return total.intValue(); + } + + public int getSum(List criterions, String propertyName) { + DetachedCriteria detachedCriteria = createDetachedCriteria(); + detachedCriteria.add(Restrictions.isNotNull(propertyName)); + + for (Criterion c : criterions) { + detachedCriteria.add(c); + } + + detachedCriteria.setProjection(Projections.sum(propertyName)); + List l = getHibernateTemplate().findByCriteria(detachedCriteria); + + if (l.size() == 0) { + return 0; + } + + Long sum = (Long) l.get(0); + detachedCriteria.setProjection(null); + return sum != null ? sum.intValue() : 0; + } + + public int getSum(T extractSearchDTO, String propertyName) { + DetachedCriteria criteria = getCriteria(extractSearchDTO); + criteria.add(Restrictions.isNotNull(propertyName)); + criteria.setProjection(Projections.sum(propertyName)); + List l = getHibernateTemplate().findByCriteria(criteria); + + if (CollectionUtils.isEmpty(l)) { + return 0; + } + + Long total = (Long) l.get(0); + criteria.setProjection(null); + return total != null ? total.intValue() : 0; + } + + public T find(ID id, LockMode lockMode) { + return (T) getHibernateTemplate().get(getEntityClass(), id, lockMode); + } + + public T find(ID id, LockMode lockMode, boolean enableCache) { + Object obj = getHibernateTemplate().get(getEntityClass(), id, lockMode); + if (null != obj && !enableCache) { + getHibernateTemplate().refresh(obj); + } + + return (T) obj; + } + + public void refresh(Object entity) { + getHibernateTemplate().refresh(entity); + } + + public ID store(T newInstance) { + return (ID) getHibernateTemplate().save(newInstance); + } + + public void storeOrUpdate(T newInstance) { + getHibernateTemplate().saveOrUpdate(newInstance); + } + + public void storeOrUpdateAdvanced(T newInstance, String columId) { + getHibernateTemplate().saveOrUpdate(newInstance); + } + + public void update(T transientObject) { + getHibernateTemplate().update(transientObject); + } + + public void merge(T transientObject) { + getHibernateTemplate().merge(transientObject); + } + + public int bulkUpdate(String queryString, Object... value) { + return getHibernateTemplate().bulkUpdate(queryString, value); + } + + public void flush() { + getHibernateTemplate().flush(); + } + + public void delete(T persistentObject) { + getHibernateTemplate().delete(persistentObject); + } + + public void deleteAll(Collection entities) { + getHibernateTemplate().deleteAll(entities); + } + + public void bulkInsert(Collection entities) { + Session session = getHibernateTemplate().getSessionFactory().openSession(); + session.setCacheMode(CacheMode.IGNORE); + Transaction tx = session.beginTransaction(); + + int i = 0; + for (T t : entities) { + session.save(t); + + if (i % 50 == 0) { // batch size + session.flush(); + session.clear(); + } + i++; + } + + tx.commit(); + session.close(); + } + + public T excute(HibernateCallback callback) { + return getHibernateTemplate().execute(callback); + } + + @SuppressWarnings("unused") + private Long getId(Object object) { + String value = ""; + try { + value = BeanUtils.getProperty(object, "id"); + } catch (Exception e) { + logger.error("no search instace class id"); + } + + return Long.parseLong(value); + } + + @SuppressWarnings("unused") + private Long getId(Object object, String columId) { + String value = ""; + try { + value = BeanUtils.getProperty(object, columId); + } catch (Exception e) { + logger.error("no search instace class id"); + } + + return Long.parseLong(value); + } + + public T getByID(ID id) { + return (T) getCurrentSession().get(getEntityClass(), id); + } + + @SuppressWarnings("rawtypes") + public List search(Map parameterMap) { + Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); + Set fieldName = parameterMap.keySet(); + for (String field : fieldName) { + criteria.add(Restrictions.ilike(field, parameterMap.get(field))); + } + return criteria.list(); + } + + public ID insert(T entity) { + return (ID) store(entity); + } + + public void deleteById(ID id) { + delete(getByID(id)); + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDao.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDao.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDao.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,62 @@ +package egovframework.com.ext.jstree.springHibernate.core.dao; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.hibernate.LockMode; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Order; +import org.springframework.orm.hibernate4.HibernateCallback; + +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; + +public interface JsTreeHibernateDao { + + public Class getClazz(); + public void setClazz(Class clazzToSet); + public DetachedCriteria createDetachedCriteria(Class clazz); + public DetachedCriteria createDetachedCriteria(); + public T getUnique(Long id); + public T getUnique(Criterion criterion); + public T getUnique(T extractSearchDTO); + public T getUnique(Criterion... criterions); + public T getUnique(List criterion); + public List getList(); + public List getList(DetachedCriteria detachedCriteria, int limit, int offset); + public List getList(T extractSearchDTO); + public List getList(T extractSearchDTO, Criterion... criterion); + public List getList(Criterion... criterions); + public List getList(List criterions, List orders); + public List getGroupByList(T extractSearchDTO, String target); + public Map getGroupByList(T extractSearchDTO, String groupProperty, String sumProperty); + public int getGroupByCount(T extractSearchDTO, String tagert); + public List getListWithoutPaging(Order order); + public List getListWithoutPaging(Order order, Criterion... criterion); + public List getListWithoutPaging(DetachedCriteria detachedCriteria); + public int getCount(Criterion... criterions); + public int getCount(T extractSearchDTO); + public int getCount(T extractSearchDTO, List criterions); + public int getCount(List criterions); + public int getSum(List criterions, String propertyName); + public int getSum(T extractSearchDTO, String propertyName); + public T find(ID id, LockMode lockMode); + public T find(ID id, LockMode lockMode, boolean enableCache); + public void refresh(Object entity); + public ID store(T newInstance); + public void storeOrUpdate(T newInstance); + public void storeOrUpdateAdvanced(T newInstance, String columId); + public void update(T transientObject); + public void merge(T transientObject); + public int bulkUpdate(String queryString, Object... value); + public void flush(); + public void delete(T persistentObject); + public void deleteAll(Collection entities); + public void bulkInsert(Collection entities); + public T excute(HibernateCallback callback); + public List search(Map parameterMap); + public ID insert(T entity); + public void deleteById(ID id); +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDaoImpl.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDaoImpl.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/dao/JsTreeHibernateDaoImpl.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,28 @@ +package egovframework.com.ext.jstree.springHibernate.core.dao; + +import java.io.Serializable; + +import org.springframework.stereotype.Repository; + +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; + +@SuppressWarnings("unchecked") +@Repository("jsTreeHibernateDao") +public class JsTreeHibernateDaoImpl extends + JsTreeHibernateAbstractDao implements JsTreeHibernateDao{ + + private Class clazz; + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazzToSet) { + this.clazz = clazzToSet; + } + + @Override + protected Class getEntityClass() { + return getClazz(); + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,91 @@ +package egovframework.com.ext.jstree.springHibernate.core.service; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; + +public interface JsTreeHibernateService { + + public T getNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 자식노드를 요청한다. + * + * @param + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return List 자식 노드들 + */ + public List getChildNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 자식노드를 요청한다. + * + * @param + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return List 자식 노드들 + */ + public List getPaginatedChildNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return List - 검색된 노드들 + */ + public List searchNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드를 추가한다. + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return jsTreeHibernateDTO + * @throws IllegalAccessException + * @throws InstantiationException + */ + public T addNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드를 삭제한다. + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return int + */ + public int removeNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드를 변경한다. + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return int + */ + public int alterNode(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드의 타입을 변경한다. + * + * @param jsTreeHibernateDTO + * - jstree에서 사용되는 tree VO + * @return int + */ + public int alterNodeType(T jsTreeHibernateDTO) throws Exception; + + /** + * 노드를 이동한다. + * + * @param jsTreeHibernateDTO + * @param request + * @return + * @throws Exception + */ + public T moveNode(T jsTreeHibernateDTO, HttpServletRequest request) throws Exception; +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,811 @@ +package egovframework.com.ext.jstree.springHibernate.core.service; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.commons.collections15.CollectionUtils; +import org.apache.commons.collections15.Transformer; +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import egovframework.com.ext.jstree.springHibernate.core.dao.JsTreeHibernateDao; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +@Service("JsTreeHibernateService") +public class JsTreeHibernateServiceImpl implements JsTreeHibernateService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @SuppressWarnings("rawtypes") + @Resource(name = "jsTreeHibernateDao") + private JsTreeHibernateDao jsTreeHibernateDao; + + @SuppressWarnings("unchecked") + @Override + public T getNode(T jsTreeHibernateDTO) throws Exception { + logger.info("getNode"); + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + jsTreeHibernateDTO.setWhere("c_id", jsTreeHibernateDTO.getC_id()); + Object uniqueObj = jsTreeHibernateDao.getUnique(jsTreeHibernateDTO); + return (T) uniqueObj; + } + + @SuppressWarnings("unchecked") + @Override + public List getChildNode(T jsTreeHibernateDTO) throws Exception { + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + jsTreeHibernateDTO.setOrder(Order.asc("c_position")); + List list = jsTreeHibernateDao.getList(jsTreeHibernateDTO); + return list; + } + + @SuppressWarnings("unchecked") + @Override + public List getPaginatedChildNode(T jsTreeHibernateDTO) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = jsTreeHibernateDTO.getPaginationInfo(); + paginationInfo.setCurrentPageNo(jsTreeHibernateDTO.getPageIndex()); + paginationInfo.setRecordCountPerPage(jsTreeHibernateDTO.getPageUnit()); + paginationInfo.setPageSize(jsTreeHibernateDTO.getPageSize()); + + jsTreeHibernateDTO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + jsTreeHibernateDTO.setLastIndex(paginationInfo.getLastRecordIndex()); + jsTreeHibernateDTO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + jsTreeHibernateDTO.setOrder(Order.asc("c_position")); + List list = jsTreeHibernateDao.getList(jsTreeHibernateDTO); + return list; + } + + @SuppressWarnings("unchecked") + @Override + public List searchNode(T jsTreeHibernateDTO) throws Exception { + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + jsTreeHibernateDTO.setOrder(Order.asc("c_id")); + List collectionObjects = jsTreeHibernateDao.getList(jsTreeHibernateDTO); + List returnList = new ArrayList(); + for (T rowObject : collectionObjects) { + String rowData = "#node_" + rowObject.getC_id(); + returnList.add(rowData); + } + return returnList; + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public T addNode(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + if (jsTreeHibernateDTO.getRef() < 0) { + throw new RuntimeException("ref is minus"); + } else { + T nodeByRef = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getRef()); + + if ("default".equals(nodeByRef.getC_type())) { + throw new RuntimeException("nodeByRef is default Type"); + } + + nodeByRef.setWhere("c_parentid", nodeByRef.getC_id()); + final long lastPosiotionOfNodeByRef = jsTreeHibernateDao.getCount(nodeByRef); + + jsTreeHibernateDTO.setC_position(lastPosiotionOfNodeByRef); + + long rightPointFromNodeByRef = nodeByRef.getC_right(); + rightPointFromNodeByRef = Math.max(rightPointFromNodeByRef, 1); + + long spaceOfTargetNode = 2; + + this.stretchLeftRightForMyselfFromJstree(spaceOfTargetNode, rightPointFromNodeByRef, + jsTreeHibernateDTO.getCopy(), null, jsTreeHibernateDTO); + + long targetNodeLevel = jsTreeHibernateDTO.getRef() == 0 ? 0 : nodeByRef.getC_level() + 1; + + jsTreeHibernateDTO.setC_parentid(jsTreeHibernateDTO.getRef()); + jsTreeHibernateDTO.setC_left(rightPointFromNodeByRef); + jsTreeHibernateDTO.setC_right(rightPointFromNodeByRef + 1); + jsTreeHibernateDTO.setC_level(targetNodeLevel); + + long insertSeqResult = (long) jsTreeHibernateDao.insert(jsTreeHibernateDTO); + if (insertSeqResult > 0) { + final long SUCCESS = 1; + jsTreeHibernateDTO.setStatus(SUCCESS); + jsTreeHibernateDTO.setId(insertSeqResult); + } else { + throw new RuntimeException("심각한 오류 발생 - 삽입 노드"); + } + } + return jsTreeHibernateDTO; + } + + private void stretchLeftRightForMyselfFromJstree(long spaceOfTargetNode, + long rightPositionFromNodeByRef, long copy, Collection c_idsByChildNodeFromNodeById, + T jsTreeHibernateDTO) throws Exception { + + DetachedCriteria detachedLeftCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + stretchLeft(spaceOfTargetNode, rightPositionFromNodeByRef, copy, c_idsByChildNodeFromNodeById, + detachedLeftCriteria); + DetachedCriteria detachedRightCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + stretchRight(spaceOfTargetNode, rightPositionFromNodeByRef, copy, c_idsByChildNodeFromNodeById, + detachedRightCriteria); + } + + @SuppressWarnings("unchecked") + private void stretchRight(long spaceOfTargetNode, + long rightPositionFromNodeByRef, long copy, Collection c_idsByChildNodeFromNodeById, + DetachedCriteria detachedCriteria) { + logger.debug("-----------------------stretchRight 완료-----------------------"); + Criterion where = Restrictions.ge("c_right", rightPositionFromNodeByRef); + detachedCriteria.add(where); + if (copy == 0) { + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + detachedCriteria.add(Restrictions.and(Restrictions.not(Restrictions.in("c_id", + c_idsByChildNodeFromNodeById)))); + } + } + detachedCriteria.addOrder(Order.asc("c_id")); + List updateTargetList = jsTreeHibernateDao.getListWithoutPaging(detachedCriteria); + + for (T perJsTreeHibernateDTO : updateTargetList) { + perJsTreeHibernateDTO.setC_right(perJsTreeHibernateDTO.getC_right() + spaceOfTargetNode); + try { + jsTreeHibernateDao.update(perJsTreeHibernateDTO); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + } + + @SuppressWarnings("unchecked") + private void stretchLeft(long spaceOfTargetNode, + long rightPositionFromNodeByRef, long copy, Collection c_idsByChildNodeFromNodeById, + DetachedCriteria detachedCriteria) { + + logger.debug("-----------------------stretchLeft 완료-----------------------"); + Criterion where = Restrictions.ge("c_left", rightPositionFromNodeByRef); + detachedCriteria.add(where); + if (copy == 0) { + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + detachedCriteria.add(Restrictions.and(Restrictions.not(Restrictions.in("c_id", + c_idsByChildNodeFromNodeById)))); + } + } + detachedCriteria.addOrder(Order.asc("c_id")); + List updateTargetList = jsTreeHibernateDao.getListWithoutPaging(detachedCriteria); + + for (T perJsTreeHibernateDTO : updateTargetList) { + perJsTreeHibernateDTO.setC_left(perJsTreeHibernateDTO.getC_left() + spaceOfTargetNode); + try { + jsTreeHibernateDao.update(perJsTreeHibernateDTO); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + } + + /** + * 파라미터로 넘겨진 인스턴스의 정보를 이용해 리플렉션하여 새로운 인스턴스를 만들어 반환한다. + * + * @param comprehensiveTree + * 리플렉션을 위한 타입 정보를 제공하기 위한 인스턴스 + * @return + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + */ + @SuppressWarnings("unchecked") + private T newInstance(T jsTreeHibernateDTO) throws Exception { + Class target = (Class) Class.forName(jsTreeHibernateDTO.getClass().getCanonicalName()); + return target.newInstance(); + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int removeNode(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + Criterion whereGetNode = Restrictions.eq("c_id", jsTreeHibernateDTO.getC_id()); + T removeNode = (T) jsTreeHibernateDao.getUnique(whereGetNode); + + long spaceOfTargetNode = removeNode.getC_right() - removeNode.getC_left() + 1; + + removeNode.setSpaceOfTargetNode(spaceOfTargetNode); + + DetachedCriteria detachedDeleteCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion where = Restrictions.ge("c_left", removeNode.getC_left()); + detachedDeleteCriteria.add(where); + detachedDeleteCriteria.add(Restrictions.and(Restrictions.le("c_right", removeNode.getC_right()))); + detachedDeleteCriteria.addOrder(Order.asc("c_id")); + try { + List deleteTargetList = jsTreeHibernateDao.getListWithoutPaging(detachedDeleteCriteria); + for (T deleteJsTreeHibernateDTO : deleteTargetList) { + jsTreeHibernateDao.delete(deleteJsTreeHibernateDTO); + } + } catch (Exception e) { + // TODO: handle exception + System.out.println(e.getMessage()); + } + + DetachedCriteria detachedRemovedAfterLeftFixCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereRemovedAfterLeftFix = Restrictions.gt("c_left", removeNode.getC_right()); + detachedRemovedAfterLeftFixCriteria.add(whereRemovedAfterLeftFix); + detachedRemovedAfterLeftFixCriteria.addOrder(Order.asc("c_id")); + List updateRemovedAfterLeftFixtList = jsTreeHibernateDao + .getListWithoutPaging(detachedRemovedAfterLeftFixCriteria); + for (T perLeftFixJsTreeHibernateDTO : updateRemovedAfterLeftFixtList) { + perLeftFixJsTreeHibernateDTO.setC_left(perLeftFixJsTreeHibernateDTO.getC_left() - spaceOfTargetNode); + jsTreeHibernateDao.update(perLeftFixJsTreeHibernateDTO); + } + + DetachedCriteria detachedRemovedAfterRightFixCriteria = DetachedCriteria + .forClass(jsTreeHibernateDTO.getClass()); + Criterion whereRemovedAfterRightFix = Restrictions.gt("c_right", removeNode.getC_left()); + detachedRemovedAfterRightFixCriteria.add(whereRemovedAfterRightFix); + detachedRemovedAfterRightFixCriteria.addOrder(Order.asc("c_id")); + List updateRemovedAfterRightFixtList = jsTreeHibernateDao + .getListWithoutPaging(detachedRemovedAfterRightFixCriteria); + for (T perRightFixJsTreeHibernateDTO : updateRemovedAfterRightFixtList) { + perRightFixJsTreeHibernateDTO.setC_right(perRightFixJsTreeHibernateDTO.getC_right() - spaceOfTargetNode); + jsTreeHibernateDao.update(perRightFixJsTreeHibernateDTO); + } + + DetachedCriteria detachedRemovedAfterPositionFixCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO + .getClass()); + Criterion whereRemovedAfterPositionFix = Restrictions.eq("c_parentid", removeNode.getC_parentid()); + detachedRemovedAfterPositionFixCriteria.add(whereRemovedAfterPositionFix); + detachedRemovedAfterPositionFixCriteria.add(Restrictions.and(Restrictions.gt("c_position", + removeNode.getC_position()))); + detachedRemovedAfterPositionFixCriteria.addOrder(Order.asc("c_id")); + List updateRemovedAfterPositionFixtList = jsTreeHibernateDao + .getListWithoutPaging(detachedRemovedAfterPositionFixCriteria); + for (T perPositionFixJsTreeHibernateDTO : updateRemovedAfterPositionFixtList) { + perPositionFixJsTreeHibernateDTO.setC_position(perPositionFixJsTreeHibernateDTO.getC_position() - 1); + jsTreeHibernateDao.update(perPositionFixJsTreeHibernateDTO); + } + return 0; + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int alterNode(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + T alterTargetNode = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + alterTargetNode.setC_title(jsTreeHibernateDTO.getC_title()); + // TODO : 기타 추가되는 필드 처리는 어떻게 할 것인가? + jsTreeHibernateDao.update(alterTargetNode); + return 1; + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int alterNodeType(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + T nodeById = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + + if (nodeById.getC_type().equals(jsTreeHibernateDTO.getC_type())) { + return 1; + } else if ("default".equals(jsTreeHibernateDTO.getC_type())) { + nodeById.setWhere("c_parentid", nodeById.getC_id()); + List childNodesFromNodeById = jsTreeHibernateDao.getList(nodeById); + if (childNodesFromNodeById.size() != 0) { + throw new RuntimeException("하위에 노드가 있는데 디폴트로 바꾸려고 함"); + } else { + nodeById.setC_type(jsTreeHibernateDTO.getC_type()); + jsTreeHibernateDao.update(nodeById); + } + } else if ("folder".equals(jsTreeHibernateDTO.getC_type())) { + nodeById.setC_type(jsTreeHibernateDTO.getC_type()); + jsTreeHibernateDao.update(nodeById); + return 1; + } + return 1; + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public T moveNode(T jsTreeHibernateDTO, HttpServletRequest request) + throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + + logger.debug("***********************MoveNode***********************"); + logger.debug("-----------------------getNode 완료-----------------------"); + + T nodeById = getNode(jsTreeHibernateDTO); + if (nodeById == null) { + throw new RuntimeException("nodeById is null"); + } + Long nodeByIdLeft = nodeById.getC_left(); + + logger.debug("-----------------------getChildNodeByLeftRight 완료-----------------------"); + DetachedCriteria getChildNodeByLeftRightCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereChildNodeByLeftRight = Restrictions.ge("c_left", nodeById.getC_left()); + getChildNodeByLeftRightCriteria.add(whereChildNodeByLeftRight); + getChildNodeByLeftRightCriteria.add(Restrictions.and(Restrictions.le("c_right", nodeById.getC_right()))); + getChildNodeByLeftRightCriteria.addOrder(Order.asc("c_left")); + List childNodesFromNodeById = jsTreeHibernateDao.getListWithoutPaging(getChildNodeByLeftRightCriteria); + + logger.debug("-----------------------nodeByRef 완료-----------------------"); + T nodeByRef = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getRef()); + long rightPointFromNodeByRef = nodeByRef.getC_right(); + + logger.debug("-----------------------childNodesFromNodeByRef 완료-----------------------"); + DetachedCriteria getNodeByRefCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereNodeByRef = Restrictions.eq("c_parentid", nodeByRef.getC_id()); + getNodeByRefCriteria.add(whereNodeByRef); + List childNodesFromNodeByRef = (List) jsTreeHibernateDao.getListWithoutPaging(getNodeByRefCriteria); + + T t_ComprehensiveTree = newInstance(jsTreeHibernateDTO); + + long spaceOfTargetNode = 2; + Collection c_idsByChildNodeFromNodeById = null; + + logger.debug("-----------------------c_idsByChildNodeFromNodeById 완료-----------------------"); + c_idsByChildNodeFromNodeById = CollectionUtils.collect(childNodesFromNodeById, new Transformer() { + @Override + public Long transform(T childNodePerNodeById) { + return childNodePerNodeById.getC_id(); + } + }); + + if (c_idsByChildNodeFromNodeById.contains(jsTreeHibernateDTO.getRef())) { + throw new RuntimeException("myself contains already refTargetNode"); + } + + spaceOfTargetNode = nodeById.getC_right() - nodeById.getC_left() + 1; + + if (!jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------cutMyself 완료-----------------------"); + this.cutMyself(nodeById, spaceOfTargetNode, c_idsByChildNodeFromNodeById); + } + + logger.debug("-----------------------calculatePostion 완료-----------------------"); + this.calculatePostion(jsTreeHibernateDTO, nodeById, childNodesFromNodeByRef, request); + + if (rightPointFromNodeByRef < 1) { + rightPointFromNodeByRef = 1; + } + + if (!jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------stretchPositionForMyselfFromJstree 완료-----------------------"); + this.stretchPositionForMyselfFromJstree(c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + + int selfPosition = (nodeById.getC_parentid() == jsTreeHibernateDTO.getRef() && jsTreeHibernateDTO + .getC_position() > nodeById.getC_position()) ? 1 : 0; + + for (T child : childNodesFromNodeByRef) { + if (child.getC_position() - selfPosition == jsTreeHibernateDTO.getC_position()) { + rightPointFromNodeByRef = child.getC_left(); + break; + } + } + + if (nodeById.getC_left() < rightPointFromNodeByRef) { + rightPointFromNodeByRef -= spaceOfTargetNode; + } + } + + logger.debug("-----------------------stretchLeftRightForMyselfFromJstree 완료-----------------------"); + this.stretchLeftRightForMyselfFromJstree(spaceOfTargetNode, rightPointFromNodeByRef, + jsTreeHibernateDTO.getCopy(), c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>>>>>" + rightPointFromNodeByRef); + } + + long targetNodeLevel = nodeById.getC_level() - (nodeByRef.getC_level() + 1); + long comparePoint = nodeByIdLeft - rightPointFromNodeByRef; + + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>>>>>" + comparePoint); + } + + if (jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------pasteMyselfFromJstree 완료-----------------------"); + long insertSeqResult = this + .pasteMyselfFromJstree(jsTreeHibernateDTO.getRef(), comparePoint, spaceOfTargetNode, + targetNodeLevel, c_idsByChildNodeFromNodeById, rightPointFromNodeByRef, nodeById); + t_ComprehensiveTree.setId(insertSeqResult); + logger.debug("-----------------------fixPositionParentIdOfCopyNodes-----------------------"); + this.fixPositionParentIdOfCopyNodes(insertSeqResult, jsTreeHibernateDTO.getC_position(), jsTreeHibernateDTO); + } else { + logger.debug("-----------------------enterMyselfFromJstree 완료-----------------------"); + this.enterMyselfFromJstree(jsTreeHibernateDTO.getRef(), jsTreeHibernateDTO.getC_position(), + jsTreeHibernateDTO.getC_id(), comparePoint, targetNodeLevel, c_idsByChildNodeFromNodeById, + jsTreeHibernateDTO); + enterMyselfFixLeftRight(comparePoint, targetNodeLevel, c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + } + return t_ComprehensiveTree; + } + + @SuppressWarnings("unchecked") + private void enterMyselfFromJstree(long ref, long c_position, long c_id, + long idif, long ldif, Collection c_idsByChildNodeFromNodeById, T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + // coreDao.enterMyselfFixPosition(onlyPasteMyselfFromJstree); + logger.debug("-----------------------enterMyselfFixPosition-----------------------"); + + T childEnterMyselfFixPosition = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + childEnterMyselfFixPosition.setC_parentid(ref); + childEnterMyselfFixPosition.setC_position(c_position); + jsTreeHibernateDao.update(childEnterMyselfFixPosition); + + } + + @SuppressWarnings("unchecked") + private void enterMyselfFixLeftRight(long idif, long ldif, + Collection c_idsByChildNodeFromNodeById, T jsTreeHibernateDTO) { + // coreDao.enterMyselfFixLeftRight(onlyPasteMyselfFromJstree); + logger.debug("-----------------------enterMyselfFixLeftRight-----------------------"); + DetachedCriteria detachedEnterMyselfFixLeftRightCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO + .getClass()); + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + Criterion whereEnterMyselfFixLeftRight = Restrictions.in("c_id", c_idsByChildNodeFromNodeById); + detachedEnterMyselfFixLeftRightCriteria.add(whereEnterMyselfFixLeftRight); + detachedEnterMyselfFixLeftRightCriteria.addOrder(Order.asc("c_id")); + + List enterMyselfFixLeftRightList = jsTreeHibernateDao + .getListWithoutPaging(detachedEnterMyselfFixLeftRightCriteria); + for (T perEnterMyselfFixLeftRightList : enterMyselfFixLeftRightList) { + logger.debug(perEnterMyselfFixLeftRightList.toString()); + perEnterMyselfFixLeftRightList.setC_left(perEnterMyselfFixLeftRightList.getC_left() - idif); + perEnterMyselfFixLeftRightList.setC_right(perEnterMyselfFixLeftRightList.getC_right() - idif); + perEnterMyselfFixLeftRightList.setC_level(perEnterMyselfFixLeftRightList.getC_level() - ldif); + jsTreeHibernateDao.update(perEnterMyselfFixLeftRightList); + } + } + } + + @SuppressWarnings("unchecked") + private void fixPositionParentIdOfCopyNodes(long insertSeqResult, + long position, T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + + // T node = ((T) coreDao.getNode(comprehensiveTree)); + T node = (T) jsTreeHibernateDao.getUnique(insertSeqResult); + + // List children = ((List) coreDao.getChildNodeByLeftRight(node)); + logger.debug("-----------------------fixPositionParentIdOfCopyNodes 완료-----------------------"); + DetachedCriteria getChildNodeByLeftRightCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereChildNodeByLeftRight = Restrictions.ge("c_left", node.getC_left()); + getChildNodeByLeftRightCriteria.add(whereChildNodeByLeftRight); + getChildNodeByLeftRightCriteria.add(Restrictions.and(Restrictions.le("c_right", node.getC_right()))); + getChildNodeByLeftRightCriteria.addOrder(Order.asc("c_left")); + List children = jsTreeHibernateDao.getListWithoutPaging(getChildNodeByLeftRightCriteria); + + Map parentIds = new HashMap(); + + for (T child : children) { + for (long i = child.getC_left() + 1; i < child.getC_right(); i++) { + long parentId = child.getC_id(); + parentIds.put(i, parentId); + } + + if (child.getC_id() == insertSeqResult) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>> 기준노드가 잡혔음."); + logger.debug("C_TITLE = " + child.getC_title()); + logger.debug("C_ID = " + insertSeqResult); + logger.debug("C_POSITION = " + position); + } + + node.setC_position(position); + + // coreDao.fixCopyIF(onlyFixCopyFromJstree); + jsTreeHibernateDao.update(node); + continue; + } + + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>> 기준노드 아래 있는 녀석임"); + logger.debug("C_TITLE = " + child.getC_title()); + logger.debug("C_ID = " + child.getC_id()); + logger.debug("C_POSITION = " + child.getC_position()); + logger.debug("C_PARENTID = " + child.getC_parentid()); + logger.debug("부모아이디값 = " + parentIds.get(child.getC_left())); + } + + // coreDao.fixCopy(child); + child.setFixCopyId(parentIds.get(child.getC_left())); + child.setC_parentid(parentIds.get(child.getC_left())); + jsTreeHibernateDao.update(child); + } + } + + @SuppressWarnings("unchecked") + private long pasteMyselfFromJstree(long ref, long idif, + long spaceOfTargetNode, long ldif, Collection c_idsByChildNodeFromNodeById, + long rightPositionFromNodeByRef, T nodeById) throws Exception { + + jsTreeHibernateDao.setClazz(nodeById.getClass()); + + T onlyPasteMyselfFromJstree = getNode(nodeById); + + onlyPasteMyselfFromJstree.setRef(ref); + onlyPasteMyselfFromJstree.setIdif(idif); + onlyPasteMyselfFromJstree.setSpaceOfTargetNode(spaceOfTargetNode); + onlyPasteMyselfFromJstree.setLdif(ldif); + onlyPasteMyselfFromJstree.setC_idsByChildNodeFromNodeById(c_idsByChildNodeFromNodeById); + onlyPasteMyselfFromJstree.setRightPositionFromNodeByRef(rightPositionFromNodeByRef); + onlyPasteMyselfFromJstree.setNodeById(nodeById); + + onlyPasteMyselfFromJstree.setIdifLeft(idif + + (nodeById.getC_left() >= rightPositionFromNodeByRef ? spaceOfTargetNode : 0)); + onlyPasteMyselfFromJstree.setIdifRight(idif + + (nodeById.getC_left() >= rightPositionFromNodeByRef ? spaceOfTargetNode : 0)); + + // coreDao.pasteMyselfFromJstree(onlyPasteMyselfFromJstree); + DetachedCriteria detachedPasteMyselfFromJstreeCriteria = DetachedCriteria.forClass(nodeById + .getClass()); + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + Criterion wherePasteMyselfFromJstree = Restrictions.in("c_id", c_idsByChildNodeFromNodeById); + detachedPasteMyselfFromJstreeCriteria.add(wherePasteMyselfFromJstree); + detachedPasteMyselfFromJstreeCriteria.addOrder(Order.desc("c_level")); + + List pasteMyselfFromJstreeList = jsTreeHibernateDao + .getListWithoutPaging(detachedPasteMyselfFromJstreeCriteria); + for (T perPasteMyselfFromJstree : pasteMyselfFromJstreeList) { + logger.debug("------pasteMyselfFromJstree------LOOP---" + perPasteMyselfFromJstree.getC_id()); + T addTarget = newInstance(perPasteMyselfFromJstree); + + //디폴트 셋팅. + addTarget.setC_parentid(onlyPasteMyselfFromJstree.getRef()); + addTarget.setC_position(perPasteMyselfFromJstree.getC_position()); + addTarget.setC_left(perPasteMyselfFromJstree.getC_left() - onlyPasteMyselfFromJstree.getIdifLeft()); + addTarget.setC_right(perPasteMyselfFromJstree.getC_right() - onlyPasteMyselfFromJstree.getIdifRight()); + addTarget.setC_level(perPasteMyselfFromJstree.getC_level() - onlyPasteMyselfFromJstree.getLdif()); + addTarget.setC_title(perPasteMyselfFromJstree.getC_title()); + addTarget.setC_type(perPasteMyselfFromJstree.getC_type()); + + addTarget.setFieldFromNewInstance(perPasteMyselfFromJstree); + logger.debug("여기에 추가적으로 확장한 필드에 대한 함수가 들어가야 한다 패턴을 쓰자"); + + long insertSeqResult = (long) jsTreeHibernateDao.insert(addTarget); + perPasteMyselfFromJstree.setId(insertSeqResult); + + if (insertSeqResult > 0) { + return insertSeqResult; + } else { + throw new RuntimeException("심각한 오류 발생 - 삽입 노드"); + } + } + } + + return 0; + } + + @SuppressWarnings("unchecked") + private void stretchPositionForMyselfFromJstree( + Collection c_idsByChildNodeFromNodeById, T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + jsTreeHibernateDTO.setC_idsByChildNodeFromNodeById(c_idsByChildNodeFromNodeById); + + DetachedCriteria detachedStretchPositionForMyselfCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO + .getClass()); + Criterion whereStretchPositionForMyself = Restrictions.eq("c_parentid", jsTreeHibernateDTO.getRef()); + detachedStretchPositionForMyselfCriteria.add(whereStretchPositionForMyself); + detachedStretchPositionForMyselfCriteria.add(Restrictions.and(Restrictions.ge("c_position", + jsTreeHibernateDTO.getC_position()))); + if (jsTreeHibernateDTO.getCopy() == 0) { + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + detachedStretchPositionForMyselfCriteria.add(Restrictions.and(Restrictions.not(Restrictions.in("c_id", + c_idsByChildNodeFromNodeById)))); + } + } + detachedStretchPositionForMyselfCriteria.addOrder(Order.asc("c_id")); + + List stretchPositionForMyselfList = jsTreeHibernateDao + .getListWithoutPaging(detachedStretchPositionForMyselfCriteria); + for (T perStretchPositionForMyself : stretchPositionForMyselfList) { + perStretchPositionForMyself.setC_position(perStretchPositionForMyself.getC_position() + 1); + jsTreeHibernateDao.update(perStretchPositionForMyself); + } + + } + + private void calculatePostion(T jsTreeHibernateDTO, T nodeById, + List childNodesFromNodeByRef, HttpServletRequest request) throws Exception { + HttpSession session = request.getSession(); + + final boolean isMoveNodeInMyParent = (jsTreeHibernateDTO.getRef() == nodeById.getC_parentid()); + final boolean isMultiCounterZero = (jsTreeHibernateDTO.getMultiCounter() == 0); + final boolean isBeyondTheCurrentToMoveNodes = (jsTreeHibernateDTO.getC_position() > nodeById.getC_position()); + + if (isMoveNodeInMyParent) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>이동할 노드가 내 부모안에서 움직일때"); + } + + if (isMultiCounterZero) { + if (isBeyondTheCurrentToMoveNodes) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>이동 할 노드가 현재보다 뒤일때"); + logger.debug("노드값=" + nodeById.getC_title()); + logger.debug("노드의 초기 위치값=" + nodeById.getC_position()); + logger.debug("노드의 요청받은 위치값=" + jsTreeHibernateDTO.getC_position()); + logger.debug("노드의 요청받은 멀티카운터=" + jsTreeHibernateDTO.getMultiCounter()); + } + + final boolean isFolderToMoveNodes = (jsTreeHibernateDTO.getC_position() > childNodesFromNodeByRef + .size()); + + if (isFolderToMoveNodes) { + if (logger.isDebugEnabled()) { + logger.debug("노드 이동시 폴더를 대상으로 했을때 생기는 버그 발생 =" + jsTreeHibernateDTO.getC_position()); + } + long childNodesFromNodeByRefCnt = childNodesFromNodeByRef.size(); + jsTreeHibernateDTO.setC_position(childNodesFromNodeByRefCnt); + } else { + jsTreeHibernateDTO.setC_position(jsTreeHibernateDTO.getC_position() - 1); + } + } + + if (logger.isDebugEnabled()) { + logger.debug("노드의 최종 위치값=" + jsTreeHibernateDTO.getC_position()); + } + session.setAttribute("settedPosition", jsTreeHibernateDTO.getC_position()); + } else { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>멀티 카운터가 0 이 아닐때"); + logger.debug("노드값=" + nodeById.getC_title()); + logger.debug("노드의 초기 위치값=" + nodeById.getC_position()); + logger.debug("노드의 요청받은 위치값=" + jsTreeHibernateDTO.getC_position()); + logger.debug("노드의 요청받은 멀티카운터=" + jsTreeHibernateDTO.getMultiCounter()); + logger.debug("0번 노드의 위치값=" + session.getAttribute("settedPosition")); + } + + long increasePosition = 0; + + final boolean isMultiNodeOfPositionsAtZeroThanBehind = ((Integer) session + .getAttribute("settedPosition") < nodeById.getC_position()); + + if (isMultiNodeOfPositionsAtZeroThanBehind) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>멀티 노드의 위치가 0번 노드보다 뒤일때"); + } + + increasePosition = (Integer) session.getAttribute("settedPosition") + 1; + } else { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>멀티 노드의 위치가 0번 노드보다 앞일때"); + } + + if (jsTreeHibernateDTO.isCopied()) { + increasePosition = (Integer) session.getAttribute("settedPosition") + 1; + } else { + increasePosition = (Integer) session.getAttribute("settedPosition"); + } + + } + session.setAttribute("settedPosition", increasePosition); + + jsTreeHibernateDTO.setC_position(increasePosition); + + final boolean isSamePosition = (nodeById.getC_position() == jsTreeHibernateDTO.getC_position()); + + if (isSamePosition) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>원래 노드 위치값과 최종 계산된 노드의 위치값이 동일한 경우"); + } + + session.setAttribute("settedPosition", increasePosition - 1); + } + + if (logger.isDebugEnabled()) { + logger.debug("노드의 최종 위치값=" + jsTreeHibernateDTO.getC_position()); + } + } + } else { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>이동할 노드가 내 부모밖으로 움직일때"); + } + + if (isMultiCounterZero) { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>멀티 카운터가 0 일때"); + logger.debug("노드값=" + nodeById.getC_title()); + logger.debug("노드의 초기 위치값=" + nodeById.getC_position()); + logger.debug("노드의 요청받은 위치값=" + jsTreeHibernateDTO.getC_position()); + logger.debug("노드의 요청받은 멀티카운터=" + jsTreeHibernateDTO.getMultiCounter()); + logger.debug("노드의 최종 위치값=" + jsTreeHibernateDTO.getC_position()); + } + + session.setAttribute("settedPosition", jsTreeHibernateDTO.getC_position()); + } else { + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>멀티 카운터가 0 이 아닐때"); + logger.debug("노드값=" + nodeById.getC_title()); + logger.debug("노드의 초기 위치값=" + nodeById.getC_position()); + logger.debug("노드의 요청받은 위치값=" + jsTreeHibernateDTO.getC_position()); + logger.debug("노드의 요청받은 멀티카운터=" + jsTreeHibernateDTO.getMultiCounter()); + } + + long increasePosition = 0; + increasePosition = NumberUtils.toLong(session.getAttribute("settedPosition").toString()) + 1; + jsTreeHibernateDTO.setC_position(increasePosition); + session.setAttribute("settedPosition", increasePosition); + + if (logger.isDebugEnabled()) { + logger.debug("노드의 최종 위치값=" + jsTreeHibernateDTO.getC_position()); + } + } + } + } + + @SuppressWarnings("unchecked") + private void cutMyself(T nodeById, long spaceOfTargetNode, + Collection c_idsByChildNodeFromNodeById) throws Exception { + + jsTreeHibernateDao.setClazz(nodeById.getClass()); + nodeById.setSpaceOfTargetNode(spaceOfTargetNode); + nodeById.setC_idsByChildNodeFromNodeById(c_idsByChildNodeFromNodeById); + + logger.debug("***********************CutMyself***********************"); + logger.debug("-----------------------cutMyselfPositionFix-----------------------"); + DetachedCriteria cutMyselfPositionFixCriteria = DetachedCriteria.forClass(nodeById.getClass()); + Criterion whereCutMyselfPositionFix = Restrictions.eq("c_parentid", nodeById.getC_parentid()); + cutMyselfPositionFixCriteria.add(whereCutMyselfPositionFix); + cutMyselfPositionFixCriteria.add(Restrictions.and(Restrictions.gt("c_position", nodeById.getC_position()))); + cutMyselfPositionFixCriteria.addOrder(Order.asc("c_id")); + List childCutMyselfPositionFix = jsTreeHibernateDao.getListWithoutPaging(cutMyselfPositionFixCriteria); + for (T perNodeById : childCutMyselfPositionFix) { + perNodeById.setC_position(perNodeById.getC_position() - 1); + jsTreeHibernateDao.update(perNodeById); + } + + logger.debug("-----------------------cutMyselfLeftFix-----------------------"); + DetachedCriteria cutMyselfLeftFixCriteria = DetachedCriteria.forClass(nodeById.getClass()); + Criterion whereCutMyselfLeftFix = Restrictions.gt("c_left", nodeById.getC_right()); + cutMyselfLeftFixCriteria.add(whereCutMyselfLeftFix); + cutMyselfLeftFixCriteria.addOrder(Order.asc("c_id")); + List childCutMyselfLeftFix = jsTreeHibernateDao.getListWithoutPaging(cutMyselfLeftFixCriteria); + for (T perCutMyselfLeftFix : childCutMyselfLeftFix) { + perCutMyselfLeftFix.setC_left(perCutMyselfLeftFix.getC_left() - spaceOfTargetNode); + jsTreeHibernateDao.update(perCutMyselfLeftFix); + } + + logger.debug("-----------------------cutMyselfRightFix-----------------------"); + DetachedCriteria cutMyselfRightFixCriteria = DetachedCriteria.forClass(nodeById.getClass()); + Criterion whereCutMyselfRightFix = Restrictions.gt("c_right", nodeById.getC_left()); + cutMyselfRightFixCriteria.add(whereCutMyselfRightFix); + if (c_idsByChildNodeFromNodeById != null && c_idsByChildNodeFromNodeById.size() > 0) { + cutMyselfRightFixCriteria.add(Restrictions.and(Restrictions.not(Restrictions.in("c_id", + c_idsByChildNodeFromNodeById)))); + } + cutMyselfRightFixCriteria.addOrder(Order.asc("c_id")); + List childCutMyselfRightFix = jsTreeHibernateDao.getListWithoutPaging(cutMyselfRightFixCriteria); + for (T perCutMyselfRightFix : childCutMyselfRightFix) { + perCutMyselfRightFix.setC_right(perCutMyselfRightFix.getC_right() - spaceOfTargetNode); + jsTreeHibernateDao.update(perCutMyselfRightFix); + } + + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,484 @@ +package egovframework.com.ext.jstree.springHibernate.core.vo; + +import java.io.Serializable; +import java.util.Collection; +import java.util.HashMap; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import javax.persistence.Transient; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +@MappedSuperclass +public abstract class JsTreeHibernateBaseDTO implements Serializable { + + private static final long serialVersionUID = -1686737481473490738L; + + /** 노드의 고유 id, 1부터 시작(Root Node) */ + private Long c_id; + + /** 노드의 부모 id, 0부터 시작(Root Node) */ + private Long c_parentid; + + /** Parent의 몇 번째 자식인지를 나타냄. 0부터 시작 */ + private Long c_position; + + /** 노드의 left 위치, 1부터 시작(Root Node) */ + private Long c_left; + + /** 노드의 right 위치, 자식이 없다면 left + 1의 값을 가진다. */ + private Long c_right; + + /** 노드의 depth, 0부터 시작 */ + private Long c_level; + + /** Node 의 title */ + private String c_title; + + /** + *
+	 * 노드의 type
+	 * root : root 노드
+	 * drive : first child 노드
+	 * folder : branch 노드
+	 * default : leaf 노드
+	 * 
+ */ + private String c_type; + + /* + * Common Use Field + */ + /** 참조하고 있는 노드의 id */ + private long ref; + + /** copy 시 1의 값을 가짐. */ + private long copy; + + private long multiCounter; + + private long status; + /** ajax 처리 결과 메시지 */ + private String ajaxMessage; + + private String childcount; + + /** 검색시 Keyword */ + private String searchStr; + + private long idif; + private long ldif; + + /** 노드가 차지하는 공간 (right - left + 1) */ + private long spaceOfTargetNode; + + /** 임의 노드의 자식 노드들의 id만을 저장하는 컬렉션 */ + private Collection c_idsByChildNodeFromNodeById; + + private long fixCopyId; + private long fixCopyPosition; + + /** 참조 노드의 right */ + private long rightPositionFromNodeByRef; + + private JsTreeHibernateBaseDTO nodeById; + + private long idifLeft; + private long idifRight; + + private long id; // moveNode + private final HashMap attr; + private volatile long hashCode; + + public JsTreeHibernateBaseDTO() { + super(); + attr = new HashMap(); + } + + public JsTreeHibernateBaseDTO(Long c_id, Long c_parentid, Long c_position, Long c_left, + Long c_right, Long c_level, String c_title, String c_type, long ref, long copy, long multiCounter, + long status, String ajaxMessage, String childcount, String searchStr, long idif, long ldif, + long spaceOfTargetNode, Collection c_idsByChildNodeFromNodeById, long fixCopyId, + long fixCopyPosition, long rightPositionFromNodeByRef, JsTreeHibernateBaseDTO nodeById, long idifLeft, + long idifRight, long id) { + super(); + this.c_id = c_id; + this.c_parentid = c_parentid; + this.c_position = c_position; + this.c_left = c_left; + this.c_right = c_right; + this.c_level = c_level; + this.c_title = c_title; + this.c_type = c_type; + this.ref = ref; + this.copy = copy; + this.multiCounter = multiCounter; + this.status = status; + this.ajaxMessage = ajaxMessage; + this.childcount = childcount; + this.searchStr = searchStr; + this.idif = idif; + this.ldif = ldif; + this.spaceOfTargetNode = spaceOfTargetNode; + this.c_idsByChildNodeFromNodeById = c_idsByChildNodeFromNodeById; + this.fixCopyId = fixCopyId; + this.fixCopyPosition = fixCopyPosition; + this.rightPositionFromNodeByRef = rightPositionFromNodeByRef; + this.nodeById = nodeById; + this.idifLeft = idifLeft; + this.idifRight = idifRight; + this.id = id; + attr = new HashMap(); + } + + @Id + @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="JsTreeSequence") + @Column(name = "c_id") + public Long getC_id() { + return c_id; + } + + public void setC_id(Long c_id) { + this.c_id = c_id; + } + + @Column(name = "c_parentid") + public Long getC_parentid() { + return c_parentid; + } + + public void setC_parentid(Long c_parentid) { + this.c_parentid = c_parentid; + } + + @Column(name = "c_position") + public Long getC_position() { + return c_position; + } + + public void setC_position(Long c_position) { + this.c_position = c_position; + } + + @Column(name = "c_left") + public Long getC_left() { + return c_left; + } + + public void setC_left(Long c_left) { + this.c_left = c_left; + } + + @Column(name = "c_right") + public Long getC_right() { + return c_right; + } + + public void setC_right(Long c_right) { + this.c_right = c_right; + } + + @Column(name = "c_level") + public Long getC_level() { + return c_level; + } + + public void setC_level(Long c_level) { + this.c_level = c_level; + } + + @Column(name = "c_title") + public String getC_title() { + return c_title; + } + + public void setC_title(String c_title) { + this.c_title = c_title; + } + + @Column(name = "c_type") + public String getC_type() { + return c_type; + } + + public void setC_type(String c_type) { + this.c_type = c_type; + } + + @Transient + public String getData() { + return c_title; + } + + @Transient + public boolean isCopied() { + return this.getCopy() == 1; + } + + @Transient + public long getRef() { + return ref; + } + + public void setRef(long ref) { + this.ref = ref; + } + + @Transient + public long getCopy() { + return copy; + } + + public void setCopy(long copy) { + this.copy = copy; + } + + @Transient + public long getMultiCounter() { + return multiCounter; + } + + public void setMultiCounter(long multiCounter) { + this.multiCounter = multiCounter; + } + + @Transient + public String getState() { + String returnCode = new String(); + + if (getChildcount() == null || getChildcount().equals(" ")) { + returnCode = "update status"; + } else if (getChildcount().equals("InChild")) { + returnCode = "closed"; + } else { + returnCode = "leafNode"; + } + return returnCode; + } + + @Transient + public long getStatus() { + return status; + } + + public void setStatus(long status) { + this.status = status; + } + + @Transient + public String getChildcount() { + if((c_right - c_left)>1){ + return "InChild"; + } + return "NoChild"; + } + + public void setChildcount(String childcount) { + this.childcount = childcount; + } + + @Transient + public long getFixCopyId() { + return fixCopyId; + } + + public void setFixCopyId(long fixCopyId) { + this.fixCopyId = fixCopyId; + } + + @Transient + public String getAjaxMessage() { + return ajaxMessage; + } + + public void setAjaxMessage(String ajaxMessage) { + this.ajaxMessage = ajaxMessage; + } + + @Transient + public String getSearchStr() { + return searchStr; + } + + public void setSearchStr(String searchStr) { + this.searchStr = searchStr; + } + + @Transient + public long getIdif() { + return idif; + } + + public void setIdif(long idif) { + this.idif = idif; + } + + @Transient + public long getLdif() { + return ldif; + } + + public void setLdif(long ldif) { + this.ldif = ldif; + } + + @Transient + public long getSpaceOfTargetNode() { + return spaceOfTargetNode; + } + + public void setSpaceOfTargetNode(long spaceOfTargetNode) { + this.spaceOfTargetNode = spaceOfTargetNode; + } + + @Transient + public Collection getC_idsByChildNodeFromNodeById() { + return c_idsByChildNodeFromNodeById; + } + + public void setC_idsByChildNodeFromNodeById(Collection c_idsByChildNodeFromNodeById) { + this.c_idsByChildNodeFromNodeById = c_idsByChildNodeFromNodeById; + } + + @Transient + public long getFixCopyPosition() { + return fixCopyPosition; + } + + public void setFixCopyPosition(long fixCopyPosition) { + this.fixCopyPosition = fixCopyPosition; + } + + @Transient + public long getRightPositionFromNodeByRef() { + return rightPositionFromNodeByRef; + } + + public void setRightPositionFromNodeByRef(long rightPositionFromNodeByRef) { + this.rightPositionFromNodeByRef = rightPositionFromNodeByRef; + } + + @Transient + public JsTreeHibernateBaseDTO getNodeById() { + return nodeById; + } + + public void setNodeById(JsTreeHibernateBaseDTO nodeById) { + this.nodeById = nodeById; + } + + @Transient + public long getIdifLeft() { + return idifLeft; + } + + public void setIdifLeft(long idifLeft) { + this.idifLeft = idifLeft; + } + + @Transient + public long getIdifRight() { + return idifRight; + } + + public void setIdifRight(long idifRight) { + this.idifRight = idifRight; + } + + @Transient + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Transient + public HashMap getAttr() { + attr.put("id", "node_" + c_id); + attr.put("rel", c_type); + return attr; + } + + @Override + @Transient + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + + @Override + @Transient + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + JsTreeHibernateBaseDTO that = (JsTreeHibernateBaseDTO) o; + + if (c_id != that.c_id) + return false; + if (c_left != that.c_left) + return false; + if (c_level != that.c_level) + return false; + if (c_parentid != that.c_parentid) + return false; + if (c_position != that.c_position) + return false; + if (c_right != that.c_right) + return false; + if (copy != that.copy) + return false; + if (fixCopyId != that.fixCopyId) + return false; + if (fixCopyPosition != that.fixCopyPosition) + return false; + if (hashCode != that.hashCode) + return false; + if (id != that.id) + return false; + if (idif != that.idif) + return false; + if (idifLeft != that.idifLeft) + return false; + if (idifRight != that.idifRight) + return false; + if (ldif != that.ldif) + return false; + if (multiCounter != that.multiCounter) + return false; + if (ref != that.ref) + return false; + if (rightPositionFromNodeByRef != that.rightPositionFromNodeByRef) + return false; + if (spaceOfTargetNode != that.spaceOfTargetNode) + return false; + if (status != that.status) + return false; + if (!attr.equals(that.attr)) + return false; + if (c_idsByChildNodeFromNodeById != null ? !c_idsByChildNodeFromNodeById + .equals(that.c_idsByChildNodeFromNodeById) : that.c_idsByChildNodeFromNodeById != null) + return false; + if (c_title != null ? !c_title.equals(that.c_title) : that.c_title != null) + return false; + if (c_type != null ? !c_type.equals(that.c_type) : that.c_type != null) + return false; + if (childcount != null ? !childcount.equals(that.childcount) : that.childcount != null) + return false; + if (nodeById != null ? !nodeById.equals(that.nodeById) : that.nodeById != null) + return false; + if (searchStr != null ? !searchStr.equals(that.searchStr) : that.searchStr != null) + return false; + + return true; + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,65 @@ +package egovframework.com.ext.jstree.springHibernate.core.vo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import org.hibernate.annotations.SelectBeforeUpdate; + +@Entity +@Table(name = "T_COMPREHENSIVETREE_HIBER") +@SelectBeforeUpdate(value=true) +@DynamicInsert(value=true) +@DynamicUpdate(value=true) +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +@SequenceGenerator(name = "JsTreeSequence", sequenceName = "hibernate_sequence", allocationSize = 1) +public class JsTreeHibernateDTO extends JsTreeHibernateSearchDTO implements Serializable { + + private static final long serialVersionUID = -6859122566734590165L; + + public JsTreeHibernateDTO() { + super(); + } + + public JsTreeHibernateDTO(Boolean copyBooleanValue) { + super(); + this.copyBooleanValue = copyBooleanValue; + } + + /* + * Extend Bean Field + */ + private Boolean copyBooleanValue; + + @Transient + public Boolean getCopyBooleanValue() { + copyBooleanValue = false; + if (this.getCopy() == 0) { + copyBooleanValue = false; + } else { + copyBooleanValue = true; + } + return copyBooleanValue; + } + + public void setCopyBooleanValue(Boolean copyBooleanValue) { + this.copyBooleanValue = copyBooleanValue; + } + + @Override + public void setFieldFromNewInstance(T paramInstance) { + + if( paramInstance instanceof JsTreeHibernateDTO){ + this.setC_title("copy_" + this.getC_title()); + //여기에 추가 필드 셋팅할것. + } + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,230 @@ +package egovframework.com.ext.jstree.springHibernate.core.vo; + +import java.io.Serializable; + +import javax.persistence.MappedSuperclass; +import javax.persistence.Transient; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +@MappedSuperclass +public abstract class JsTreeHibernatePaginatedDTO extends JsTreeHibernateBaseDTO implements Serializable{ + + private static final long serialVersionUID = 3465234289025484577L; + + + /** 검색조건 */ + @JsonIgnore + private String searchCondition = ""; + + /** 검색Keyword */ + @JsonIgnore + private String searchKeyword = ""; + + /** 검색사용여부 */ + @JsonIgnore + private String searchUseYn = ""; + + /** 현재페이지 */ + @JsonIgnore + private int pageIndex = 1; + + /** 페이지갯수 */ + @JsonIgnore + private int pageUnit = 10; + + /** 페이지사이즈 */ + @JsonIgnore + private int pageSize = 10; + + /** firstIndex */ + @JsonIgnore + private int firstIndex = 1; + + /** lastIndex */ + @JsonIgnore + private int lastIndex = 1; + + /** recordCountPerPage */ + @JsonIgnore + private int recordCountPerPage = 10; + + /** 검색KeywordFrom */ + @JsonIgnore + private String searchKeywordFrom = ""; + + /** 검색KeywordTo */ + @JsonIgnore + private String searchKeywordTo = ""; + + @JsonIgnore + PaginationInfo paginationInfo = new PaginationInfo(); + + public JsTreeHibernatePaginatedDTO() { + super(); + paginationSetting(); + } + + public JsTreeHibernatePaginatedDTO(String searchCondition, String searchKeyword, String searchUseYn, int pageIndex, + int pageUnit, int pageSize, int firstIndex, int lastIndex, int recordCountPerPage, + String searchKeywordFrom, String searchKeywordTo) { + super(); + this.searchCondition = searchCondition; + this.searchKeyword = searchKeyword; + this.searchUseYn = searchUseYn; + this.pageIndex = pageIndex; + this.pageUnit = pageUnit; + this.pageSize = pageSize; + this.firstIndex = firstIndex; + this.lastIndex = lastIndex; + this.recordCountPerPage = recordCountPerPage; + this.searchKeywordFrom = searchKeywordFrom; + this.searchKeywordTo = searchKeywordTo; + paginationSetting(); + } + + private void paginationSetting() { + paginationInfo.setCurrentPageNo(getPageIndex()); + paginationInfo.setRecordCountPerPage(getPageUnit()); + paginationInfo.setPageSize(getPageSize()); + + this.setFirstIndex(paginationInfo.getFirstRecordIndex()); + this.setLastIndex(paginationInfo.getLastRecordIndex()); + this.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + } + + + @Transient + public int getFirstIndex() { + return firstIndex; + } + + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + @Transient + public int getLastIndex() { + return lastIndex; + } + + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + @Transient + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + @Transient + public String getSearchCondition() { + return searchCondition; + } + + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + @Transient + public String getSearchKeyword() { + return searchKeyword; + } + + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + @Transient + public String getSearchUseYn() { + return searchUseYn; + } + + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + @Transient + public int getPageIndex() { + return pageIndex; + } + + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + @Transient + public int getPageUnit() { + return pageUnit; + } + + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + @Transient + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + @Transient + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + + /** + * searchKeywordFrom attribute를 리턴한다. + * @return String + */ + @Transient + public String getSearchKeywordFrom() { + return searchKeywordFrom; + } + + /** + * searchKeywordFrom attribute 값을 설정한다. + * @param searchKeywordFrom String + */ + public void setSearchKeywordFrom(String searchKeywordFrom) { + this.searchKeywordFrom = searchKeywordFrom; + } + + /** + * searchKeywordTo attribute를 리턴한다. + * @return String + */ + @Transient + public String getSearchKeywordTo() { + return searchKeywordTo; + } + + /** + * searchKeywordTo attribute 값을 설정한다. + * @param searchKeywordTo String + */ + public void setSearchKeywordTo(String searchKeywordTo) { + this.searchKeywordTo = searchKeywordTo; + } + + @Transient + public PaginationInfo getPaginationInfo() { + return paginationInfo; + } + + public void setPaginationInfo(PaginationInfo paginationInfo) { + this.paginationInfo = paginationInfo; + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,213 @@ +package egovframework.com.ext.jstree.springHibernate.core.vo; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Transient; + +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projection; +import org.hibernate.criterion.Restrictions; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import egovframework.com.ext.jstree.support.util.StringUtils; +import egovframework.com.ext.jstree.support.util.Text; + +public abstract class JsTreeHibernateSearchDTO extends JsTreeHibernatePaginatedDTO implements Serializable { + + private static final long serialVersionUID = 2591336265806317114L; + @JsonIgnore + private List order = new ArrayList<>(); + @JsonIgnore + private List criterions = new ArrayList<>(); + @JsonIgnore + private Projection projection; + @JsonIgnore + private Map whereMap = new HashMap<>(); + @JsonIgnore + private int whereCount = 0; + + public JsTreeHibernateSearchDTO() { + super(); + } + + public JsTreeHibernateSearchDTO(List order, List criterions, Projection projection, + Map whereMap, int whereCount) { + super(); + this.order = order; + this.criterions = criterions; + this.projection = projection; + this.whereMap = whereMap; + this.whereCount = whereCount; + } + + public abstract void setFieldFromNewInstance(T paramInstance); + + @Transient + public List getOrder() { + return order; + } + + public void setOrder(Order order) { + this.order.add(order); + } + + @Transient + public List getCriterions() { + return criterions; + } + + @Transient + public String getWhereMap(String key) { + if (this.whereMap.containsKey(key)) { + String value = (String) whereMap.get(key); + + return " \"" + StringUtils.replace(value, "\"", "\\\"") + "\""; + } + return " \"\""; + } + + @Transient + public int getWhereCount() { + return whereCount; + } + + public void setWhere(String propertyName, Object value) { + if (null == value) { + return; + } + + this.whereMap.put(propertyName, value); + this.whereCount++; + + if (value instanceof String) { + String str = (String) value; + + if (!StringUtils.isEmpty(str)) { + if (StringUtils.startsWith(str, "*") && StringUtils.endsWith(str, "*")) { + str = StringUtils.removeEnd(str, "*"); + str = StringUtils.removeStart(str, "*"); + criterions.add(Restrictions.like(propertyName, str, MatchMode.ANYWHERE)); + } else if (StringUtils.startsWith(str, "*")) { + str = StringUtils.removeStart(str, "*"); + criterions.add(Restrictions.like(propertyName, str, MatchMode.END)); + } else if (StringUtils.endsWith(str, "*")) { + str = StringUtils.removeEnd(str, "*"); + criterions.add(Restrictions.like(propertyName, str, MatchMode.START)); + } else if (StringUtils.startsWith(str, "isNotNull")) { + criterions.add(Restrictions.isNotNull(propertyName)); + } else { + criterions.add(Restrictions.eq(propertyName, str)); + } + } + } else { + criterions.add(Restrictions.eq(propertyName, value)); + } + } + + public void setWhereLike(String propertyName, String str) { + if (!StringUtils.isEmpty(str)) { + if (!StringUtils.startsWith(str, "*")) { + str = "*" + str; + } + + if (!StringUtils.endsWith(str, "*")) { + str = str + "*"; + } + + setWhere(propertyName, str); + } + } + + public void setWhereOr(Criterion... criterions) { + Disjunction or = Restrictions.disjunction(); + for (Criterion criterion : criterions) { + or.add(criterion); + } + this.criterions.add(or); + } + + public void setWhereOr(List criterions) { + Disjunction or = Restrictions.disjunction(); + for (Criterion criterion : criterions) { + or.add(criterion); + } + this.criterions.add(or); + } + + public void setWhere(Criterion criterion) { + criterions.add(criterion); + } + + public void setWhere(Projection projection) { + this.projection = projection; + } + + @Transient + public Projection getProjection() { + return projection; + } + + public void setWhereBetween(String propertyName, Object lo, Object hi) { + if (null != lo && null != hi) { + criterions.add(Restrictions.between(propertyName, lo, hi)); + } + } + + public void setWhereIn(String propertyName, Collection values) { + criterions.add(Restrictions.in(propertyName, values)); + } + + public void setWhereIn(String propertyName, Object[] values) { + criterions.add(Restrictions.in(propertyName, values)); + } + + public void setWhereIp(String propertyName, String value, String propertyIpStartName, String propertyIpEndName) { + if (null == value) { + return; + } + + boolean flag = Text.isIpv4(value); + if (flag) { + long[] ipLong = Text.ipToLong2(value); + criterions.add(Restrictions.or( + Restrictions.eq(propertyName, value), + Restrictions.and(Restrictions.le(propertyIpStartName, ipLong[0]), + Restrictions.ge(propertyIpEndName, ipLong[1])))); + } else { + setWhere(propertyName, value); + } + + } + + @Transient + public List getMembersCriterions(String propertyName, Object value, String seperator) { + List criterionLists = new ArrayList<>(); + + if (value instanceof String) { + String str = (String) value; + + if (!StringUtils.isEmpty(str)) { + if (StringUtils.startsWith(str, "*") || StringUtils.endsWith(str, "*")) { + str = StringUtils.removeEnd(str, "*"); + str = StringUtils.removeStart(str, "*"); + criterionLists.add(Restrictions.like(propertyName, str, MatchMode.ANYWHERE)); + } else { + String strValue = seperator + str + seperator; + criterionLists.add(Restrictions.sqlRestriction("'" + seperator + "' || " + propertyName + " || '" + + seperator + "' like '%" + strValue + "%'")); + } + } + } + + return criterionLists; + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,128 @@ +package egovframework.com.ext.jstree.support.mvc; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.ext.jstree.support.util.ParameterParser; + +public abstract class GenericAbstractController { + + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + @Autowired + private DefaultBeanValidator defaultBeanValidator; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public ParameterParser getParameterParser(HttpServletRequest request){ + return new ParameterParser(request); + } + + public T invokeBeanValidate(T clazz, BindingResult bindingResult) { + defaultBeanValidator.validate(clazz, bindingResult); + if (bindingResult.hasErrors()) { // 만일 validation 에러가 있으면... + logger.error(clazz.getClass() + " validate error"); + return clazz; + } + return clazz; + } + + @ExceptionHandler(Exception.class) + public void defenceException(Exception ex, HttpServletResponse response, HttpServletRequest request) + throws IOException { + if (logger.isDebugEnabled()) { + ex.printStackTrace(); + } + + response.setHeader("Expires", "-1"); + response.setHeader("Cache-Control", "must-revalidate, no-store, no-cache"); + response.addHeader("Cache-Control", "post-check=0, pre-check=0"); + response.setHeader("Pragma", "no-cache"); + response.setContentType("application/json; charset=UTF-8"); + PrintWriter out = response.getWriter(); + Map map = new HashMap(); + map.put("status", 0); + Gson gson = new GsonBuilder().serializeNulls().create(); + out.println(gson.toJson(map)); + out.flush(); + out.close(); + return; +/* if (StringUtils.equals(request.getHeader("customHeader"), "ajax")) { + response.setContentType("application/json; charset=UTF-8"); + + Map map = new HashMap(); + map.put("result", false); + map.put("status", 0); + // map.put("message", + // egovMessageSource.getMessage(ex.getMessage(), + // ex.getStackTrace(), "", request)); + map.put("message", egovMessageSource.getMessage(ex.getMessage())); + + Gson gson = new GsonBuilder().serializeNulls().create(); + out.println(gson.toJson(map)); + out.flush(); + out.close(); + return; + } else { + response.setContentType("text/html; charset=utf-8"); + + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + } else { + out.println("parent.warning(getMessage(\"" + ex.getMessage() + "\"))"); + out.println(""); + } + }*/ + + } + + @ExceptionHandler(RuntimeException.class) + public void defenceRuntimeException(RuntimeException ex, HttpServletResponse response, HttpServletRequest request) + throws IOException { + if (logger.isDebugEnabled()) { + ex.printStackTrace(); + } + + response.setHeader("Expires", "-1"); + response.setHeader("Cache-Control", "must-revalidate, no-store, no-cache"); + response.addHeader("Cache-Control", "post-check=0, pre-check=0"); + response.setHeader("Pragma", "no-cache"); + response.setContentType("application/json; charset=UTF-8"); + PrintWriter out = response.getWriter(); + Map map = new HashMap(); + map.put("status", 0); + Gson gson = new GsonBuilder().serializeNulls().create(); + out.println(gson.toJson(map)); + out.flush(); + out.close(); + return; + } + +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/RequestAttribute.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/RequestAttribute.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/RequestAttribute.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,13 @@ +package egovframework.com.ext.jstree.support.mvc; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +public @interface RequestAttribute { + String value(); +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/DateUtils.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/DateUtils.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/DateUtils.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,384 @@ +package egovframework.com.ext.jstree.support.util; + + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; + +public class DateUtils extends org.apache.commons.lang.time.DateUtils{ + + public static DateFormat getDateFormat(String pattern) { + DateFormat df = new SimpleDateFormat(pattern); + return df; + } + + /** + * 문자열로 된 날짜 정보를 Date 형으로 리턴한다. + * @param text 문자열로 된 날짜 정보 + * @param pattern 날짜 패턴 + * @param defaultDate ParsingException이 일어나는 경우 리턴할 Date + */ + public synchronized static Date getDate(String text, String pattern, Date defaultDate) { + DateFormat df = getDateFormat(pattern); + Date result = null; + try { + result = df.parse(text); + } catch (Exception ie) { + result = defaultDate; + } + return result; + } + + /** + * 문자열로 된 날짜 정보를 Date 형으로 리턴한다. + * @param text 문자열로 된 날짜 정보 + * @param pattern 날짜 패턴 + * @return ParsingException이 일어나는 경우 null + */ + public static Date getDate(String text, String pattern) { + return getDate(text, pattern, (Date) null); + } + + /** + * 문자열로 된 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @param text 문자열로 된 날짜 정보 + * @param defaultDate ParsingException이 일어나는 경우 리턴할 Date + */ + public static Date getDate(String text, Date defaultDate) { + return getDate(text, "yyyy-MM-dd", defaultDate); + } + + /** + * 문자열로 된 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @param text 문자열로 된 날짜 정보 + * @return ParsingException이 일어나는 경우 null + */ + public static Date getDate(String text) { + if (10 >= text.length()) { + return getDate(text, "yyyy-MM-dd"); + } else { + return getDate(text, "yyyy-MM-dd HH:mm:ss"); + } + } + + /** + * 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @param defaultDate ParsingException이 일어나는 경우 리턴할 Date + */ + public static Date getDate(int year, int month, int day, Date defaultDate) { + return getDate(year + "-" + month + "-" + day, defaultDate); + } + + /** + * 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @param defaultDate ParsingException이 일어나는 경우 리턴할 Date + */ + public static Date getDate(String year, String month, String day, Date defaultDate) { + return getDate(year + "-" + month + "-" + day, defaultDate); + } + + /** + * 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @return ParsingException이 일어나는 경우 null + */ + public static Date getDate(int year, int month, int day) { + return getDate(year + "-" + month + "-" + day); + } + + /** + * 날짜 정보를 Date 형으로 리턴한다. + * 패턴은 yyyy-MM-dd 이다. + * @return ParsingException이 일어나는 경우 null + */ + public static Date getDate(String year, String month, String day) { + return getDate(year + "-" + month + "-" + day); + } + + /** + * yyyy-MM-ddTHH:mm:ss.SSS 형식을 읽어들인다. + */ + public static Date parseDateTime(String str) { + DateFormat df = getDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); + try { + return df.parse(str); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * yyyy-MM-ddTHH:mm:ss.SSS 형식의 문자열을 얻는다. + */ + public static String dateTimeToString(Date date) { + DateFormat df = getDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + return df.format(date); + } + + public static String dateToString(Date date) { + DateFormat df = getDateFormat("yyyy-MM-dd HH:mm:ss"); + return df.format(date); + } + + public static String format(String pattern, Date date) { + DateFormat df = getDateFormat(pattern); + return df.format(date); + } + + public static Date getStartOfDate(Date date) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + public static Date getEndOfDate(Date date) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.set(Calendar.HOUR_OF_DAY, 23); + cal.set(Calendar.MINUTE, 59); + cal.set(Calendar.SECOND, 59); + cal.set(Calendar.MILLISECOND, 999); + return cal.getTime(); + } + + public static Date getCurrentDay() { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + //cal.set(Calendar.HOUR_OF_DAY, 0); + //cal.set(Calendar.MINUTE, 0); + //cal.set(Calendar.SECOND, 0); + //cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 해당 날짜가 속해 있는 주의 첫째 일과 마지막 일을 구함 + * + * @param date + * @return + */ + public static Map getWeekDate(Date date) { + Map map = new HashMap(); + + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.DAY_OF_YEAR, Calendar.SUNDAY); + calendar.setTime(date); + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); + Date firstDateOfWeek = org.apache.commons.lang.time.DateUtils.addDays(date, -1 * (dayOfWeek-1)); + Date lastDateOfWeek = org.apache.commons.lang.time.DateUtils.addDays(date, 7 - dayOfWeek + 1); + + map.put("firstDate", firstDateOfWeek); + map.put("lastDate", lastDateOfWeek); + + return map; + } + + /** + * 현재 날짜로 이전 parameter에 날짜를 구해준다. + * @param prevDay + * @return + */ + public static Date getPreDate(int preDate) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.add(Calendar.DATE, - preDate); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + public static Date getDate(int hour, int day) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.DATE, day); + cal.set(Calendar.HOUR_OF_DAY, hour); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + public static Date getDate(int hour) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.HOUR_OF_DAY, hour); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + public static Date getDateWithMinute(int hour, int minute) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.HOUR_OF_DAY, hour); + cal.set(Calendar.MINUTE, minute); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + public static Date getEndOfTime(int hour){ + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.HOUR_OF_DAY, hour); + cal.set(Calendar.MINUTE, 59); + cal.set(Calendar.SECOND, 59); + cal.set(Calendar.MILLISECOND, 99); + return cal.getTime(); + } + + /** + * 현재날짜기준 이전 (다음)월을 구한다. + * @param date + * @param month + * @return + */ + public static Date getMonthDate(Date date, int month) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.add(Calendar.MONTH, month); + cal.add(Calendar.DATE, 0); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 현재날짜기준 이전 (다음)주을 구한다. + * @param date + * @param month + * @return + */ + public static Date getWeekDate(Date date, int week) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.add(Calendar.MONTH, 0); + cal.add(Calendar.DATE, 7 * week); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 날짜로 이전 parameter에 날짜를 구해준다. + * @param prevDay + * @return + */ + public static Date getPreDate(Date date, int preDate) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.add(Calendar.DATE, - preDate); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 현재 날짜로 이후 parameter에 날짜를 구해준다. + * @param prevDay + * @return + */ + public static Date getNextDate(int nextDate) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.add(Calendar.DATE, nextDate); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 날짜로 이후 parameter에 날짜를 구해준다. + * @param prevDay + * @return + */ + public static Date getNextDate(Date date, int nextDate) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + cal.add(Calendar.DATE, nextDate); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + + /** + * 월초에 값을 가져온다 ex) '2013-05-01 00:00:00' + */ + public static Date getMonthFirstDate(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + + Calendar calendar2 = Calendar.getInstance(); + calendar2.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) , 1); + return getStartOfDate(calendar2.getTime()); + } + + /** + * 월말에 값을 가져온다 ex) '2013-05-31 23:59:59.999' + */ + public static Date getMonthLastDate(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + + Calendar calendar2 = Calendar.getInstance(); + calendar2.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1 , 0); + return getEndOfDate(calendar2.getTime()); + } + + /** + * 두 날짜의 일수 차이를 구한다. + * endDay - startDay + */ + public static long getDiffDay(Date startDay, Date endDay) { + long endDayTime = endDay.getTime(); + long startDayTime = startDay.getTime(); + long result = (endDayTime - startDayTime) / 86400000; + return result; + } + + /** + * 유닉스시간을 스트링으로 변환 + * yyyy-MM-dd HH:mm:ss + * ex) 1399459378 (초단위). + */ + public static String getUnixToString(long unixTime) { + SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String result = format2.format(unixTime * 1000); + return result; + } + + /** + * 유닉스시간을 Date타입으로 변환 + * yyyy-MM-dd HH:mm:ss + * ex) 1399459378 (초단위). + */ + public static Date getUnixToDate(long unixTime) { + Date result = getDate(getUnixToString(unixTime), "yyyy-MM-dd HH:mm:ss"); + return result; + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/MessageSupport.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/MessageSupport.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/MessageSupport.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,40 @@ +package egovframework.com.ext.jstree.support.util; + + +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.i18n.SessionLocaleResolver; +import org.springframework.web.util.WebUtils; + +@Service +public class MessageSupport { + @Autowired + private MessageSource messageSource; + + public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { + return messageSource.getMessage(code, args, defaultMessage, locale); + } + + public String getMessage(String code, Object[] args, String defaultMessage, HttpServletRequest request) { + Locale locale = (Locale) WebUtils.getSessionAttribute(request, SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); + return getMessage(code, args, defaultMessage, locale); + } + + public String getMessage(String code, String defaultMessage, Locale locale) { + return getMessage(code, null, defaultMessage, locale); + } + + public String getMessage(String code, String defaultMessage, HttpServletRequest request) { + Locale locale = (Locale) WebUtils.getSessionAttribute(request, SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); + return getMessage(code, null, defaultMessage, locale); + } + + public MessageSource getMessageSource() { + return this.messageSource; + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ParameterParser.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ParameterParser.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ParameterParser.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,777 @@ +package egovframework.com.ext.jstree.support.util; + +import java.util.ArrayList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Date; +import java.util.Enumeration; +import java.util.List; + +import javax.servlet.ServletRequest; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; + +public class ParameterParser +{ + private ServletRequest req; + public Logger logger = LoggerFactory.getLogger(this.getClass()); + + public ParameterParser(ServletRequest req) + { + this.req = req; + } + + /** + * 파라미터를 String 타입으로 얻는다. + * + * @param 파라미터 key + * @return 파라미터가 없을 경우 null + */ + public String get(String name) + { + String value = req.getParameter(name); + if (null != value && 0 == value.length()) { return null; } + return StringUtils.trim(value); + } + + /** + * 파라미터를 String 타입으로 얻는다. + * + * @param 파라미터 key + * @param 디폴트 값 + * @return 파라미터가 없을 경우 디폴트 + */ + public String get(String name, String def) + { + String value = get(name); + if (null == value) { return def; } + return StringUtils.trim(value); + } + + /** + * 파라미터를 boolean 타입으로 얻는다. + * + * @param 파라미터 key + * @return 파라미터가 없을 경우 false + */ + public boolean getBoolean(String name) + { + String value = get(name); + if (null == value || 0 == value.length()) { return false; } + value = value.toLowerCase(); + if ((value.equalsIgnoreCase("true")) + || (value.equalsIgnoreCase("on")) + || (value.equalsIgnoreCase("yes") || (value + .equalsIgnoreCase("1")))) + { + return true; + } + else if ((value.equalsIgnoreCase("false")) + || (value.equalsIgnoreCase("off")) + || (value.equalsIgnoreCase("no") || (value + .equalsIgnoreCase("0")))) + { + return false; + } + else + { + return false; + } + } + + /** + * 파라미터를 boolean 타입으로 얻는다. + * + * @param 파라미터 key + * @param 디폴트 + * @return 파라미터가 없을 경우 디폴트 + */ + public boolean getBoolean(String name, boolean def) + { + String value = get(name); + if (null == value || 0 == value.length()) { return def; } + value = value.toLowerCase(); + if ((value.equalsIgnoreCase("true")) || (value.equalsIgnoreCase("on")) + || (value.equalsIgnoreCase("yes"))) + { + return true; + } + else if ((value.equalsIgnoreCase("false")) + || (value.equalsIgnoreCase("off")) + || (value.equalsIgnoreCase("no"))) + { + return false; + } + else + { + return def; + } + } + + /** + * 파라미터를 int 타입으로 얻는다. + * + * @param 파라미터 key + * @return 파라미터가 없을 경우, 예외 발생시 0 + */ + public int getInt(String name) + { + String value = get(name); + if (null == value || 0 == value.length()) { return 0; } + try + { + return Integer.parseInt(value); + } + catch (Exception e) + { + return 0; + } + } + + /** + * 파라미터를 int 타입으로 얻는다. + * + * @param 파라미터 key + * @param 디폴트 + * @return 파라미터가 없을 경우, 예외 발생시 디폴트 + */ + public int getInt(String name, int def) + { + String value = get(name); + if (null == value || 0 == value.length()) { return def; } + try + { + return Integer.parseInt(value); + } + catch (Exception e) + { + return def; + } + } + + /** + * 파라미터를 int 타입으로 얻는다. 3자리마다 붙는 쉼표(,)를 삭제한다. + * + * @param 파라미터 key + * @return 파라미터가 없을 경우, 예외 발생시 0 + */ + public int getCurrency(String name) + { + return getCurrency(name, 0); + } + + /** + * 파라미터를 int 타입으로 얻는다. 3자리마다 붙는 쉼표(,)를 삭제한다. + * + * @param 파라미터 key + * @param 디폴트 + * @return 파라미터가 없을 경우, 예외 발생시 디폴트 + */ + public int getCurrency(String name, int def) + { + String value = get(name); + if (null == value) { return def; } + int length = value.length(); + char c = 0; + StringBuffer sbf = new StringBuffer(); + for (int i = 0; i < length; i++) + { + c = value.charAt(i); + if ('-' == c || ('0' <= c && c <= '9')) + { + sbf.append(c); + } + else if (',' == c) + { + continue; + } + else + { + return def; + } + } + try + { + return Integer.parseInt(sbf.toString()); + } + catch (Exception e) + { + return def; + } + } + + /** + * 파라미터를 long 타입으로 얻는다. + * + * @param 파라미터 key + * @return 파라미터가 없을 경우, 예외 발생시 0 + */ + public long getLong(String name) + { + String value = get(name); + if (null == value || 0 == value.length()) { return 0; } + try + { + return Long.parseLong(value); + } + catch (Exception e) + { + return 0; + } + } + + public long getKey() + { + String key = req.getParameter("key"); + return new Long(key); + } + + public List getKeyLong() + { + List keys = new ArrayList<>(); + String key = req.getParameter("key"); + + if (!StringUtils.isEmpty(key)) + { + keys.add(new Long(key)); + } + else + { + for (int i = 0; i < 1000; i++) + { + String key2 = req.getParameter("key[" + i + "]"); + if (!StringUtils.isEmpty(key2)) + { + keys.add(new Long(key2)); + } + else + { + break; + } + } + } + + return keys; + } + + public List getKeyLong(String keyName) + { + List keys = new ArrayList<>(); + String key = req.getParameter(keyName); + + if (!StringUtils.isEmpty(key)) + { + keys.add(new Long(key)); + } + else + { + for (int i = 0; i < 1000; i++) + { + String key2 = req.getParameter(keyName + "[" + i + "]"); + if (!StringUtils.isEmpty(key2)) + { + keys.add(new Long(key2)); + } + else + { + break; + } + } + } + + return keys; + } + + public List getNameLong() + { + List keys = new ArrayList<>(); + String key = req.getParameter("name"); + + if (!StringUtils.isEmpty(key)) + { + if (StringUtils.contains(key, ";")) + { + String[] temp = StringUtils.split(key, ";"); + for (String string : temp) + { + keys.add(new Long(string)); + } + } + else + { + keys.add(new Long(key)); + } + + } + else + { + for (int i = 0; i < 1000; i++) + { + String key2 = req.getParameter("name[" + i + "]"); + if (!StringUtils.isEmpty(key2)) + { + + if (StringUtils.contains(key2, ";")) + { + String[] temp = StringUtils.split(key2, ";"); + for (String string : temp) + { + keys.add(new Long(string)); + } + } + else + { + keys.add(new Long(key2)); + } + + } + else + { + break; + } + } + } + + return keys; + } + + public List getKeyString() + { + return getKeyString("key"); + } + + public List getKeyString(String keyName) + { + List keys = new ArrayList<>(); + String key = req.getParameter(keyName); + + if (!StringUtils.isEmpty(key)) + { + keys.add(new String(key)); + } + else + { + for (int i = 0; i < 1000; i++) + { + String key2 = req.getParameter(keyName + "[" + i + "]"); + if (!StringUtils.isEmpty(key2)) + { + keys.add(new String(key2)); + } + else + { + break; + } + } + } + + return keys; + } + + public boolean isModify() + { + String mode = req.getParameter("mode"); + if (StringUtils.equalsIgnoreCase(mode, "edit")) { return true; } + + return false; + } + + /** + * 파라미터를 int 타입으로 얻는다. + * + * @param name + * 파라미터 key + * @param def + * 디폴트 + * @return 파라미터가 없을 경우, 예외 발생시 디폴트 + */ + public long getLong(String name, long def) + { + String value = get(name); + if (null == value || 0 == value.length()) { return def; } + try + { + return Long.parseLong(value); + } + catch (Exception e) + { + return def; + } + } + + /** + * 파라미터를 Date 형으로 읽는다. "yyyy-MM-dd" 형식이다. 파라미터가 없거나 형식이 맞지 않는 경우 현재 시간을 + * 사용한다. + */ + public Date getDate(String name) + { + return getDate(name, new Date()); + } + + public Date getEndDate(String name) + { + return DateUtils.addDays(getDate(name, new Date()), 1); + } + + /** + * 파라미터를 Date 형으로 읽는다. "yyyy-MM-dd" 형식이다. + */ + public Date getDate(String name, Date def) + { + String temp = get(name); + if (null == temp) { return def; } + try + { + return DateUtils.getDateFormat("yyyy-MM-dd").parse(temp); + } + catch (Exception e) + { + return def; + } + } + + public Date getDateTime(String name) + { + return getDateTime(name, new Date()); + } + + public Date getDateTime(String name, Date def) + { + String temp = get(name); + if (null == temp) { return def; } + try + { + return DateUtils.getDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS") + .parse(temp); + } + catch (Exception e) + { + return def; + } + } + + public Date getDateSearchDate(int addHour) + { + String date1 = get("startDate1"); + + if (StringUtils.isEmpty(date1)) + { + // return org.apache.commons.lang.time.DateUtils.addHours(new + // Date(), addHour); + return org.apache.commons.lang.time.DateUtils.addMonths(new Date(), + addHour); + } + + String date = date1 + " 00:00:00"; + return DateUtils.getDate(date); + } + + /** + * 시작일자의 00:00:00 부터 + * + * @return + */ + public Date getDateStart(int day) + { + String date1 = get("startDate1"); + + if (StringUtils.isEmpty(date1)) + { + Date temp = org.apache.commons.lang.time.DateUtils + .addDays(new Date(), day); + date1 = DateUtils.getDateFormat("yyyy-MM-dd").format(temp); + } + String date = date1 + " 00:00:00"; + return DateUtils.getDate(date); + } + + /** + * 종료일자의 23:59:59 까지 + * + * @return + */ + public Date getDateEnd() + { + String date1 = get("endDate1"); + + if (StringUtils.isEmpty(date1)) + { + date1 = DateUtils.getDateFormat("yyyy-MM-dd").format(new Date()); + } + String date = date1 + " 23:59:59.999"; + return DateUtils.getDate(date, "yyyy-MM-dd HH:mm:ss.SSS"); + } + + public Date getDateStartDate(int addHour) + { + String date1 = get("startDate1"); + String date2 = get("startDate2"); + + if (StringUtils.isEmpty(date1) || StringUtils.isEmpty(date2)) { return org.apache.commons.lang.time.DateUtils + .addHours(new Date(), addHour); } + + String date = date1 + " " + date2; + return DateUtils.getDate(date); + } + + public Date getDateStartDateMonth(int addMonth) + { + String date1 = get("startDate1"); + String date2 = get("startDate2"); + + if (StringUtils.isEmpty(date1) || StringUtils.isEmpty(date2)) { return org.apache.commons.lang.time.DateUtils + .addMonths(new Date(), addMonth); } + + String date = date1 + " " + date2; + return DateUtils.getDate(date); + } + + public Date getDateEndDate() + { + String date1 = get("endDate1"); + String date2 = get("endDate2"); + + if (StringUtils.isEmpty(date1) || StringUtils.isEmpty(date2)) { return new Date(); } + + String date = date1 + " " + date2; + return DateUtils.getDate(date); + } + + /** + * 파라미터를 Date 형으로 읽는다. "yyyy-MM-dd HH:mm" 형식이다. + */ + public Date getDateHour(String name) + { + return getDateHour(name, new Date()); + } + + public Date getDateHour(String name, Date def) + { + String temp = get(name); + if (null == temp) { return def; } + try + { + return DateUtils.getDateFormat("yyyy-MM-dd HH:mm").parse(temp); + } + catch (Exception e) + { + return def; + } + } + + /** + * 파라미터를 String array 타입으로 얻는다. + * + * @param name + * 파라미터 key + * @return String Array + */ + public String[] getArray(String name) + { + List list = new ArrayList(); + String[] tempArray = req.getParameterValues(name); + if (null == tempArray) { return null; } + for (int i = 0; i < tempArray.length; i++) + { + if (null != tempArray[i] && 0 != tempArray[i].length()) + { + list.add(tempArray[i]); + } + } + String[] returnArray = new String[list.size()]; + for (int i = 0; i < list.size(); i++) + { + returnArray[i] = (String) list.get(i); + } + return returnArray; + } + + public String getArrayString(String name, String separator) + { + String[] temp = this.getArray(name); + if (null == temp) { return ""; } + + return StringUtils.join(temp, separator); + } + + public String getArraySum(String name) + { + int[] temp = getIntArray(name); + if (null == temp || temp.length == 0) { return "0"; } + + int sum = 0; + for (int i : temp) + { + sum += i; + } + + return String.valueOf(sum); + } + + /** + * 파라미터를 integer array 타입으로 얻는다. + * + * @param name + * 파라미터 key + * @return integer Array + */ + public int[] getIntArray(String name) + { + String[] tempArray = req.getParameterValues(name); + if (null == tempArray) { return null; } + int len = tempArray.length; + int[] result = new int[len]; + int temp = 0; + for (int i = 0; i < len; i++) + { + try + { + temp = Integer.parseInt(tempArray[i]); + } + catch (Exception e) + { + temp = 0; + } + result[i] = temp; + } + return result; + } + + public long[] getLongArray(String name) + { + String[] tempArray = req.getParameterValues(name); + if (null == tempArray) { return null; } + int len = tempArray.length; + long[] result = new long[len]; + long temp = 0; + for (int i = 0; i < len; i++) + { + try + { + temp = Long.parseLong(tempArray[i]); + } + catch (Exception e) + { + temp = 0; + } + result[i] = temp; + } + return result; + } + + public List getListLongArray(String name) + { + String[] tempArray = req.getParameterValues(name); + if (null == tempArray) { return new ArrayList<>(); } + + List list = new ArrayList<>(); + for (String id : tempArray) + { + list.add(Long.parseLong(id)); + } + return list; + } + + public List getStringForDelimeterLong(String name, String delimeter) + { + List list = new ArrayList<>(); + + String temp = get(name); + if (StringUtils.isEmpty(temp)) { return list; } + + String[] temp2 = StringUtils.split(temp, delimeter); + + for (String value : temp2) + { + if (StringUtils.isEmpty(value) || !NumberUtils.isDigits(value)) + { + continue; + } + + list.add(NumberUtils.toLong(value)); + } + + return list; + } + + public String toString() + { + StringBuffer sbf = new StringBuffer(); + sbf.append('{'); + Enumeration en = req.getParameterNames(); + String name = null; + String[] value = null; + int i = 0; + while (en.hasMoreElements()) + { + name = (String) en.nextElement(); + sbf.append("name= "); + value = req.getParameterValues(name); + if (null == value || 0 == value.length) + { + sbf.append(';'); + continue; + } + if (1 == value.length) + { + sbf.append(value); + } + else + { + sbf.append('['); + sbf.append(value[0]); + for (i = 1; i < value.length; i++) + { + sbf.append(","); + sbf.append(value[i]); + } + sbf.append(']'); + } + sbf.append(';'); + } + sbf.append('}'); + return sbf.toString(); + } + + public String paramDebug() + { + StringBuffer sbf = new StringBuffer(); + sbf.append('{'); + Enumeration en = req.getParameterNames(); + String name = null; + String[] value = null; + int i = 0; + while (en.hasMoreElements()) + { + name = (String) en.nextElement(); + sbf.append(name).append(" : "); + value = req.getParameterValues(name); + if (null == value || 0 == value.length) + { + sbf.append(';'); + continue; + } + if (1 == value.length) + { + sbf.append(value[0]); + } + else + { + sbf.append('['); + sbf.append(value[0]); + for (i = 1; i < value.length; i++) + { + sbf.append(","); + sbf.append(value[i]); + } + sbf.append(']'); + } + sbf.append(';'); + } + sbf.append('}'); + return sbf.toString(); + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ScheduleUtil.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ScheduleUtil.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/ScheduleUtil.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,250 @@ +package egovframework.com.ext.jstree.support.util; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; + +public class ScheduleUtil { + + // 객체 - 일정 30분 단위 관련 함수 + public static String halfTime(String value) { + // minuteUnit = 분주기 + // Ex) 07:00-08:00;11:00-13:00;14:00-16:05 + int processMinute = 30; + int useBitsPerHour = 2; + if(value.equals("0")) value = "00:00-00:00"; + + String[] strArray = StringUtils.split(value, ";"); + BigInteger divNum = BigInteger.ZERO; + + for (String valueArrTemp : strArray) { + String[] temp = StringUtils.split(valueArrTemp, "-"); + + String[] startTime = StringUtils.split(temp[0], ":"); + int startHour = Integer.parseInt(startTime[0]); + int startMinute = Integer.parseInt(startTime[1]); + + String[] endTime = StringUtils.split(temp[1], ":"); + int endHour = Integer.parseInt(endTime[0]); + int endMinute = Integer.parseInt(endTime[1]); + + // 00분, 30분 체크 + if (startMinute == processMinute) { + startMinute = processMinute; + } else { + startMinute = 0; + } + + if (endMinute == processMinute) { + endMinute = processMinute; + } else { + endMinute = 0; + } + + int startPos = (startHour * useBitsPerHour) + (startMinute / processMinute); + int endPos = (endHour * useBitsPerHour) + (endMinute / processMinute); + + for (int i = startPos; i < endPos; i++) { + divNum = divNum.setBit(i); + } + } + return divNum.toString(); + } + + public static String getHalfTimeTime(String value) { + // minuteUnit = 분주기 + // Ex) 280375480811520 + int processMinute = 30; + int useBitsPerHour = 2; + + List arrList = new ArrayList<>(); + String output = ""; + + BigInteger arrNum = new BigInteger(value); + + for (int j = 0; j < arrNum.bitLength(); j++) { + boolean ret = arrNum.testBit(j); + if (ret) { + arrList.add(j); + } + } + + if(arrList.size() > 0 ) { + int start = arrList.get(0), last = arrList.get(0); + for (int i = 1; i <= arrList.size(); i++) { + if (i == arrList.size() || arrList.get(i) != last + 1) { + if (output.length() != 0) { + output += ", "; + } + + int startHour = start / useBitsPerHour; + int starMinute = (start * processMinute) % 60; + int endHour = (last + 1) / useBitsPerHour; + int endMinute = ((last + 1) * processMinute) % 60; + output += String.format("%02d", startHour) + ":" + String.format("%02d", starMinute) + "-" + String.format("%02d", endHour) + ":" + String.format("%02d", endMinute); + + if (i != arrList.size()) { + start = last = arrList.get(i); + } + } else + last = arrList.get(i); + } + } + + return output; + } + + // 객체 - 일정 5분 단위 관련 함수 + public static Map extenedTime(String value) { + int processMinute = 5; + int timePerArray = 5; + int useBitsPerHour = 12; + String isExtUsed = "0"; + if(value.equals("0")) value = "00:00-00:00"; + + String[] strArray = StringUtils.split(value, ";"); + BigInteger timeHour = BigInteger.ZERO; + BigInteger[] timeArr = { BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO }; + + for (String valueArrTemp : strArray) { + + String[] temp = StringUtils.split(valueArrTemp, "-"); + + String[] startTime = StringUtils.split(temp[0], ":"); + int startHour = Integer.parseInt(startTime[0]); + int startMinute = Integer.parseInt(startTime[1]); + + String[] endTime = StringUtils.split(temp[1], ":"); + int endHour = Integer.parseInt(endTime[0]); + int endMinute = Integer.parseInt(endTime[1]); + + int startArr = (startHour / timePerArray); + int endArr = (endHour) / timePerArray; + int startPos = (startMinute / processMinute) + ((startHour % timePerArray) * useBitsPerHour); + int endPos = (endMinute / processMinute) + ((endHour % timePerArray) * useBitsPerHour); + + timeHour = timeHour.setBit(startHour); + timeHour = timeHour.setBit(endHour); + + if (startArr == endArr) { + for (int i = startPos; i < endPos; i++) { + timeArr[startArr] = timeArr[startArr].setBit(i); + } + } else { + for (int i = startArr; i <= endArr; i++) { + int start = 0; + int end = 60; + + if (i == startArr) { + for (int j = startPos; j < end; j++) { + timeArr[i] = timeArr[i].setBit(j); + } + } + + if (i == endArr) { + for (int j = start; j < endPos; j++) { + timeArr[i] = timeArr[i].setBit(j); + } + } + } + } + + if ((startMinute != 0 && startMinute != 30) || (endMinute != 0 && endMinute != 30)) { + isExtUsed = "1"; + } + } + + Map result = new LinkedHashMap<>(); + result.put("isExtUsed", isExtUsed); + result.put("hours", timeHour.toString()); + result.put("extend1", timeArr[0].toString()); + result.put("extend2", timeArr[1].toString()); + result.put("extend3", timeArr[2].toString()); + result.put("extend4", timeArr[3].toString()); + result.put("extend5", timeArr[4].toString()); + + return result; + } + + // 객체 - 일정 시간 표시 + public static String getExtenedTime(String... extend) { + int processMinute = 5; + int useBitsPerHour = 12; + int maxProcessBits = 60; + + List arrList = new ArrayList<>(); + String output = ""; + + for (int i = 0; i < extend.length; i++) { + BigInteger arrNum = new BigInteger(String.valueOf(extend[i])); + for (int j = 0; j < arrNum.bitLength(); j++) { + boolean ret = arrNum.testBit(j); + if (ret) { + arrList.add(j + (maxProcessBits * i)); + } + } + } + + if(arrList.size() > 0 ) { + int start = arrList.get(0), last = arrList.get(0); + for (int i = 1; i <= arrList.size(); i++) { + if (i == arrList.size() || arrList.get(i) != last + 1) { + if (output.length() != 0) { + output += ", "; + } + + int startHour = start / useBitsPerHour; + int starMinute = (start * processMinute) % 60; + int endHour = (last + 1) / useBitsPerHour; + int endMinute = ((last + 1) * processMinute) % 60; + output += String.format("%02d", startHour) + ":" + String.format("%02d", starMinute) + "-" + String.format("%02d", endHour) + ":" + String.format("%02d", endMinute); + + if (i != arrList.size()) { + start = last = arrList.get(i); + } + } else + last = arrList.get(i); + } + } + + return output; + } + + /** + * 객체 - 매월 일 + * 1-3,5,6 => 1,2,3,5,6 으로 변환후 2진수의 지수승 ture로 변환 + */ + public static String dayConvert(String value) { + BigInteger divNum = new BigInteger("0"); + String[] st = StringUtils.split(Text.convertDashForString(value ,";"), ","); + + for (String stTemp : st) { + divNum = divNum.setBit(Integer.parseInt(stTemp)); + } + + return divNum.shiftRight(1).toString(); + } + + public static String getDayConvert(String value) { + BigInteger divNum = new BigInteger(value); + String output = ""; + + for (int j = 0; j < divNum.bitLength(); j++) { + boolean ret = divNum.testBit(j); + if (ret) { + if (output.length() != 0) { + output += ","; + } + output += j + 1; + } + } + + output = Text.convertCommmaForString(output, ";"); + + return output; + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/StringUtils.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/StringUtils.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/StringUtils.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,220 @@ +package egovframework.com.ext.jstree.support.util; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + + +public class StringUtils extends org.apache.commons.lang.StringUtils { + public static String getString(String text) { + if (null == text) { + return ""; + } + + return text; + } + + public static String getString(Date text) { + if (null == text) { + return ""; + } + + return text.toString(); + } + + public static boolean getBoolean(String text) { + if (equalsIgnoreCase(text, "true") || equalsIgnoreCase(text, "1")) { + return true; + } + + return false; + } + + public static String getString(int value) { + return ((Integer) value).toString(); + } + + public static String getString(long value) { + return ((Long) value).toString(); + } + + public static String getString(boolean flag) { + if (flag) { + return "1"; + } else { + return "0"; + } + } + + public static String makeIpv4Cidr(String ip) { + if (!StringUtils.contains(ip, "/")) { + return ip + "/32"; + } + + return ip; + } + + /** + * 1.2.3.4/32 -> array + */ + public static String[] makeIpv4(String ipMask) { + if (!StringUtils.contains(ipMask, "/")) { + String[] ips = { ipMask, "32" }; + return ips; + } else { + return StringUtils.split(ipMask, "/"); + } + } + + /** + * ip : 0, ipMask: 1, range:2 + */ + public static String[] getTypeForIp(String value) { + String type = "0"; + String mask = "32"; + String ip = value; + if (contains(value, "-")) { + type = "2"; + String[] temp = split(value, "/"); + ip = temp[0]; + } else if (contains(value, "/")) { + type = "1"; + String[] temp = split(value, "/"); + ip = temp[0]; + mask = temp[1]; + + // mask 값이 32로 입력된 경우 단일 IP로 처리 + if (StringUtils.equals(mask, "32")) { + type = "0"; + } + } + + String[] result = { ip, type, mask }; + return result; + } + + /** + * 값 비교후 0번에 삭제대상 1번에 추가대상 2번에 업데이트 대상 반환. + */ + public static List> diffMembers(List oldMember, List newMember) { + return diffMembers(oldMember.toArray(new String[oldMember.size()]), newMember.toArray(new String[newMember.size()])); + } + + public static List> diffMembersLong(List oldMember, List newMember) { + List newMembers = new ArrayList<>(); + List oldMembers = new ArrayList<>(); + for (Long tempLong : oldMember) { + oldMembers.add(StringUtils.getString(tempLong)); + } + for (Long tempLong : newMember) { + newMembers.add(StringUtils.getString(tempLong)); + } + + return diffMembers(oldMembers, newMembers); + } + + public static List> diffMembers(String[] oldMember, String[] newMember) { + Map oldMap = new LinkedHashMap<>(); + List newMembers = new ArrayList<>(); + if (null != oldMember) { + for (String string : oldMember) { + oldMap.put(string, 0); + } + } + + // 이미 존재하는 경우 count 1 증가 + if (null != newMember && newMember.length > 0) { + for (String string : newMember) { + if (oldMap.containsKey(string)) { + oldMap.put(string, 1); + } else { + newMembers.add(string); + } + } + } + + List updateMembers = new ArrayList<>(); + List deleteMembers = new ArrayList<>(); + + for (Map.Entry entry : oldMap.entrySet()) { + if (entry.getValue() > 0) { + updateMembers.add(entry.getKey()); + } else { + deleteMembers.add(entry.getKey()); + } + } + + List> result = new ArrayList<>(); + result.add(deleteMembers); + result.add(newMembers); + result.add(updateMembers); + + return result; + } + + + public static String removeMember(String members, String removeMember) { + String members2 = ";" + members + ";"; + String result = StringUtils.replace(members2, removeMember + ";", ""); + + return StringUtils.substring(result, 1, result.length() - 1); + } + + /** + * url 의 full path를 얻어온다. + */ + public static String getFullURL(HttpServletRequest request) { + String requestURL = request.getRequestURI(); + String queryString = request.getQueryString(); + + if (queryString == null) { + return requestURL.toString(); + } else { + return requestURL + "?" + queryString; + } + } + + public static String changeApplyIcon(String applyFlag) { + if (StringUtils.equals(applyFlag, "1")) { + return ""; + } + return ""; + } + + /** + * 문자열에서 원하는 바이트 상당의 문자를 뒤에서부터 자른다. + * @throws UnsupportedEncodingException + */ + public static String substringBeforeLastByte(String str, String encoding, int cutByte) throws UnsupportedEncodingException { + int subStrByte = str.getBytes(encoding).length - cutByte; + + if(subStrByte <= 0) { + return ""; + } + + String temp = str; + while (subStrByte < temp.getBytes(encoding).length) { + temp = substring(temp, 0, temp.length() - 1); + } + + return temp; + } + + /** + * 운영체제 별로 다른, 개행 문자와 탭 문자를 기준으로 문자열을 잘라 문자열 배열로 만들어 반환 + * + * @author 류강하 + * @since 2015. 5. 23. + * @param str 문자열 + * @return + */ + public static String[] splitStringByNewLineOrTab(String str) { + + return str.split("(\r\n)|\r|\n|\t"); + } +} Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/Text.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/Text.java (revision 0) +++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/util/Text.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -0,0 +1,761 @@ +package egovframework.com.ext.jstree.support.util; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.net.util.SubnetUtils; +import org.apache.commons.validator.routines.InetAddressValidator; + +public class Text { + + private static DecimalFormat oneDecimal = new DecimalFormat("0.0"); + + private Text() { + } + + /** + * + * @param str + * @return nl2br String + */ + public static String nl2br(String str) { + if (StringUtils.isEmpty(str)) { + return ""; + } + String temp1 = StringUtils.replace(str, "\r\n", "
"); + return StringUtils.replace(temp1, "\n", "
"); + } + + public static long ipToLong(String ip) { + String[] addrArray = ip.split("\\."); + + long num = 0; + for (int i = 0; i < addrArray.length; i++) { + int power = 3 - i; + + num += ((Integer.parseInt(addrArray[i]) % 256 * Math.pow(256, power))); + } + return num; + } + + public static long[] ipToLong(String ip, String mask) { + if (StringUtils.isEmpty(mask) || StringUtils.equals(mask, "0")) { + mask = "32"; + } + SubnetUtils subnetUtils = new SubnetUtils(ip + "/" + mask); + + String sipString = subnetUtils.getInfo().getAddress(); + String dipString = subnetUtils.getInfo().getAddress(); + + if (!StringUtils.equals(mask, "32") && !StringUtils.equals(mask, "31")) { + sipString = subnetUtils.getInfo().getLowAddress(); + dipString = subnetUtils.getInfo().getHighAddress(); + } + + long[] ips = { Text.ipToLong(sipString), Text.ipToLong(dipString) }; + return ips; + } + + public static long[] ipToLong2(String ip) { + if (StringUtils.contains(ip, "/")) { + String[] temp = StringUtils.split(ip, "/"); + return ipToLong(temp[0], temp[1]); + } else { + return ipToLong(ip, "32"); + } + } + + /** + * @param versionText + * @return 99.99.99.99.99999 -> 12121311313131 + */ + public static long versionToLong(String versionText) { + String[] versionArray = versionText.split("\\."); + + if (versionArray == null || versionArray.length != 5) { + return Long.MAX_VALUE; + } + + long num = 0; + try { + for (int i = 0; i < versionArray.length - 1; i++) { + int power = 4 - i; + + num += ((Integer.parseInt(versionArray[i]) % 99 * Math.pow(99, power))); + } + + num += ((Integer.parseInt(versionArray[4]) % 99999 * Math.pow(99999, 0))); + } catch (NumberFormatException nfe) { + return Long.MAX_VALUE; + } + return num; + } + + public static String longToIp(long ip) { + return ((ip >> 24) & 0xFF) + "." + ((ip >> 16) & 0xFF) + "." + ((ip >> 8) & 0xFF) + "." + (ip & 0xFF); + } + + public static boolean isIpv4(String ip) { + return InetAddressValidator.getInstance().isValidInet4Address(ip); + } + + /** + * ex) seperator = ";" => 1;2;3;5;6 -> 1-3,5-6 으로 변경해주는 코드 ex) seperator = "," => 1,2,3,5,6 -> 1-3,5-6 으로 변경해주는 코드 + */ + public static String convertCommmaForString(String value, String seperator) { + List arrList = new ArrayList<>(); + String result = ""; + + String[] key = StringUtils.split(value, seperator); + for (String keyTemp : key) { + arrList.add(Integer.parseInt(StringUtils.trim(keyTemp))); + } + + Collections.sort(arrList); + + if (arrList.size() > 0) { + int start = arrList.get(0), last = arrList.get(0); + List resultList = new ArrayList<>(); + + for (int i = 1; i <= arrList.size(); i++) { + if (i == arrList.size() || arrList.get(i) != last + 1) { + if (start == last) { + resultList.add(String.valueOf(start)); + } else { + resultList.add(start + "-" + last); + } + + if (i != arrList.size()) { + start = last = arrList.get(i); + } + } else { + last = arrList.get(i); + } + } + result = StringUtils.join(resultList, ","); + } + + return result; + } + + /** + * ex) seperator = ";" => 1-3,5,6 -> 1;2;3;5;6 으로 변경해주는 코드 ex) seperator = "," => 1-3,5,6 -> 1;2;3;5;6 으로 변경해주는 코드 + */ + public static String convertDashForString(String value, String seperator) { + List arrList = new ArrayList<>(); + String result = ""; + + String[] key = StringUtils.split(value, ","); + + for (String keyTemp : key) { + String[] key2 = StringUtils.split(keyTemp, "-"); + if (key2.length > 1) { + for (int i = Integer.parseInt(StringUtils.trim(key2[0])); i <= Integer.parseInt(StringUtils.trim(key2[1])); i++) { + arrList.add(i); + } + } else { + arrList.add(Integer.parseInt(keyTemp)); + } + } + Collections.sort(arrList); + result = StringUtils.join(arrList, seperator); + + return result; + } + + /** + * UTF-8 인코딩으로 URL Encode를 한다. URLEncoder.encode() 메서드와 달리 Exception 처리를 하지 않아도 된다. + */ + public static String urlEncode(String src) { + if (null == src) { + return null; + } + String result = null; + try { + result = java.net.URLEncoder.encode(src, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + return result; + } + + /** + * Given an integer, return a string that is in an approximate, but human readable format. It uses the bases 'k', 'm', and 'g' for 1024, 1024**2, and 1024**3. + * + * @param number + * the number to format + * @return a human readable form of the integer + */ + public static String convertFormat(long number) { + long absNumber = Math.abs(number); + double result = number; + String suffix = ""; + if (absNumber < 1024) { + // nothing + } else if (absNumber < 1024 * 1024) { + result = number / 1024.0; + suffix = "k"; + } else if (absNumber < 1024 * 1024 * 1024) { + result = number / (1024.0 * 1024); + suffix = "m"; + } else if (absNumber < 1024 * 1024 * 1024 * 1024) { + result = number / (1024.0 * 1024 * 1024); + suffix = "g"; + } else { + result = number / (1024.0 * 1024 * 1024 * 1024); + suffix = "t"; + } + return oneDecimal.format(result) + suffix; + } + + /** + * 문자열의 md5 해시값을 구하여 그것의 문자열 표현을 구한다. + */ + public static String md5(String src) { + if (null == src || 0 == src.length()) { + return src; + } + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("md5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("assert fail - md5 digest"); + } + byte[] hash = digest.digest(src.getBytes()); + int value = 0; + StringBuffer sbf = new StringBuffer(); + for (int i = 0; i < hash.length; i++) { + // suppression:on + value = (0x000000FF & hash[i]); + if (value < 0x10) { + sbf.append("0"); + } + // suppression:off + sbf.append(Integer.toHexString(value)); + } + return sbf.toString(); + } + + /** + * 문자열의 sha1 해시값을 구하여 그것의 문자열 표현을 구한다. + */ + public static String sha1(String src) { + if (null == src || 0 == src.length()) { + return src; + } + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("sha1"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("assert fail - sha1 digest"); + } + byte[] hash = digest.digest(src.getBytes()); + int value = 0; + StringBuffer sbf = new StringBuffer(); + for (int i = 0; i < hash.length; i++) { + // suppression:on + value = (0x000000FF & hash[i]); + if (value < 0x10) { + sbf.append("0"); + } + // suppression:off + sbf.append(Integer.toHexString(value)); + } + return sbf.toString(); + } + + public static String getBindType(Map> bindTypes, String key, String value) { + try { + Map tempObj = bindTypes.get(key); + if (!tempObj.containsKey(value)) { + return "EMPTY"; + } + return (String) tempObj.get(value); + } catch (Exception e) { + return "EMPTY"; + } + } + + public static String getBindType(Map bindTypes, String key) { + if (StringUtils.isEmpty(key)) { + return "EMPTY"; + } + try { + if (StringUtils.isEmpty((String) bindTypes.get(key))) { + return key; + } else { + return (String) bindTypes.get(key); + } + } catch (Exception e) { + return ""; + } + } + + public static String getDateByString(String text) { + if (StringUtils.isEmpty(text)) { + return ""; + } + + if (StringUtils.length(text) < 8) { + return ""; + } + + return StringUtils.substring(text, 0, 4) + '-' + StringUtils.substring(text, 4, 6) + '-' + StringUtils.substring(text, 6, 8); + } + + public static String getTimeByString(String text) { + if (StringUtils.isEmpty(text)) { + return ""; + } + + return StringUtils.substring(text, 0, 2) + ':' + StringUtils.substring(text, 2, 4) + ':' + StringUtils.substring(text, 4, 6); + } + + public static String getAliasPrefixTitle(String imgName) { + if (StringUtils.endsWith(imgName, "_in")) { + return "ZONE_IN"; + } else if (StringUtils.endsWith(imgName, "_ex")) { + return "ZONE_OUT"; + } else if (StringUtils.endsWith(imgName, "_dmz")) { + return "ZONE_DMZ"; + } else { + return ""; + } + } + + /** + * 문자열이 한글, 영문, 숫자, 공백으로만 이루어진 평범한 문자열인지 판단한다. + */ + public static boolean checkNormalString(String query) { + if (StringUtils.isEmpty(query)) { + return false; + } + int len = query.length(); + int i = 0; + char c = 0; + while (i < len) { + c = query.charAt(i); + i++; + if (('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('가' <= c && c <= '힣') || ' ' == c || '\t' == c) { + continue; + } else { + return false; + } + } + return true; + } + + /* + * css에서 사용하는 point 값을 pixel 값으로 바꾼다. (8pt = 11px, 9pt = 12px, 10pt = 13px, 11pt = 15px, 12pt = 16px, 13pt = 17px, 14pt = 19px) getTextWidth(), limitStringByFontWidth() 메서드에서 사용한다. + */ + private static int pointToPixel(int point) { + switch (point) { + case 8: + return 11; + case 9: + return 12; + case 10: + return 13; + case 11: + return 15; + case 12: + return 16; + case 13: + return 17; + case 14: + return 19; + default: + throw new RuntimeException("Point value must be 8 ~ 14"); + } + } + + /* + * font 이름으로 font 크기 정보를 담고 있는 테이블을 얻는다. getTextWidth(), limitStringByFontWidth() 메서드에서 사용한다. + */ + private static int[][] findFontMap(String fontName) { + String font = fontName.toLowerCase(); + if ("gulim".equals(font)) { + return gulim; + } else if ("dotum".equals(font)) { + return dotum; + } else if ("batang".equals(font)) { + return batang; + } else if ("gungsuh".equals(font)) { + return gungsuh; + } else if ("times".equals(font)) { + return times; + } else if ("arial".equals(font)) { + return arial; + } else if ("tahoma".equals(font)) { + return tahoma; + } else if ("verdana".equals(font)) { + return verdana; + } + return gulim; + } + + /** + * 문자열의 각 문자가 차지하는 픽셀을 세어 문자열이 표현될 때 너비가 정해진 픽셀을 넘지 않도록 문자열을 잘라준다. + * + * @param src + * 원본 문자열 + * @param width + * 픽셀 너비 + * @param postfix + * 문자열을 자를 때 생략 기호로 붙일 문자열 + * @param font + * 폰트 이름 (gulim, batang, dotum, gungsuh, arial, times, tahoma, verdana만 된다) + * @param pixel + * 폰트 크기 (pixel 단위, 8pt = 11px, 9pt = 12px, 10pt = 13px, 11pt = 15px, 12pt = 16px, 13pt = 17px, 14pt = 19px이다) + * @return 잘려진 문자열 + */ + public static String limitStringByFontWidth(String src, int width, String postfix, String font, int point) { + if (null == src || 0 == src.length()) { + return src; + } + int[][] fontMap = findFontMap(font); + + int size = 0; + int len = 0; + int pixel = pointToPixel(point); + if (!StringUtils.isEmpty(postfix)) { + for (int i = 0; i < len; i++) { + size += getFontWidth(postfix.charAt(i), fontMap, pixel); + } + } + int idx = 0; + len = src.length(); + while (idx < len) { + size += getFontWidth(src.charAt(idx), fontMap, pixel); + if (size >= width) { + break; + } + idx++; + } + + if (idx < len) { + String result = src.substring(0, idx); + if (!StringUtils.isEmpty(postfix)) { + result += postfix; + } + return result; + } else { + return src; + } + } + + public static int getTextWidth(String src, String font, int point) { + if (null == src || 0 == src.length()) { + return 0; + } + int[][] fontMap = findFontMap(font); + + int size = 0; + int len = src.length(); + int pixel = pointToPixel(point); + for (int i = 0; i < len; i++) { + size += getFontWidth(src.charAt(i), fontMap, pixel); + } + return size; + } + + private static int getFontWidth(char c, int[][] font, int pixel) { + if (c > 127) { + return pixel; + } + if (c >= 32 && c <= 127) { + return font[pixel - 11][c - 32]; + } + return (0 == pixel % 2 ? pixel / 2 : pixel / 2 + 1); + } + + // Gulim font family + private static int[][] gulim = { + // 11px + { 4, 3, 5, 7, 7, 10, 7, 3, 4, 4, 5, 5, 3, 5, 3, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 7, 6, 7, 6, 11, 8, 7, 8, 8, 7, 7, 9, 8, 3, 5, 7, 6, 9, 7, 9, 8, 9, 8, 8, 7, 8, 9, 11, 8, 8, 8, 4, 11, 4, 5, 6, 3, 7, 7, 7, 7, 7, 4, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 7, 4, 7, 7, 9, 6, 7, 6, 4, 3, 4, 6, 6 }, + // 12px + { 4, 4, 4, 6, 6, 10, 8, 4, 5, 5, 6, 6, 4, 6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 12, 8, 8, 9, 8, 8, 7, 9, 8, 3, 6, 8, 7, 11, 9, 9, 8, 9, 8, 8, 8, 8, 8, 10, 8, 8, 8, 6, 11, 6, 6, 6, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 6, 3, 11, 7, 7, 7, 7, 4, 7, 3, 7, 6, 10, 7, 7, 7, 6, 6, 6, 9, 6 }, + // 13px + { 4, 4, 4, 8, 7, 12, 8, 4, 5, 5, 7, 7, 4, 7, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 7, 7, 7, 7, 11, 8, 9, 9, 9, 8, 7, 10, 9, 3, 6, 8, 7, 11, 9, 10, 9, 10, 9, 9, 8, 9, 8, 12, 8, 8, 9, 7, 13, 7, 7, 7, 4, 8, 8, 8, 8, 8, 3, 8, 8, 3, 3, 6, 3, 11, 8, 8, 8, 8, 5, 8, 3, 8, 6, 10, 7, 7, 7, 7, 7, 7, 10, 7 }, + // 14px + { 5, 5, 5, 8, 9, 11, 9, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 10, 8, 10, 8, 13, 9, 10, 10, 10, 9, 8, 11, 10, 3, 6, 8, 8, 12, 9, 12, 10, 12, 10, 10, 8, 10, 8, 14, 9, 8, 9, 7, 14, 7, 7, 7, 5, 8, 8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 11, 8, 9, 8, 8, 4, 8, 4, 8, 8, 10, 9, 8, 8, 7, 7, 7, 11, + 7 }, + // 15px + { 5, 5, 5, 8, 9, 11, 9, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 10, 8, 10, 8, 13, 9, 10, 10, 10, 9, 8, 11, 10, 3, 6, 8, 8, 12, 9, 12, 10, 12, 10, 10, 8, 10, 8, 14, 9, 8, 9, 7, 14, 7, 7, 8, 5, 8, 8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 11, 8, 9, 8, 8, 4, 8, 4, 8, 8, 10, 9, 8, 8, 7, 7, 7, 11, + 8 }, + // 16px + { 5, 5, 5, 11, 9, 14, 10, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 5, 5, 11, 8, 11, 8, 13, 10, 10, 11, 10, 10, 9, 11, 10, 3, 6, 10, 9, 13, 11, 12, 10, 12, 10, 10, 9, 11, 10, 14, 11, 10, 10, 8, 14, 8, 8, 8, 6, 9, 9, 9, 9, 9, 5, 9, 9, 3, 4, 8, 3, 13, 9, 10, 9, 9, 5, 9, 5, 9, 8, 10, 9, 8, 9, + 8, 8, 8, 12, 8 }, + // 17px + { 5, 5, 5, 11, 9, 14, 10, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 5, 5, 11, 8, 11, 8, 13, 10, 10, 11, 10, 10, 9, 11, 10, 3, 6, 10, 9, 13, 11, 12, 10, 12, 10, 10, 9, 11, 10, 14, 11, 10, 10, 8, 14, 8, 8, 9, 6, 9, 9, 9, 9, 9, 5, 9, 9, 3, 4, 8, 3, 13, 9, 10, 9, 9, 5, 9, 5, 9, 8, 10, 9, 8, 9, + 8, 8, 8, 12, 9 }, + // 18px + { 6, 6, 6, 11, 11, 14, 12, 6, 6, 6, 9, 9, 6, 9, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 12, 9, 12, 11, 18, 12, 11, 12, 11, 11, 9, 12, 11, 3, 8, 11, 9, 15, 12, 13, 11, 13, 11, 11, 10, 11, 11, 15, 11, 11, 11, 9, 17, 9, 11, 9, 6, 10, 10, 10, 10, 10, 5, 10, 10, 3, 4, 9, 3, 15, 10, 11, 10, 10, 6, + 10, 5, 10, 10, 14, 10, 10, 9, 9, 9, 9, 14, 9 }, + // 19px + { 6, 6, 6, 11, 11, 14, 12, 6, 6, 6, 9, 9, 6, 9, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 12, 9, 12, 11, 18, 12, 11, 12, 11, 11, 9, 12, 11, 3, 8, 11, 9, 15, 12, 13, 11, 13, 11, 11, 10, 11, 11, 15, 11, 11, 11, 9, 17, 9, 11, 9, 6, 10, 10, 10, 10, 10, 5, 10, 10, 3, 4, 9, 3, 15, 10, 11, 10, 10, 6, + 10, 5, 10, 10, 14, 10, 10, 9, 9, 9, 9, 14, 10 } }; + // Dotum font family + private static int[][] dotum = { + // 11px + { 4, 3, 4, 7, 6, 10, 7, 3, 4, 4, 5, 6, 3, 6, 2, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 7, 6, 7, 6, 11, 8, 7, 8, 8, 7, 7, 9, 8, 3, 5, 7, 6, 9, 7, 9, 8, 9, 8, 8, 7, 8, 9, 11, 8, 8, 8, 4, 11, 4, 5, 6, 3, 7, 7, 7, 7, 7, 4, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 7, 4, 7, 6, 9, 6, 7, 6, 4, 3, 4, 6, 6 }, + // 12px + { 4, 3, 5, 7, 7, 11, 8, 4, 5, 5, 6, 6, 4, 6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 10, 8, 8, 9, 8, 8, 7, 9, 8, 3, 6, 7, 7, 11, 8, 9, 8, 9, 8, 8, 7, 8, 8, 10, 8, 8, 8, 6, 11, 6, 6, 6, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 7, 3, 7, 6, 10, 6, 6, 7, 6, 6, 6, 9, 6 }, + // 13px + { 4, 3, 5, 7, 7, 11, 8, 4, 5, 5, 6, 6, 4, 6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 7, 6, 7, 6, 10, 8, 8, 9, 8, 8, 7, 9, 8, 3, 6, 7, 7, 11, 8, 9, 8, 9, 8, 8, 7, 8, 8, 10, 8, 8, 8, 6, 11, 6, 6, 6, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 7, 3, 7, 6, 10, 6, 6, 7, 6, 6, 6, 9, 7 }, + // 14px + { 5, 5, 5, 8, 9, 10, 8, 5, 6, 6, 7, 8, 5, 8, 5, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 9, 8, 9, 8, 13, 8, 10, 10, 10, 9, 8, 11, 9, 3, 6, 8, 8, 12, 10, 12, 10, 12, 10, 10, 8, 10, 8, 14, 10, 10, 9, 7, 14, 7, 7, 7, 4, 8, 8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 11, 8, 9, 8, 8, 4, 7, 4, 8, 8, 10, 8, 8, 7, 7, 7, 7, 11, + 7 }, + // 15px + { 5, 5, 5, 8, 9, 10, 8, 5, 6, 6, 7, 8, 5, 8, 5, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 9, 8, 9, 8, 13, 8, 10, 10, 10, 9, 8, 11, 9, 3, 6, 8, 8, 12, 10, 12, 10, 12, 10, 10, 8, 10, 8, 14, 10, 10, 9, 7, 14, 7, 7, 8, 4, 8, 8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 11, 8, 9, 8, 8, 4, 7, 4, 8, 8, 10, 8, 8, 7, 7, 7, 7, 11, + 8 }, + // 16px + { 5, 5, 6, 13, 9, 13, 12, 5, 6, 6, 7, 8, 5, 8, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 9, 8, 9, 8, 16, 10, 10, 11, 10, 10, 9, 12, 10, 3, 8, 10, 9, 13, 11, 12, 10, 12, 10, 10, 9, 11, 10, 14, 11, 10, 10, 8, 14, 8, 8, 6, 5, 9, 9, 9, 9, 9, 5, 9, 9, 3, 4, 8, 3, 13, 9, 10, 9, 9, 5, 9, 5, 9, 8, 12, 9, 8, 9, 9, + 9, 9, 12, 8 }, + // 17px + { 5, 5, 6, 13, 9, 13, 12, 5, 6, 6, 7, 8, 5, 8, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 11, 8, 11, 8, 16, 10, 10, 11, 10, 10, 9, 12, 10, 3, 8, 10, 9, 13, 11, 12, 10, 12, 10, 10, 9, 11, 10, 14, 11, 10, 10, 8, 14, 8, 8, 8, 6, 9, 9, 9, 9, 9, 5, 9, 9, 3, 4, 8, 3, 13, 9, 10, 9, 9, 5, 9, 5, 9, 8, 12, 9, 8, 9, + 9, 9, 9, 12, 9 }, + // 18px + { 6, 6, 8, 13, 11, 15, 12, 5, 6, 6, 9, 10, 6, 10, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 11, 10, 11, 10, 15, 12, 11, 12, 12, 11, 10, 13, 12, 3, 8, 10, 10, 13, 11, 13, 11, 13, 11, 11, 10, 12, 11, 15, 11, 11, 11, 9, 17, 9, 9, 9, 5, 9, 10, 10, 10, 10, 5, 10, 9, 3, 4, 9, 3, 15, 10, 11, 10, 10, 5, + 9, 5, 10, 10, 14, 10, 9, 10, 9, 9, 9, 14, 9 }, + // 19px + { 6, 6, 8, 13, 11, 15, 12, 5, 6, 6, 9, 10, 6, 10, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 10, 10, 10, 10, 15, 12, 11, 12, 12, 11, 10, 13, 12, 3, 8, 10, 10, 13, 11, 13, 11, 13, 11, 11, 10, 12, 11, 15, 11, 11, 11, 9, 17, 9, 9, 10, 5, 9, 10, 10, 10, 10, 5, 10, 9, 3, 4, 9, 3, 15, 10, 11, 10, 10, 5, + 9, 5, 10, 10, 14, 10, 9, 10, 9, 9, 9, 14, 10 } }; + // Batang font family + private static int[][] batang = { + // 11px + { 4, 3, 4, 6, 6, 9, 8, 3, 4, 4, 6, 6, 2, 6, 2, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 6, 6, 10, 9, 8, 8, 8, 7, 6, 9, 8, 4, 5, 8, 6, 9, 8, 8, 7, 8, 8, 7, 7, 8, 7, 10, 7, 7, 7, 4, 11, 4, 6, 6, 3, 7, 7, 6, 7, 6, 4, 7, 6, 3, 3, 6, 3, 9, 6, 6, 6, 6, 5, 6, 4, 6, 7, 9, 6, 6, 6, 4, 3, 4, 6, 6 }, + // 12px + { 4, 4, 5, 7, 7, 10, 9, 4, 5, 5, 6, 6, 4, 6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 11, 9, 8, 8, 8, 8, 8, 9, 9, 4, 5, 9, 8, 11, 9, 9, 8, 10, 9, 7, 7, 8, 9, 11, 7, 7, 7, 6, 11, 6, 6, 6, 4, 7, 7, 7, 8, 7, 5, 7, 8, 4, 3, 7, 4, 10, 8, 7, 7, 8, 6, 6, 5, 7, 7, 11, 7, 7, 6, 6, 6, 6, 9, 6 }, + // 13px + { 4, 4, 4, 8, 7, 12, 11, 4, 5, 5, 7, 7, 4, 7, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 7, 8, 7, 12, 9, 9, 9, 9, 8, 8, 10, 9, 3, 5, 8, 8, 11, 9, 10, 8, 10, 8, 8, 9, 9, 9, 11, 8, 9, 9, 7, 12, 7, 7, 7, 4, 7, 8, 8, 8, 8, 4, 8, 7, 3, 4, 7, 3, 11, 7, 8, 8, 8, 5, 8, 4, 7, 7, 11, 7, 7, 7, 7, 7, 7, 8, 7 }, + // 14px + { 5, 5, 5, 10, 9, 13, 11, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 13, 9, 9, 9, 9, 9, 8, 10, 9, 3, 5, 9, 8, 11, 9, 10, 8, 10, 9, 9, 9, 9, 9, 11, 8, 9, 10, 7, 12, 7, 8, 7, 5, 7, 8, 8, 8, 8, 4, 8, 7, 3, 4, 8, 4, 12, 8, 7, 8, 8, 6, 6, 4, 7, 7, 11, 8, 8, 7, 7, 7, 7, 11, 7 }, + // 15px + { 5, 5, 5, 10, 9, 13, 11, 5, 6, 6, 7, 8, 5, 8, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 13, 9, 9, 9, 9, 9, 8, 10, 9, 3, 5, 9, 8, 11, 9, 10, 8, 10, 9, 9, 9, 9, 9, 11, 8, 9, 10, 7, 12, 7, 8, 8, 5, 7, 8, 8, 8, 8, 4, 8, 7, 3, 4, 8, 4, 12, 8, 7, 8, 8, 6, 6, 4, 7, 7, 11, 8, 8, 7, 7, 7, 7, 11, 8 }, + // 16px + { 5, 5, 5, 10, 9, 15, 13, 5, 5, 5, 9, 9, 5, 9, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 8, 9, 8, 9, 14, 12, 12, 12, 12, 11, 10, 12, 10, 5, 7, 12, 10, 15, 12, 13, 11, 13, 11, 10, 11, 13, 13, 14, 12, 11, 10, 8, 17, 8, 9, 8, 5, 8, 9, 8, 9, 8, 6, 9, 9, 4, 5, 9, 4, 14, 9, 9, 9, 9, 7, 8, 6, 9, 9, 11, 8, 9, 7, + 8, 8, 8, 12, 8 }, + // 17px + { 5, 5, 5, 10, 9, 15, 13, 5, 5, 5, 9, 9, 5, 9, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 8, 9, 8, 9, 14, 12, 12, 12, 12, 11, 10, 12, 10, 5, 7, 12, 10, 15, 12, 13, 11, 13, 11, 10, 11, 13, 13, 14, 12, 11, 10, 8, 17, 8, 9, 9, 5, 8, 9, 8, 9, 8, 6, 9, 9, 4, 5, 9, 4, 14, 9, 9, 9, 9, 7, 8, 6, 9, 9, 11, 8, 9, 7, + 8, 8, 8, 12, 9 }, + // 18px + { 6, 8, 8, 15, 11, 17, 15, 5, 9, 9, 9, 11, 5, 11, 5, 6, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 6, 6, 11, 10, 11, 9, 18, 14, 12, 12, 13, 12, 11, 13, 14, 7, 8, 14, 11, 17, 14, 13, 11, 13, 12, 11, 14, 14, 13, 17, 12, 12, 11, 9, 17, 9, 18, 9, 11, 9, 10, 9, 10, 10, 7, 10, 10, 5, 5, 10, 5, 15, 10, 10, 10, 10, + 8, 9, 7, 10, 10, 14, 11, 11, 8, 11, 11, 11, 14, 9 }, + // 19px + { 6, 6, 6, 13, 11, 15, 14, 6, 6, 6, 9, 10, 6, 10, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 9, 9, 9, 11, 17, 11, 11, 11, 12, 11, 10, 12, 12, 5, 7, 12, 10, 15, 13, 13, 10, 14, 12, 11, 11, 13, 13, 16, 12, 11, 10, 9, 17, 9, 10, 10, 6, 9, 10, 9, 9, 9, 6, 10, 10, 5, 5, 10, 5, 14, 10, 9, 9, 10, 8, 8, + 6, 10, 10, 12, 10, 10, 8, 9, 9, 9, 13, 10 } }; + // Gungsuh font family + private static int[][] gungsuh = { + // 11px + { 4, 3, 4, 6, 7, 9, 7, 3, 5, 5, 6, 6, 3, 6, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 7, 6, 7, 6, 7, 7, 7, 8, 7, 7, 7, 8, 7, 5, 6, 7, 6, 7, 7, 8, 7, 8, 7, 8, 7, 7, 7, 7, 7, 7, 8, 4, 9, 4, 4, 6, 3, 7, 7, 8, 7, 8, 5, 7, 7, 5, 6, 6, 5, 7, 7, 7, 7, 7, 6, 8, 6, 7, 7, 7, 6, 7, 8, 5, 3, 5, 6, 6 }, + // 12px + { 4, 4, 5, 7, 7, 9, 7, 4, 5, 5, 6, 6, 4, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 8, 7, 7, 8, 8, 7, 6, 8, 7, 5, 6, 7, 7, 7, 7, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 8, 6, 6, 6, 4, 7, 7, 8, 7, 7, 5, 7, 7, 5, 5, 6, 5, 7, 6, 8, 7, 7, 5, 7, 4, 7, 7, 7, 7, 7, 7, 6, 6, 6, 9, 6 }, + // 13px + { 4, 4, 5, 7, 7, 9, 7, 4, 5, 5, 6, 6, 4, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 8, 7, 7, 8, 8, 7, 6, 8, 7, 5, 6, 7, 7, 7, 7, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 8, 6, 6, 7, 4, 7, 7, 8, 7, 7, 5, 7, 7, 5, 5, 6, 5, 7, 6, 8, 7, 7, 5, 7, 4, 7, 7, 7, 7, 7, 7, 6, 6, 6, 9, 7 }, + // 14px + { 5, 5, 5, 8, 7, 10, 8, 5, 5, 5, 7, 7, 5, 7, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 8, 7, 8, 7, 9, 8, 8, 9, 8, 8, 7, 8, 7, 5, 7, 8, 8, 9, 8, 9, 8, 9, 8, 8, 7, 8, 7, 9, 7, 7, 8, 7, 11, 7, 7, 7, 4, 8, 8, 8, 8, 8, 5, 8, 8, 5, 5, 7, 5, 9, 7, 9, 8, 8, 5, 8, 5, 8, 7, 9, 7, 7, 8, 7, 7, 7, 11, 7 }, + // 15px + { 5, 5, 5, 8, 7, 10, 8, 5, 5, 5, 7, 7, 5, 7, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 9, 7, 9, 7, 9, 8, 8, 9, 8, 8, 7, 8, 7, 5, 7, 8, 8, 9, 8, 9, 8, 9, 8, 8, 7, 8, 7, 9, 7, 7, 8, 7, 11, 7, 7, 8, 4, 8, 8, 8, 8, 8, 5, 8, 8, 5, 5, 7, 5, 9, 7, 9, 8, 8, 5, 8, 5, 8, 7, 9, 7, 7, 8, 7, 7, 7, 11, 8 }, + // 16px + { 5, 5, 7, 11, 10, 11, 9, 5, 6, 6, 8, 9, 5, 9, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 9, 9, 9, 9, 11, 9, 9, 9, 9, 9, 8, 10, 9, 6, 8, 9, 8, 10, 9, 10, 9, 10, 9, 10, 8, 9, 9, 10, 9, 10, 9, 8, 12, 8, 8, 8, 5, 9, 9, 10, 9, 10, 6, 9, 9, 6, 6, 9, 6, 10, 9, 10, 9, 9, 8, 9, 8, 9, 9, 10, 8, 9, 9, 8, 8, 8, 12, 8 }, + // 17px + { 5, 5, 7, 11, 10, 11, 9, 5, 6, 6, 8, 9, 5, 9, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 10, 9, 10, 9, 11, 9, 9, 9, 9, 9, 8, 10, 9, 6, 8, 9, 8, 10, 9, 10, 9, 10, 9, 10, 8, 9, 9, 10, 9, 10, 9, 8, 12, 8, 8, 9, 5, 9, 9, 10, 9, 10, 6, 9, 9, 6, 6, 9, 6, 10, 9, 10, 9, 9, 8, 9, 8, 9, 9, 10, 8, 9, 9, 8, 8, 8, 12, + 9 }, + // 18px + { 6, 6, 7, 11, 11, 12, 11, 5, 7, 7, 10, 10, 6, 10, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 11, 10, 11, 10, 12, 11, 11, 11, 11, 11, 11, 11, 12, 8, 9, 13, 11, 15, 13, 13, 11, 13, 12, 11, 10, 13, 14, 16, 11, 12, 11, 9, 16, 9, 10, 9, 6, 10, 12, 11, 11, 11, 8, 11, 10, 6, 7, 10, 6, 14, 10, 12, 11, + 10, 10, 10, 8, 10, 10, 13, 9, 10, 10, 9, 9, 9, 14, 9 }, + // 19px + { 6, 6, 7, 11, 11, 12, 11, 5, 7, 7, 10, 10, 6, 10, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 11, 10, 11, 10, 12, 11, 11, 11, 11, 11, 11, 11, 12, 8, 9, 13, 11, 15, 13, 13, 11, 13, 12, 11, 10, 13, 14, 16, 11, 12, 11, 9, 16, 9, 10, 10, 6, 10, 12, 11, 11, 11, 8, 11, 10, 6, 7, 10, 6, 14, 10, 12, 11, + 10, 10, 10, 8, 10, 10, 13, 9, 10, 10, 9, 9, 9, 14, 10 } }; + // Arial font family + private static int[][] arial = { + // 11px + { 3, 2, 4, 6, 6, 10, 7, 2, 4, 4, 4, 6, 3, 4, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 6, 6, 11, 8, 7, 7, 7, 6, 6, 8, 7, 2, 5, 7, 6, 8, 7, 8, 6, 8, 7, 7, 6, 7, 8, 10, 7, 8, 7, 3, 3, 3, 5, 6, 4, 6, 6, 6, 6, 6, 4, 6, 6, 2, 2, 5, 2, 8, 6, 6, 6, 6, 4, 6, 3, 6, 6, 10, 6, 6, 6, 4, 2, 4, 6, 6 }, + // 12px + { 3, 3, 4, 7, 7, 11, 8, 2, 4, 4, 5, 7, 3, 4, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 7, 7, 7, 7, 12, 7, 8, 9, 9, 8, 7, 9, 9, 3, 6, 8, 7, 9, 9, 9, 8, 9, 9, 8, 7, 9, 7, 11, 7, 7, 7, 3, 3, 3, 5, 7, 4, 7, 7, 6, 7, 7, 3, 7, 7, 3, 3, 6, 3, 11, 7, 7, 7, 7, 4, 7, 3, 7, 5, 9, 5, 5, 5, 4, 3, 4, 7, 6 }, + // 13px + { 4, 3, 5, 7, 7, 12, 9, 2, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 7, 13, 9, 9, 9, 9, 9, 8, 10, 9, 3, 6, 9, 7, 11, 9, 10, 9, 10, 9, 9, 7, 9, 9, 13, 7, 9, 7, 4, 4, 4, 5, 7, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 7, 3, 11, 7, 7, 7, 7, 4, 7, 4, 7, 5, 9, 7, 7, 7, 4, 3, 4, 8, 8 }, + // 14px + { 4, 5, 5, 8, 8, 12, 9, 3, 5, 5, 5, 8, 4, 5, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 14, 9, 9, 10, 10, 9, 9, 11, 9, 3, 6, 9, 8, 11, 9, 11, 9, 11, 10, 9, 9, 9, 9, 13, 8, 9, 8, 4, 4, 4, 5, 8, 5, 8, 8, 7, 8, 8, 4, 8, 8, 3, 3, 7, 3, 11, 8, 8, 8, 8, 5, 7, 4, 8, 7, 9, 6, 7, 6, 5, 3, 5, 8, 7 }, + // 15px + { 4, 5, 5, 8, 8, 13, 10, 3, 5, 5, 6, 9, 4, 5, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 9, 9, 9, 8, 15, 9, 10, 11, 11, 10, 9, 11, 10, 3, 7, 10, 8, 11, 10, 12, 10, 12, 11, 10, 9, 10, 9, 15, 9, 9, 8, 4, 4, 4, 5, 8, 5, 8, 8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 13, 8, 8, 8, 8, 5, 8, 4, 8, 7, 11, 7, 7, 8, 5, 3, 5, 9, + 8 }, + // 16px + { 4, 5, 6, 9, 9, 14, 11, 3, 5, 5, 6, 9, 4, 5, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 9, 9, 9, 9, 16, 11, 11, 12, 12, 11, 10, 12, 11, 3, 8, 11, 9, 13, 11, 12, 11, 12, 11, 11, 9, 11, 11, 15, 11, 9, 9, 4, 4, 4, 7, 9, 5, 9, 9, 8, 9, 9, 4, 9, 8, 4, 3, 8, 3, 13, 8, 9, 9, 9, 5, 8, 4, 8, 7, 11, 7, 7, 7, 5, 3, + 5, 9, 8 }, + // 17px + { 5, 5, 6, 9, 9, 15, 11, 3, 6, 6, 7, 10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 10, 10, 10, 9, 17, 11, 11, 12, 12, 11, 10, 12, 11, 5, 9, 11, 9, 13, 11, 12, 11, 12, 11, 11, 9, 11, 11, 17, 11, 11, 9, 5, 5, 5, 7, 9, 6, 9, 9, 9, 9, 9, 5, 9, 9, 4, 3, 8, 3, 13, 9, 9, 9, 9, 6, 8, 4, 9, 7, 11, 7, 9, 8, 6, + 5, 6, 10, 9 }, + // 18px + { 5, 6, 6, 10, 10, 16, 12, 3, 6, 6, 7, 11, 5, 6, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 11, 11, 11, 10, 18, 11, 12, 13, 13, 12, 11, 14, 13, 4, 9, 12, 10, 15, 13, 14, 12, 14, 13, 12, 12, 13, 11, 17, 11, 12, 11, 5, 5, 5, 7, 10, 6, 10, 10, 9, 10, 10, 5, 10, 10, 4, 4, 9, 4, 14, 10, 10, 10, 10, 6, + 9, 5, 10, 9, 13, 8, 9, 8, 6, 6, 6, 11, 9 }, + // 19px + { 5, 6, 7, 11, 11, 17, 13, 4, 6, 6, 7, 11, 5, 6, 5, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 5, 11, 11, 11, 11, 19, 13, 13, 14, 14, 13, 12, 15, 13, 6, 10, 13, 11, 15, 13, 15, 13, 15, 14, 13, 12, 13, 13, 19, 13, 12, 12, 5, 5, 5, 7, 11, 6, 10, 11, 10, 11, 11, 6, 11, 10, 4, 4, 9, 4, 16, 10, 11, 11, 11, + 6, 10, 5, 10, 9, 13, 9, 9, 9, 6, 6, 6, 11, 10 } }; + // Tahoma font family + private static int[][] tahoma = { + // 11px + { 3, 4, 4, 8, 6, 11, 7, 2, 4, 4, 6, 8, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 8, 8, 5, 10, 7, 6, 7, 7, 6, 6, 7, 7, 4, 5, 6, 5, 8, 7, 8, 6, 8, 7, 6, 6, 7, 6, 10, 6, 6, 6, 4, 11, 4, 8, 6, 6, 6, 6, 5, 6, 6, 4, 6, 6, 2, 3, 5, 2, 8, 6, 6, 6, 6, 4, 5, 4, 6, 6, 8, 6, 6, 5, 5, 4, 5, 8, 6 }, + // 12px + { 4, 4, 5, 9, 7, 12, 8, 3, 5, 5, 7, 8, 4, 4, 4, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 9, 9, 9, 6, 11, 8, 7, 7, 8, 7, 6, 8, 8, 4, 5, 7, 6, 9, 8, 9, 7, 9, 7, 7, 8, 8, 8, 12, 7, 8, 7, 5, 11, 5, 9, 7, 7, 6, 7, 6, 7, 7, 4, 7, 7, 2, 3, 6, 2, 10, 7, 7, 7, 7, 4, 5, 5, 7, 6, 10, 6, 6, 5, 6, 5, 6, 9, 6 }, + // 13px + { 4, 4, 5, 9, 7, 12, 9, 3, 5, 5, 8, 8, 4, 5, 4, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 9, 9, 9, 6, 12, 8, 7, 8, 8, 7, 7, 8, 8, 4, 5, 7, 6, 10, 8, 9, 7, 9, 8, 8, 8, 8, 8, 12, 8, 7, 7, 5, 14, 5, 9, 7, 7, 7, 7, 6, 7, 7, 4, 7, 7, 3, 4, 6, 3, 11, 7, 7, 7, 7, 5, 6, 4, 7, 6, 10, 6, 6, 6, 6, 6, 6, 9, 8 }, + // 14px + { 4, 4, 6, 10, 8, 14, 9, 3, 5, 5, 8, 10, 4, 5, 4, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 10, 10, 10, 7, 13, 8, 8, 9, 10, 8, 7, 9, 9, 4, 6, 8, 7, 10, 9, 10, 8, 10, 9, 8, 8, 9, 8, 14, 8, 8, 8, 5, 14, 5, 10, 8, 8, 7, 8, 7, 8, 7, 4, 8, 8, 2, 4, 7, 2, 12, 8, 8, 8, 8, 5, 6, 5, 8, 8, 10, 8, 8, 6, 7, 5, 7, 10, 7 }, + // 15px + { 5, 4, 6, 11, 8, 15, 10, 3, 6, 6, 8, 11, 5, 5, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 11, 11, 11, 7, 14, 9, 9, 9, 10, 8, 8, 10, 10, 6, 6, 9, 7, 12, 10, 11, 8, 11, 9, 8, 10, 10, 9, 14, 9, 10, 8, 6, 14, 6, 11, 8, 8, 8, 8, 7, 8, 8, 5, 8, 8, 2, 4, 7, 2, 13, 8, 8, 8, 8, 5, 7, 5, 8, 8, 10, 8, 8, 7, 7, 6, 7, + 11, 8 }, + // 16px + { 5, 4, 6, 12, 9, 16, 11, 3, 6, 6, 9, 12, 5, 6, 5, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 12, 12, 12, 8, 15, 11, 9, 10, 11, 9, 8, 11, 11, 6, 7, 9, 8, 12, 11, 12, 9, 12, 10, 9, 10, 11, 10, 14, 9, 10, 9, 6, 14, 6, 12, 9, 9, 8, 9, 7, 9, 8, 5, 9, 9, 4, 5, 8, 4, 14, 9, 9, 9, 9, 6, 7, 5, 9, 8, 12, 8, 8, 7, 8, 6, + 8, 12, 8 }, + // 17px + { 5, 6, 7, 12, 9, 17, 11, 4, 7, 7, 9, 12, 5, 6, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 12, 12, 12, 8, 15, 11, 10, 10, 12, 10, 9, 11, 11, 6, 7, 10, 8, 13, 11, 12, 9, 12, 11, 9, 10, 11, 10, 15, 10, 10, 10, 7, 14, 7, 12, 9, 9, 9, 9, 8, 9, 9, 5, 9, 9, 4, 5, 8, 4, 14, 9, 9, 9, 9, 6, 8, 6, 9, 8, 13, 8, 8, 8, + 8, 7, 8, 12, 9 }, + // 18px + { 6, 6, 7, 13, 10, 18, 12, 4, 7, 7, 10, 13, 5, 7, 5, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 13, 13, 13, 9, 16, 11, 11, 11, 12, 10, 9, 12, 12, 7, 8, 11, 9, 14, 12, 13, 10, 13, 11, 10, 11, 12, 11, 16, 10, 10, 10, 7, 17, 7, 13, 10, 10, 9, 10, 8, 10, 9, 6, 10, 10, 4, 5, 9, 4, 15, 10, 10, 10, 10, 6, + 8, 6, 10, 9, 13, 9, 9, 8, 9, 7, 9, 13, 9 }, + // 19px + { 6, 6, 8, 14, 10, 19, 13, 4, 7, 7, 10, 14, 6, 7, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 14, 14, 14, 9, 17, 11, 11, 11, 13, 11, 10, 13, 13, 7, 8, 11, 9, 15, 13, 13, 10, 13, 12, 11, 11, 12, 11, 17, 11, 11, 11, 7, 17, 7, 14, 10, 10, 10, 11, 9, 11, 10, 6, 11, 11, 4, 5, 9, 4, 16, 11, 10, 11, 11, + 7, 8, 6, 11, 9, 14, 9, 9, 8, 9, 7, 9, 14, 10 } }; + // Times new Roman font family + private static int[][] times = { + // 11px + { 3, 4, 5, 6, 6, 9, 9, 2, 4, 4, 6, 6, 3, 4, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 6, 5, 10, 8, 7, 7, 8, 7, 6, 7, 8, 4, 4, 8, 7, 10, 8, 8, 7, 8, 7, 5, 8, 8, 7, 11, 8, 8, 7, 4, 3, 4, 5, 6, 4, 5, 5, 5, 5, 5, 4, 5, 6, 3, 3, 6, 3, 9, 6, 6, 6, 5, 4, 4, 4, 5, 6, 7, 6, 6, 5, 5, 2, 5, 6, 6 }, + // 12px + { 3, 4, 5, 6, 6, 10, 9, 2, 4, 4, 6, 7, 3, 4, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 7, 7, 7, 5, 11, 9, 8, 8, 9, 7, 7, 9, 9, 4, 5, 9, 7, 12, 9, 9, 7, 9, 8, 6, 8, 9, 8, 11, 9, 8, 8, 4, 3, 4, 6, 6, 4, 5, 6, 5, 6, 5, 4, 5, 6, 3, 3, 6, 3, 9, 6, 6, 7, 6, 4, 5, 4, 6, 6, 9, 5, 7, 6, 6, 2, 6, 6, 6 }, + // 13px + { 3, 4, 6, 7, 6, 11, 10, 2, 4, 4, 7, 7, 3, 4, 3, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 4, 7, 7, 7, 6, 12, 10, 8, 8, 9, 7, 7, 8, 9, 4, 5, 9, 7, 12, 9, 9, 7, 9, 8, 7, 8, 9, 8, 13, 9, 8, 8, 4, 4, 4, 6, 7, 4, 6, 7, 6, 7, 6, 4, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 6, 4, 7, 7, 9, 5, 7, 5, 6, 2, 6, 7, 8 }, + // 14px + { 4, 5, 5, 7, 7, 12, 11, 3, 5, 5, 7, 8, 4, 5, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 4, 8, 8, 8, 6, 13, 9, 8, 9, 10, 8, 8, 10, 9, 5, 6, 9, 8, 12, 10, 10, 8, 10, 9, 8, 9, 9, 9, 13, 10, 9, 8, 5, 4, 5, 6, 7, 4, 6, 7, 7, 7, 6, 5, 7, 7, 3, 3, 7, 3, 11, 7, 7, 7, 7, 5, 6, 4, 7, 7, 11, 7, 7, 6, 7, 3, 7, 8, 7 }, + // 15px + { 4, 5, 5, 8, 7, 13, 12, 3, 5, 5, 7, 8, 3, 5, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 4, 8, 8, 8, 7, 14, 11, 10, 10, 11, 9, 8, 10, 11, 5, 6, 11, 9, 13, 11, 11, 9, 11, 10, 8, 9, 11, 11, 14, 10, 11, 9, 5, 4, 5, 6, 8, 4, 7, 7, 7, 7, 7, 5, 7, 7, 3, 3, 7, 3, 11, 7, 7, 7, 7, 5, 6, 4, 7, 7, 11, 7, 7, 6, 7, 3, 7, + 8, 8 }, + // 16px + { 4, 5, 5, 8, 8, 13, 12, 3, 5, 5, 8, 9, 4, 6, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 4, 9, 9, 9, 7, 15, 11, 10, 11, 11, 9, 9, 11, 11, 5, 6, 12, 9, 14, 12, 12, 9, 12, 10, 9, 9, 11, 11, 15, 11, 11, 9, 5, 4, 5, 8, 8, 5, 7, 8, 7, 8, 7, 4, 7, 7, 3, 4, 8, 3, 11, 7, 8, 8, 8, 5, 6, 4, 7, 7, 11, 7, 7, 6, 7, 3, 8, + 9, 8 }, + // 17px + { 4, 5, 5, 9, 9, 14, 13, 3, 6, 6, 9, 10, 4, 6, 4, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 4, 10, 10, 10, 7, 15, 11, 11, 11, 12, 10, 9, 12, 12, 5, 7, 12, 10, 15, 12, 12, 10, 12, 11, 9, 9, 12, 11, 16, 12, 11, 10, 5, 5, 5, 8, 9, 6, 7, 8, 8, 8, 8, 6, 8, 8, 5, 5, 8, 5, 13, 8, 9, 8, 8, 6, 7, 5, 8, 7, 11, 8, 8, 7, 8, + 3, 8, 9, 9 }, + // 18px + { 5, 6, 7, 9, 9, 15, 14, 4, 6, 6, 9, 10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 5, 10, 10, 10, 8, 16, 12, 12, 12, 13, 11, 10, 13, 13, 6, 7, 13, 11, 16, 13, 13, 11, 13, 12, 10, 12, 13, 12, 17, 13, 13, 11, 6, 5, 6, 8, 9, 6, 8, 9, 8, 9, 8, 6, 8, 9, 4, 5, 9, 4, 14, 9, 9, 9, 9, 6, 7, 5, 9, 9, 13, 8, 9, 8, + 9, 3, 9, 10, 9 }, + // 19px + { 5, 6, 8, 10, 9, 16, 15, 4, 6, 6, 9, 11, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 5, 11, 11, 11, 8, 17, 13, 12, 13, 13, 11, 11, 14, 13, 6, 7, 13, 11, 16, 13, 14, 11, 14, 13, 11, 12, 13, 13, 18, 13, 13, 11, 6, 5, 6, 8, 10, 6, 8, 10, 9, 10, 8, 6, 9, 9, 4, 4, 9, 4, 14, 9, 10, 10, 10, 6, 8, 5, 9, 9, 13, + 9, 9, 8, 9, 3, 9, 10, 10 } }; + // Verdana font family + private static int[][] verdana = { + // 11px + { 4, 4, 5, 9, 7, 12, 8, 3, 5, 5, 7, 9, 4, 5, 4, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 9, 9, 9, 6, 10, 8, 8, 9, 9, 7, 6, 9, 8, 5, 5, 8, 6, 9, 8, 9, 7, 9, 8, 8, 7, 8, 8, 11, 8, 7, 8, 5, 5, 5, 9, 7, 7, 7, 7, 6, 7, 7, 4, 7, 7, 3, 4, 7, 3, 11, 7, 7, 7, 7, 5, 6, 4, 7, 7, 9, 7, 7, 6, 7, 5, 7, 9, 6 }, + // 12px + { 4, 5, 6, 10, 8, 13, 9, 3, 5, 5, 8, 9, 4, 5, 4, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 9, 9, 9, 7, 12, 8, 8, 9, 9, 8, 7, 9, 9, 5, 5, 8, 7, 10, 9, 10, 8, 10, 8, 8, 7, 9, 8, 13, 8, 7, 8, 5, 5, 5, 10, 8, 8, 8, 8, 6, 8, 8, 4, 8, 8, 3, 4, 7, 3, 11, 8, 8, 8, 8, 5, 7, 5, 8, 7, 11, 7, 7, 7, 8, 5, 8, 10, 6 }, + // 13px + { 5, 5, 5, 10, 8, 13, 9, 3, 6, 6, 9, 9, 5, 7, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 9, 9, 9, 7, 13, 9, 8, 9, 9, 8, 8, 9, 9, 5, 6, 8, 7, 11, 9, 10, 8, 10, 8, 9, 9, 9, 9, 13, 9, 9, 9, 6, 6, 6, 11, 8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 3, 4, 7, 3, 11, 8, 8, 8, 8, 5, 7, 6, 8, 8, 11, 7, 8, 7, 8, 7, 8, 11, 8 }, + // 14px + { 5, 6, 6, 11, 9, 15, 10, 4, 6, 6, 9, 11, 5, 7, 5, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 11, 11, 11, 8, 14, 10, 10, 10, 11, 9, 8, 11, 10, 5, 6, 10, 8, 11, 10, 11, 8, 11, 10, 10, 9, 10, 10, 15, 10, 9, 10, 6, 6, 6, 11, 9, 9, 8, 9, 7, 9, 8, 5, 9, 9, 3, 5, 8, 3, 13, 9, 9, 9, 9, 6, 8, 6, 9, 8, 11, 9, 8, 8, 9, + 6, 9, 11, 7 }, + // 15px + { 5, 6, 7, 12, 10, 16, 11, 4, 7, 7, 10, 12, 5, 7, 5, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 12, 12, 12, 8, 15, 10, 10, 11, 11, 9, 9, 12, 11, 5, 7, 10, 8, 13, 11, 12, 9, 12, 10, 10, 9, 11, 10, 15, 10, 9, 10, 7, 7, 7, 12, 10, 10, 9, 9, 8, 9, 9, 5, 9, 9, 3, 5, 9, 3, 15, 9, 10, 9, 9, 6, 8, 6, 9, 9, + 13, 9, 9, 9, 10, 7, 10, 12, 8 }, + // 16px + { 6, 6, 7, 13, 10, 17, 12, 4, 7, 7, 10, 13, 6, 7, 6, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 13, 13, 13, 9, 16, 11, 11, 11, 12, 10, 9, 12, 12, 7, 7, 11, 9, 13, 12, 13, 10, 13, 11, 10, 10, 12, 11, 17, 11, 11, 11, 7, 7, 7, 13, 10, 10, 10, 10, 8, 10, 10, 6, 10, 10, 5, 6, 9, 5, 15, 10, 10, 10, 10, 6, + 9, 7, 10, 9, 13, 9, 9, 9, 10, 7, 10, 13, 8 }, + // 17px + { 6, 7, 8, 14, 11, 18, 12, 5, 8, 8, 11, 14, 6, 8, 6, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 14, 14, 14, 9, 17, 12, 12, 12, 13, 11, 10, 13, 13, 8, 8, 12, 9, 14, 13, 13, 10, 13, 12, 12, 10, 12, 12, 17, 12, 10, 12, 8, 8, 8, 14, 11, 11, 10, 11, 9, 11, 10, 6, 11, 11, 5, 6, 10, 5, 17, 11, 10, 11, 11, + 7, 9, 7, 11, 10, 14, 10, 10, 9, 11, 8, 11, 14, 9 }, + // 18px + { 6, 7, 8, 15, 11, 19, 13, 5, 8, 8, 11, 15, 7, 8, 7, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 15, 15, 15, 10, 18, 12, 12, 13, 14, 11, 10, 14, 14, 8, 8, 12, 10, 15, 13, 14, 11, 14, 13, 12, 11, 13, 12, 18, 12, 11, 12, 8, 8, 8, 15, 11, 11, 11, 11, 9, 11, 11, 6, 11, 11, 5, 6, 11, 5, 18, 11, 11, 11, 11, + 8, 9, 7, 11, 11, 15, 11, 11, 9, 11, 8, 11, 15, 9 }, + // 19px + { 7, 7, 9, 16, 12, 20, 14, 5, 9, 9, 12, 16, 7, 9, 7, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 16, 16, 16, 10, 19, 13, 13, 13, 15, 12, 11, 15, 14, 8, 9, 13, 11, 16, 14, 15, 11, 15, 13, 13, 12, 14, 13, 19, 13, 12, 13, 9, 9, 9, 16, 12, 12, 11, 12, 10, 12, 11, 7, 12, 12, 6, 7, 11, 6, 18, 12, 12, 12, + 12, 8, 10, 7, 12, 11, 16, 11, 11, 10, 12, 9, 12, 16, 10 } }; + + public static String getUseOnOff(String value) { + if ("0".equals(value)) { + return "OFF"; + } else if ("1".equals(value)) { + return "ON"; + } + return ""; + } + + public static String getUseOnOffReverse(String value) { + if ("0".equals(value)) { + return "ON"; + } else if ("1".equals(value)) { + return "OFF"; + } + return ""; + } + + /** + * 9번째 URL 변경 + */ + public static String getUrlByDepth(HttpServletRequest request, int Depth, String targetUrl) { + String preUrl = request.getHeader("Referer"); + String[] urlArray = preUrl.split("\\?"); + String[] opernerUrlArray = urlArray[0].split("/"); + opernerUrlArray[Depth] = targetUrl; + String url = StringUtils.join(opernerUrlArray, "/"); + return url; + } + + /** + * int[] arry 값 Sum + */ + public static String arraySum(int[] valuel) { + int arrSum = 0; + for (Integer control : valuel) { + arrSum = arrSum + control; + } + return String.valueOf(arrSum); + } + + /** + * 멤버객체값을 바인딩된 문자열 값으로 변환해 주는 유틸 1;2;3;4;5 => one,two,three,four,five input => 멤버객체스트링, 멤버를분기할Flag, 바인딩할 맵객체, 키 + */ + public static String getBindStringFromMembers(String includeMemberString, String seperator, Map> bindTypes, String typeKey) { + + String[] membersArray = StringUtils.split(includeMemberString, seperator); + List bindStringList = new ArrayList<>(); + for (String memberKey : membersArray) { + bindStringList.add(Text.getBindType(bindTypes, typeKey, memberKey)); + } + + return StringUtils.join(bindStringList, ","); + } + + /** + * 멤버 객체값을 분기하는 Flag를 , 로 변환하는 유틸 + */ + public static String getReplaceCommaFromMembers(String includeMemberString, String seperator) { + String returnStr = includeMemberString.replace(seperator, ","); + return returnStr; + } + + /** + * 로그 유틸 : 비밀번호 *로 표시 함수 + */ + public static String getToPasswordString(String pass) { + + if (pass == null) { + return ""; + } + + String output = ""; + for (int i = 0; i < pass.length(); i++) { + output += "*"; + } + + return output; + } +} Index: standard/project/web/src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml =================================================================== diff -u -r95f20c1e1742229ebdc5b552643e3fdfc737f342 -r29fd864ddfe9ed46b56befbfdb21e46913b2043e --- standard/project/web/src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml (.../egov-com-servlet.xml) (revision 95f20c1e1742229ebdc5b552643e3fdfc737f342) +++ standard/project/web/src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml (.../egov-com-servlet.xml) (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -14,7 +14,8 @@ - + + /WEB-INF/jsp/ Index: standard/project/web/src/main/webapp/WEB-INF/jsp/egovframework/com/ext/jstree/springHibernateVersion.jsp =================================================================== diff -u -r846271eb6b8794fc8fd865300fe360771687f811 -r29fd864ddfe9ed46b56befbfdb21e46913b2043e --- standard/project/web/src/main/webapp/WEB-INF/jsp/egovframework/com/ext/jstree/springHibernateVersion.jsp (.../springHibernateVersion.jsp) (revision 846271eb6b8794fc8fd865300fe360771687f811) +++ standard/project/web/src/main/webapp/WEB-INF/jsp/egovframework/com/ext/jstree/springHibernateVersion.jsp (.../springHibernateVersion.jsp) (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e) @@ -332,7 +332,7 @@ $.ajax({ async: false, type: 'GET', - url: "/com/ext/jstree/springmyBatis/core/csrf.do", + url: "/com/ext/jstree/springHibernate/core/csrf.do", success: function(r) { var token = r._csrf_token; var header = r._csrf_headerName;