From 31f24a5808052c0a6f698cdf7f0bd08afa1e59b8 Mon Sep 17 00:00:00 2001
From: lishengzhao <shengzhao@honyee.cc>
Date: Thu, 20 Mar 2014 11:48:24 +0800
Subject: [PATCH] Change to wdcy

---
 .../shared/security/SecurityHolder.java       |   2 +-
 .../domain/shared/security/SecurityUtils.java |   2 +-
 ...eUserDetails.java => WdcyUserDetails.java} |  17 +--
 src/main/java/cc/wdcy/domain/user/User.java   |   7 --
 .../cc/wdcy/infrastructure/DateUtils.java     | 109 -----------------
 .../infrastructure/DimensionalCodeHelper.java |  59 ----------
 .../cc/wdcy/infrastructure/MatchUtils.java    |  47 --------
 .../wdcy/infrastructure/PasswordHandler.java  |  45 -------
 .../cc/wdcy/service/impl/UserServiceImpl.java |   4 +-
 .../web/context/SpringSecurityHolder.java     |   8 +-
 .../wdcy/web/controller/UserController.java   |   3 -
 .../web/validator/UserFormDtoValidator.java   |  80 -------------
 src/main/resources/displaytag.properties      | 111 ------------------
 src/main/resources/mail.properties            |  22 ----
 src/main/resources/spring/context.xml         |   7 +-
 src/main/resources/spring/infrastructure.xml  |  22 ----
 .../template/job_default_content.html         |  21 ----
 .../webapp/WEB-INF/jsp/decorators/main.jsp    |   6 +-
 src/test/java/cc/wdcy/ContextTest.java        |   4 +-
 .../cc/wdcy/infrastructure/DateUtilsTest.java |  66 -----------
 .../DimensionalCodeHelperTest.java            |  79 -------------
 .../java/cc/wdcy/infrastructure/GuidTest.java |  31 -----
 .../java/cc/wdcy/infrastructure/MD5Test.java  |  30 -----
 .../wdcy/infrastructure/MatchUtilsTest.java   |  35 ------
 src/test/resources/dim-code.png               | Bin 345 -> 0 bytes
 .../{database.properties => test.properties}  |   0
 src/test/resources/testApplicationContext.xml |  17 +--
 27 files changed, 20 insertions(+), 814 deletions(-)
 rename src/main/java/cc/wdcy/domain/shared/security/{HonyeeUserDetails.java => WdcyUserDetails.java} (76%)
 delete mode 100644 src/main/java/cc/wdcy/infrastructure/DimensionalCodeHelper.java
 delete mode 100644 src/main/java/cc/wdcy/infrastructure/MatchUtils.java
 delete mode 100644 src/main/java/cc/wdcy/web/validator/UserFormDtoValidator.java
 delete mode 100644 src/main/resources/displaytag.properties
 delete mode 100644 src/main/resources/mail.properties
 delete mode 100644 src/main/resources/spring/infrastructure.xml
 delete mode 100644 src/main/resources/template/job_default_content.html
 delete mode 100644 src/test/java/cc/wdcy/infrastructure/DateUtilsTest.java
 delete mode 100644 src/test/java/cc/wdcy/infrastructure/DimensionalCodeHelperTest.java
 delete mode 100644 src/test/java/cc/wdcy/infrastructure/GuidTest.java
 delete mode 100644 src/test/java/cc/wdcy/infrastructure/MD5Test.java
 delete mode 100644 src/test/java/cc/wdcy/infrastructure/MatchUtilsTest.java
 delete mode 100644 src/test/resources/dim-code.png
 rename src/test/resources/{database.properties => test.properties} (100%)

diff --git a/src/main/java/cc/wdcy/domain/shared/security/SecurityHolder.java b/src/main/java/cc/wdcy/domain/shared/security/SecurityHolder.java
index a513ef0..c4127c3 100644
--- a/src/main/java/cc/wdcy/domain/shared/security/SecurityHolder.java
+++ b/src/main/java/cc/wdcy/domain/shared/security/SecurityHolder.java
@@ -17,6 +17,6 @@ package cc.wdcy.domain.shared.security;
 
 public interface SecurityHolder {
 
-    HonyeeUserDetails userDetails();
+    WdcyUserDetails userDetails();
 
 }
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/domain/shared/security/SecurityUtils.java b/src/main/java/cc/wdcy/domain/shared/security/SecurityUtils.java
index 940145c..c96dc6e 100644
--- a/src/main/java/cc/wdcy/domain/shared/security/SecurityUtils.java
+++ b/src/main/java/cc/wdcy/domain/shared/security/SecurityUtils.java
@@ -25,7 +25,7 @@ public class SecurityUtils {
     }
 
     public static User currentUser() {
-        HonyeeUserDetails userDetails = securityHolder.userDetails();
+        WdcyUserDetails userDetails = securityHolder.userDetails();
         return (userDetails != null ? userDetails.user() : null);
     }
 }
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/domain/shared/security/HonyeeUserDetails.java b/src/main/java/cc/wdcy/domain/shared/security/WdcyUserDetails.java
similarity index 76%
rename from src/main/java/cc/wdcy/domain/shared/security/HonyeeUserDetails.java
rename to src/main/java/cc/wdcy/domain/shared/security/WdcyUserDetails.java
index f7a4161..ac5a154 100644
--- a/src/main/java/cc/wdcy/domain/shared/security/HonyeeUserDetails.java
+++ b/src/main/java/cc/wdcy/domain/shared/security/WdcyUserDetails.java
@@ -11,7 +11,6 @@
  */
 package cc.wdcy.domain.shared.security;
 
-import cc.wdcy.infrastructure.DateUtils;
 import cc.wdcy.domain.user.User;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
@@ -23,27 +22,23 @@ import java.util.Collection;
 /**
  * @author Shengzhao Li
  */
-public class HonyeeUserDetails implements UserDetails {
+public class WdcyUserDetails implements UserDetails {
 
     protected static final String ROLE_PREFIX = "ROLE_";
     protected static final GrantedAuthority DEFAULT_USER_ROLE = new SimpleGrantedAuthority(ROLE_PREFIX + "USER");
-    protected static final GrantedAuthority ADMIN_USER_ROLE = new SimpleGrantedAuthority(ROLE_PREFIX + "ADMIN");
 
     protected User user;
 
 
-    public HonyeeUserDetails() {
+    public WdcyUserDetails() {
     }
 
-    public HonyeeUserDetails(User user) {
+    public WdcyUserDetails(User user) {
         this.user = user;
     }
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
-//        if (user.defaultUser()) {
-//            return Arrays.asList(ADMIN_USER_ROLE, DEFAULT_USER_ROLE);
-//        }
         return Arrays.asList(DEFAULT_USER_ROLE, new SimpleGrantedAuthority(ROLE_PREFIX + "UNITY"), new SimpleGrantedAuthority(ROLE_PREFIX + "MOBILE"));
     }
 
@@ -81,12 +76,6 @@ public class HonyeeUserDetails implements UserDetails {
         return user;
     }
 
-    public String getLastLoginTime() {
-        if (user != null && user.lastLoginTime() != null) {
-            return DateUtils.toDateText(user.lastLoginTime(), DateUtils.DEFAULT_DATE_TIME_FORMAT);
-        }
-        return "---";
-    }
 
     @Override
     public String toString() {
diff --git a/src/main/java/cc/wdcy/domain/user/User.java b/src/main/java/cc/wdcy/domain/user/User.java
index 608b8ee..d5d7ac9 100644
--- a/src/main/java/cc/wdcy/domain/user/User.java
+++ b/src/main/java/cc/wdcy/domain/user/User.java
@@ -13,7 +13,6 @@ package cc.wdcy.domain.user;
 
 import cc.wdcy.domain.AbstractDomain;
 import cc.wdcy.domain.shared.BeanProvider;
-import cc.wdcy.infrastructure.PasswordHandler;
 
 import java.util.Date;
 
@@ -101,12 +100,6 @@ public class User extends AbstractDomain {
         return this;
     }
 
-    public String resetPassword() {
-        String newOriginalPass = PasswordHandler.randomPassword();
-        this.password = PasswordHandler.encryptPassword(newOriginalPass);
-        this.saveOrUpdate();
-        return newOriginalPass;
-    }
 
 
     public Date lastLoginTime() {
diff --git a/src/main/java/cc/wdcy/infrastructure/DateUtils.java b/src/main/java/cc/wdcy/infrastructure/DateUtils.java
index d591eac..9ab03c2 100644
--- a/src/main/java/cc/wdcy/infrastructure/DateUtils.java
+++ b/src/main/java/cc/wdcy/infrastructure/DateUtils.java
@@ -11,11 +11,6 @@
  */
 package cc.wdcy.infrastructure;
 
-import org.apache.commons.lang.StringUtils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
 import java.util.Date;
 
 /**
@@ -23,113 +18,9 @@ import java.util.Date;
  */
 public abstract class DateUtils {
 
-    /**
-     * Default time format :  yyyy-MM-dd HH:mm:ss
-     */
-    public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
-
-    /**
-     * Time format :  yyyy-MM-dd HH:mm
-     */
-    public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm";
-    public static final String TIME_FORMAT = "HH:mm";
-
-    /**
-     * Default date format
-     */
-    public static final String DATE_FORMAT = "yyyy-MM-dd";
-    /**
-     * Default month format
-     */
-    public static final String MONTH_FORMAT = "yyyy-MM";
-    /**
-     * Default day format
-     */
-    public static final String DAY_FORMAT = "dd";
-
-    public static final long DAY_MILLISECONDS = (1000l * 60 * 60 * 24);
-
-    //Date pattern,  demo:  2013-09-11
-    public static final String DATE_PATTERN = "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$";
-
-
-    public static boolean isDate(String dateAsText) {
-        return StringUtils.isNotEmpty(dateAsText) && dateAsText.matches(DATE_PATTERN);
-    }
 
     public static Date now() {
         return new Date();
     }
 
-    public static String toDateText(Date date) {
-        return toDateText(date, DATE_FORMAT);
-    }
-
-    public static String toDateText(Date date, String pattern) {
-        if (date == null || pattern == null) {
-            return null;
-        }
-        SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
-        return dateFormat.format(date);
-    }
-
-    public static Date getDate(String dateText) {
-        return getDate(dateText, DATE_FORMAT);
-    }
-
-
-    public static Date getDate(String dateText, String pattern) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
-        try {
-            return dateFormat.parse(dateText);
-        } catch (ParseException e) {
-            throw new IllegalStateException("Parse date from [" + dateText + "," + pattern + "] failed", e);
-        }
-    }
-
-    public static String toDateTime(Date date) {
-        return toDateText(date, DATE_TIME_FORMAT);
-    }
-
-
-    /**
-     * Return current year.
-     *
-     * @return Current year
-     */
-    public static int currentYear() {
-        return calendar().get(Calendar.YEAR);
-    }
-
-    public static Calendar calendar() {
-        return Calendar.getInstance();
-    }
-
-    public static boolean isToday(Date date) {
-        if (date == null) {
-            return false;
-        }
-        String dateAsText = toDateText(date);
-        String todayAsText = toDateText(now());
-        return dateAsText.equals(todayAsText);
-    }
-
-    /**
-     * Get tow dates period as days,
-     * return -1 if the start or end is null
-     *
-     * @param start Start date
-     * @param end   End date
-     * @return Period as days or -1
-     */
-    public static long periodAsDays(Date start, Date end) {
-        if (start == null || end == null) {
-            return -1;
-        }
-        start = org.apache.commons.lang.time.DateUtils.truncate(start, Calendar.DAY_OF_MONTH);
-        end = org.apache.commons.lang.time.DateUtils.truncate(end, Calendar.DAY_OF_MONTH);
-
-        long periodAsMilliSeconds = end.getTime() - start.getTime();
-        return (periodAsMilliSeconds / (DAY_MILLISECONDS));
-    }
 }
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/infrastructure/DimensionalCodeHelper.java b/src/main/java/cc/wdcy/infrastructure/DimensionalCodeHelper.java
deleted file mode 100644
index 517ff10..0000000
--- a/src/main/java/cc/wdcy/infrastructure/DimensionalCodeHelper.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import com.google.zxing.BarcodeFormat;
-import com.google.zxing.EncodeHintType;
-import com.google.zxing.WriterException;
-import com.google.zxing.client.j2se.MatrixToImageWriter;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.qrcode.QRCodeWriter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Shengzhao Li
- */
-public abstract class DimensionalCodeHelper {
-
-
-    //Default size:  200 * 200
-    public static byte[] encode(String content) {
-        return encode(content, 200, 200);
-    }
-
-
-    public static byte[] encode(String content, int width, int height) {
-        Map<EncodeHintType, Object> hints = new HashMap<>();
-        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
-
-        QRCodeWriter qrCodeWriter = new QRCodeWriter();
-        BitMatrix matrix;
-        try {
-            matrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
-        } catch (WriterException e) {
-            throw new IllegalStateException(e);
-        }
-
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
-        try {
-            MatrixToImageWriter.writeToStream(matrix, "png", os);
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-        return os.toByteArray();
-    }
-
-}
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/infrastructure/MatchUtils.java b/src/main/java/cc/wdcy/infrastructure/MatchUtils.java
deleted file mode 100644
index 3b43a58..0000000
--- a/src/main/java/cc/wdcy/infrastructure/MatchUtils.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- * @author Shengzhao Li
- */
-public abstract class MatchUtils {
-
-    /**
-     * BigDecimal regex.
-     */
-    public static final String BIG_DECIMAL_REGEX = "^(\\d+)||(\\d+\\.\\d+)$";
-
-    /**
-     * Positive Number regex.
-     */
-    public static final String POSITIVE_NUMBER_REGEX = "^\\d+$";
-
-    /**
-     * Email regex.
-     */
-    public static final String EMAIL_REGEX = ".+@.+\\.[a-z]+";
-
-    public static boolean isBigDecimal(String text) {
-        return StringUtils.isNotEmpty(text) && text.matches(BIG_DECIMAL_REGEX);
-    }
-
-    public static boolean isEmail(String email) {
-        return StringUtils.isNotEmpty(email) && email.matches(EMAIL_REGEX);
-    }
-
-    public static boolean isPositiveNumber(String numberText) {
-        return StringUtils.isNotEmpty(numberText) && numberText.matches(POSITIVE_NUMBER_REGEX);
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/infrastructure/PasswordHandler.java b/src/main/java/cc/wdcy/infrastructure/PasswordHandler.java
index 917d501..f949c84 100644
--- a/src/main/java/cc/wdcy/infrastructure/PasswordHandler.java
+++ b/src/main/java/cc/wdcy/infrastructure/PasswordHandler.java
@@ -11,9 +11,7 @@
  */
 package cc.wdcy.infrastructure;
 
-import cc.wdcy.domain.shared.GuidGenerator;
 import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
-import org.springframework.util.StringUtils;
 
 /**
  * @author Shengzhao Li
@@ -21,25 +19,8 @@ import org.springframework.util.StringUtils;
 public abstract class PasswordHandler {
 
 
-    /**
-     * Encrypt factor, use it for  reversible  password
-     */
-    private static final int ENCRYPT_FACTOR = 7;
-
-    /**
-     * Return a random password from {@link java.util.UUID},
-     * the length is 8.
-     *
-     * @return Random password
-     */
-    public static String randomPassword() {
-        String uuid = GuidGenerator.generate();
-        return uuid.substring(0, 8);
-    }
-
     /**
      * Encrypt  password ,if original password is empty,
-     * will call {@link #randomPassword()}  get a random original password.
      *
      * @param originalPassword Original password
      * @return Encrypted password
@@ -49,31 +30,5 @@ public abstract class PasswordHandler {
         return md5PasswordEncoder.encodePassword(originalPassword, null);
     }
 
-    /**
-     * Encrypt the reversible password
-     *
-     * @param originalPassword originalPassword
-     * @return encrypted password
-     */
-    public static String encryptReversiblePassword(String originalPassword) {
-        if (!StringUtils.hasText(originalPassword)) {
-            return originalPassword;
-        }
-        byte[] bytes = originalPassword.getBytes();
-        for (int i = 0; i < bytes.length; i++) {
-            byte b = bytes[i];
-            bytes[i] = (byte) (b ^ ENCRYPT_FACTOR);
-        }
-        return new String(bytes);
-    }
 
-    /**
-     * Decrypt the encrypted password.
-     *
-     * @param encryptedPassword encryptedPassword
-     * @return decrypted password
-     */
-    public static String decryptReversiblePassword(String encryptedPassword) {
-        return encryptReversiblePassword(encryptedPassword);
-    }
 }
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/service/impl/UserServiceImpl.java b/src/main/java/cc/wdcy/service/impl/UserServiceImpl.java
index 66274ff..f03be8b 100644
--- a/src/main/java/cc/wdcy/service/impl/UserServiceImpl.java
+++ b/src/main/java/cc/wdcy/service/impl/UserServiceImpl.java
@@ -11,7 +11,7 @@
  */
 package cc.wdcy.service.impl;
 
-import cc.wdcy.domain.shared.security.HonyeeUserDetails;
+import cc.wdcy.domain.shared.security.WdcyUserDetails;
 import cc.wdcy.domain.user.User;
 import cc.wdcy.domain.user.UserRepository;
 import cc.wdcy.service.UserService;
@@ -36,6 +36,6 @@ public class UserServiceImpl implements UserService {
             throw new UsernameNotFoundException("Not found any user for username[" + username + "]");
         }
 
-        return new HonyeeUserDetails(user);
+        return new WdcyUserDetails(user);
     }
 }
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/web/context/SpringSecurityHolder.java b/src/main/java/cc/wdcy/web/context/SpringSecurityHolder.java
index 6b1814c..fa47f6b 100644
--- a/src/main/java/cc/wdcy/web/context/SpringSecurityHolder.java
+++ b/src/main/java/cc/wdcy/web/context/SpringSecurityHolder.java
@@ -11,7 +11,7 @@
  */
 package cc.wdcy.web.context;
 
-import cc.wdcy.domain.shared.security.HonyeeUserDetails;
+import cc.wdcy.domain.shared.security.WdcyUserDetails;
 import cc.wdcy.domain.shared.security.SecurityHolder;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -22,14 +22,14 @@ import org.springframework.security.core.context.SecurityContextHolder;
 public class SpringSecurityHolder implements SecurityHolder {
 
     @Override
-    public HonyeeUserDetails userDetails() {
+    public WdcyUserDetails userDetails() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
         if (authentication == null) {
             return null;
         }
         Object principal = authentication.getPrincipal();
-        if (principal instanceof HonyeeUserDetails) {
-            return (HonyeeUserDetails) principal;
+        if (principal instanceof WdcyUserDetails) {
+            return (WdcyUserDetails) principal;
         }
         return null;
     }
diff --git a/src/main/java/cc/wdcy/web/controller/UserController.java b/src/main/java/cc/wdcy/web/controller/UserController.java
index fd94d3c..706dc07 100644
--- a/src/main/java/cc/wdcy/web/controller/UserController.java
+++ b/src/main/java/cc/wdcy/web/controller/UserController.java
@@ -12,7 +12,6 @@
 package cc.wdcy.web.controller;
 
 import cc.wdcy.service.UserService;
-import cc.wdcy.web.validator.UserFormDtoValidator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -28,8 +27,6 @@ public class UserController {
 
     @Autowired
     private UserService userService;
-    @Autowired
-    private UserFormDtoValidator validator;
 
     @RequestMapping("overview.htm")
     public String overview(Model model) {
diff --git a/src/main/java/cc/wdcy/web/validator/UserFormDtoValidator.java b/src/main/java/cc/wdcy/web/validator/UserFormDtoValidator.java
deleted file mode 100644
index c79a91a..0000000
--- a/src/main/java/cc/wdcy/web/validator/UserFormDtoValidator.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.web.validator;
-
-import cc.wdcy.domain.dto.user.UserFormDto;
-import cc.wdcy.infrastructure.MatchUtils;
-import cc.wdcy.service.UserService;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.validation.Errors;
-import org.springframework.validation.Validator;
-
-/**
- * @author Shengzhao Li
- */
-@Component
-public class UserFormDtoValidator implements Validator {
-
-    @Autowired
-    private UserService userService;
-
-    @Override
-    public boolean supports(Class<?> aClass) {
-        return UserFormDto.class.equals(aClass);
-    }
-
-    @Override
-    public void validate(Object target, Errors errors) {
-        UserFormDto userFormDto = (UserFormDto) target;
-        validateUsername(userFormDto, errors);
-        validateEmail(userFormDto, errors);
-
-        if (userFormDto.isNewly()) {
-            validatePassword(userFormDto, errors);
-        }
-    }
-
-    private void validatePassword(UserFormDto userFormDto, Errors errors) {
-        String password = userFormDto.getPassword();
-        if (password.length() < 6) {
-            errors.rejectValue("password", null, "用户密码至少6位");
-            return;
-        }
-        if (!password.equals(userFormDto.getRePassword())) {
-            errors.rejectValue("rePassword", null, "两次输入的密码不相同");
-        }
-
-    }
-
-    private void validateEmail(UserFormDto userFormDto, Errors errors) {
-        String email = userFormDto.getEmail();
-        if (!MatchUtils.isEmail(email)) {
-            errors.rejectValue("email", null, "邮件地址格式错误");
-        }
-    }
-
-    private void validateUsername(UserFormDto userFormDto, Errors errors) {
-        String username = userFormDto.getUsername();
-        if (StringUtils.isEmpty(username)) {
-            errors.rejectValue("username", null, "用户名不能为空");
-            return;
-        }
-        if (!username.equals(userFormDto.getExistUsername())) {
-//            boolean exist = userService.loadExistUsername(username);
-//            if (exist) {
-//                errors.rejectValue("username", null, "该用户名已经存在");
-//            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/main/resources/displaytag.properties b/src/main/resources/displaytag.properties
deleted file mode 100644
index c2c6253..0000000
--- a/src/main/resources/displaytag.properties
+++ /dev/null
@@ -1,111 +0,0 @@
-basic.empty.showtable=true
-basic.show.header=true
-
-# page | list
-sort.amount=page
-
-export.amount=list
-export.decorated=true
-
-paging.banner.group_size=5
-paging.banner.placement=bottom
-
-
-css.tr.even=even
-css.tr.odd=odd
-css.th.sorted=sorted
-css.th.ascending=order1
-css.th.descending=order2
-css.table=
-css.th.sortable=sortable
-
-# factory classes for extensions
-factory.requestHelper=org.displaytag.util.DefaultRequestHelperFactory
-
-# factory class for decorators
-factory.decorator=org.displaytag.decorator.DefaultDecoratorFactory
-
-# locale provider (Jstl provider by default)
-locale.provider=org.displaytag.localization.I18nJstlAdapter
-
-# locale.resolver (nothing by default, simply use locale from request)
-#locale.resolver=
-
-export.types=csv excel xml pdf
-
-export.csv.class=org.displaytag.export.CsvView
-export.excel.class=org.displaytag.export.ExcelView
-export.xml.class=org.displaytag.export.XmlView
-export.pdf.class=org.displaytag.export.PdfView
-
-export.csv=true
-export.csv.label=<span class="export csv">CSV </span>
-export.csv.include_header=false
-export.csv.filename=
-
-export.excel=true
-export.excel.label=<span class="export excel">Excel </span>
-export.excel.include_header=true
-export.excel.filename=
-
-export.xml=true
-export.xml.label=<span class="export xml">XML </span>
-export.xml.filename=
-
-export.pdf=false
-export.pdf.label=<span class="export pdf">PDF </span>
-export.pdf.include_header=true
-export.pdf.filename=
-
-export.rtf=false
-export.rtf.label=<span class="export rtf">RTF </span>
-export.rtf.include_header=true
-export.rtf.filename=
-
-# messages
-
-basic.msg.empty_list=
-basic.msg.empty_list_row=<tr class="empty"><td colspan="{0}">&nbsp;</td></tr>
-error.msg.invalid_page=invalid page
-
-export.banner=<div class="exportlinks">\u5bfc\u51fa\u9009\u9879: {0}</div>
-export.banner.sepchar= |
-
-paging.banner.item_name=\u6761
-paging.banner.items_name=\u6761
-
-paging.banner.no_items_found=
-paging.banner.one_item_found=
-paging.banner.all_items_found=
-paging.banner.some_items_found=
-
-#paging.banner.full=<span class="pagelinks">[<a href="{1}">\u9996\u9875</a>/<a href="{2}">\u4e0a\u9875</a>] {0} [<a href="{3}">\u4e0b\u9875</a>/<a href="{4}">\u672b\u9875</a>]</span>
-#paging.banner.first=<span class="pagelinks">[\u9996\u9875/\u4e0a\u9875] {0} [<a href="{3}">\u4e0b\u9875</a>/<a href="{4}">\u672b\u9875</a>]</span>
-#paging.banner.last=<span class="pagelinks">[<a href="{1}">\u9996\u9875</a>/<a href="{2}">\u4e0a\u9875</a>] {0} [\u4e0b\u9875/\u672b\u9875]</span>
-#paging.banner.onepage=<span class="pagelinks">{0}</span>
-paging.banner.full=<div class="pager clearfix text-center"><ul><li><a href="{1}">&laquo;\u4e0a\u9875</a></li>{0}<li><a href="{4}">\u4e0b\u9875&raquo;</a></li></ul></div>
-paging.banner.first=<div class="pager clearfix text-center"><ul><li><a href="javascript:void(0);">&laquo;\u4e0a\u9875</a></li>{0}<li><a href="{4}">\u4e0b\u9875&raquo;</a></li></ul></div>
-paging.banner.last=<div class="pager clearfix text-center"><ul><li><a href="{1}">&laquo;\u4e0a\u9875</a></li>{0}<li><a href="javascript:void(0);">\u4e0b\u9875&raquo;</a></li></ul></div>
-paging.banner.onepage=<div class="pager clearfix text-center"><ul><li><a href="javascript:void(0);">&laquo;\u4e0a\u9875</a></li>{0}<li><a href="javascript:void(0);">\u4e0b\u9875&raquo;</a></li></ul></div>
-
-
-#paging.banner.page.selected=<strong>{0}</strong>
-#paging.banner.page.link=<a href="{1}">{0}</a>
-#paging.banner.page.separator=&nbsp;
-paging.banner.page.selected=<li class="active"><a href="javascript:void(0);">{0}</a></li>
-paging.banner.page.link=<li><a href="{1}">{0}</a></li>
-paging.banner.page.separator=
-
-
-# external sort and pagination
-pagination.sort.param=sort
-pagination.sortdirection.param=dir
-pagination.pagenumber.param=pageNumber
-pagination.searchid.param=searchid
-pagination.sort.asc.value=asc
-pagination.sort.desc.value=desc
-pagination.sort.skippagenumber=true
-
-# unused
-save.excel.banner=<a href="{0}" rel="external">\u4fdd\u5b58 ({1} \u5b57\u8282)</a>
-save.excel.filename=export.xls
\ No newline at end of file
diff --git a/src/main/resources/mail.properties b/src/main/resources/mail.properties
deleted file mode 100644
index 7656705..0000000
--- a/src/main/resources/mail.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#Email configure
-#mail host name
-host.name=smtp.exmail.qq.com
-#mail send port,default 25
-mail.smtp.port=25
-#mail use username
-mail.username=no-reply@honyee.cc
-#mail use password
-mail.password=honyee@2013
-#default mail address
-default.mail.address=no-reply@honyee.cc
- # auth
-mail.smtp.auth=true
-#  true is use new thread send mail, default false
-#If develop in production, change it to true
-mail.send.use.thread=false
-
-
-#Develop configuration
-#If develop in production, change it to false
-mail.develop.environment=true
-mail.develop.address=shengzhao@honyee.cc
\ No newline at end of file
diff --git a/src/main/resources/spring/context.xml b/src/main/resources/spring/context.xml
index 7365adc..d226e4a 100644
--- a/src/main/resources/spring/context.xml
+++ b/src/main/resources/spring/context.xml
@@ -17,7 +17,6 @@
         <property name="locations">
             <list>
                 <value>classpath:database.properties</value>
-                <value>classpath:mail.properties</value>
             </list>
         </property>
     </bean>
@@ -32,9 +31,9 @@
         <property name="validationQuery" value="SELECT 1"/>
         <property name="testOnReturn" value="false"/>
         <property name="testOnBorrow" value="true"/>
-        <!--Based on 1000 connected user -->
-        <property name="maxActive" value="200"/>
-        <property name="maxIdle" value="50"/>
+        <!--Based on 100 connected user -->
+        <property name="maxActive" value="20"/>
+        <property name="maxIdle" value="5"/>
     </bean>
 
     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
diff --git a/src/main/resources/spring/infrastructure.xml b/src/main/resources/spring/infrastructure.xml
deleted file mode 100644
index 7f2abf3..0000000
--- a/src/main/resources/spring/infrastructure.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-			http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-
-    <!--Mail configuration-->
-    <bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
-        <property name="host" value="${host.name}"/>
-        <property name="port" value="${mail.smtp.port}"/>
-        <property name="username" value="${mail.username}"/>
-        <property name="password" value="${mail.password}"/>
-        <property name="defaultEncoding" value="UTF-8"/>
-        <property name="javaMailProperties">
-            <props>
-                <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
-            </props>
-        </property>
-    </bean>
-
-</beans>
\ No newline at end of file
diff --git a/src/main/resources/template/job_default_content.html b/src/main/resources/template/job_default_content.html
deleted file mode 100644
index 9cd9e64..0000000
--- a/src/main/resources/template/job_default_content.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<p><strong>职位描述:</strong></p>
-
-<p>&nbsp;</p>
-
-<p>&nbsp;</p>
-
-<p><strong>岗位职责:</strong></p>
-
-<p>&nbsp;</p>
-
-<p>&nbsp;</p>
-
-<p>&nbsp;</p>
-
-<p><strong>联系方式:</strong></p>
-
-<p>&nbsp;</p>
-
-<p>&nbsp;</p>
-
-<p>&nbsp;</p>
diff --git a/src/main/webapp/WEB-INF/jsp/decorators/main.jsp b/src/main/webapp/WEB-INF/jsp/decorators/main.jsp
index ba8a025..8d73fcc 100644
--- a/src/main/webapp/WEB-INF/jsp/decorators/main.jsp
+++ b/src/main/webapp/WEB-INF/jsp/decorators/main.jsp
@@ -25,9 +25,9 @@
 
     <meta name="viewport" content="width=device-width,user-scalable=no"/>
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-    <meta name="keywords" content="honyee.cc"/>
-    <meta name="description" content="honyee.cc"/>
-    <meta name="author" content="honyee.cc"/>
+    <meta name="keywords" content="wdcy.cc"/>
+    <meta name="description" content="wdcy.cc"/>
+    <meta name="author" content="wdcy.cc"/>
 
     <title><decorator:title default=""/> - Oauth</title>
     <decorator:head/>
diff --git a/src/test/java/cc/wdcy/ContextTest.java b/src/test/java/cc/wdcy/ContextTest.java
index e4ef7c3..d5563d2 100644
--- a/src/test/java/cc/wdcy/ContextTest.java
+++ b/src/test/java/cc/wdcy/ContextTest.java
@@ -12,7 +12,7 @@
 package cc.wdcy;
 
 import cc.wdcy.domain.shared.BeanProvider;
-import cc.wdcy.domain.shared.security.HonyeeUserDetails;
+import cc.wdcy.domain.shared.security.WdcyUserDetails;
 import cc.wdcy.domain.shared.security.SecurityUtils;
 import cc.wdcy.web.context.SpringSecurityHolder;
 import org.springframework.test.context.ContextConfiguration;
@@ -31,7 +31,7 @@ public abstract class ContextTest extends AbstractTransactionalTestNGSpringConte
         SecurityUtils securityUtils = new SecurityUtils();
         securityUtils.setSecurityHolder(new SpringSecurityHolder() {
             @Override
-            public HonyeeUserDetails userDetails() {
+            public WdcyUserDetails userDetails() {
                 return null;
             }
         });
diff --git a/src/test/java/cc/wdcy/infrastructure/DateUtilsTest.java b/src/test/java/cc/wdcy/infrastructure/DateUtilsTest.java
deleted file mode 100644
index 45d884b..0000000
--- a/src/test/java/cc/wdcy/infrastructure/DateUtilsTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import org.testng.annotations.Test;
-
-import java.util.Date;
-
-import static org.testng.Assert.*;
-
-/**
- * @author Shengzhao Li
- */
-public class DateUtilsTest {
-
-    @Test
-    public void isToday() throws Exception {
-        boolean today = DateUtils.isToday(DateUtils.now());
-        assertTrue(today);
-
-        today = DateUtils.isToday(DateUtils.getDate("2013-03-09"));
-        assertFalse(today);
-    }
-
-    @Test
-    public void isDate() throws Exception {
-        boolean isDate = DateUtils.isDate(null);
-        assertFalse(isDate);
-
-        isDate = DateUtils.isDate("2013-09-11");
-        assertTrue(isDate);
-
-        isDate = DateUtils.isDate("20130911");
-        assertFalse(isDate);
-    }
-
-    /**
-     * OOps!  what happened, waiting................
-     */
-    @Test(enabled = false)
-    public void periodAsDays() {
-        Date start = DateUtils.now();
-        Date end = DateUtils.now();
-
-        long days = DateUtils.periodAsDays(start, end);
-        System.out.println("Period: " + days);
-        assertEquals(days, 0);
-
-        start = DateUtils.getDate("2013-03-01 12:23:23", DateUtils.DEFAULT_DATE_TIME_FORMAT);
-        end = DateUtils.getDate("2013-03-11 16:00:11", DateUtils.DEFAULT_DATE_TIME_FORMAT);
-        System.out.println("Start [" + DateUtils.toDateTime(start) + "], End [" + DateUtils.toDateTime(end) + "]");
-
-        days = DateUtils.periodAsDays(start, end);
-        System.out.println("Period: " + days);
-        assertEquals(days, 10);
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/cc/wdcy/infrastructure/DimensionalCodeHelperTest.java b/src/test/java/cc/wdcy/infrastructure/DimensionalCodeHelperTest.java
deleted file mode 100644
index bdc4870..0000000
--- a/src/test/java/cc/wdcy/infrastructure/DimensionalCodeHelperTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import com.google.zxing.*;
-import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
-import com.google.zxing.client.j2se.MatrixToImageWriter;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.HybridBinarizer;
-import com.google.zxing.qrcode.QRCodeReader;
-import com.google.zxing.qrcode.QRCodeWriter;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.testng.annotations.Test;
-
-import javax.imageio.ImageIO;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.testng.Assert.assertNotNull;
-
-/**
- * @author Shengzhao Li
- */
-public class DimensionalCodeHelperTest {
-
-    @Test
-    public void encode() throws Exception {
-
-        File file = file();
-
-        Map<EncodeHintType, Object> hints = new HashMap<>();
-        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
-
-        QRCodeWriter qrCodeWriter = new QRCodeWriter();
-        BitMatrix encode = qrCodeWriter.encode("http://honyee.biz  宏义", BarcodeFormat.QR_CODE, 200, 200, hints);
-
-        assertNotNull(encode);
-        MatrixToImageWriter.writeToFile(encode, "png", file);
-
-    }
-
-    @Test
-    public void decode() throws Exception {
-
-        File file = file();
-
-        QRCodeReader qrCodeReader = new QRCodeReader();
-
-        Map<DecodeHintType, Object> hints = new HashMap<>();
-        hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
-
-        LuminanceSource source = new BufferedImageLuminanceSource(ImageIO.read(file));
-        Binarizer binarizer = new HybridBinarizer(source);
-        BinaryBitmap image = new BinaryBitmap(binarizer);
-
-        Result result = qrCodeReader.decode(image, hints);
-        String text = result.getText();
-        System.out.println(text);
-    }
-
-    private File file() throws IOException, URISyntaxException {
-        Resource resource = new ClassPathResource("dim-code.png");
-        return resource.getFile();
-    }
-
-}
\ No newline at end of file
diff --git a/src/test/java/cc/wdcy/infrastructure/GuidTest.java b/src/test/java/cc/wdcy/infrastructure/GuidTest.java
deleted file mode 100644
index d80c40d..0000000
--- a/src/test/java/cc/wdcy/infrastructure/GuidTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import cc.wdcy.domain.shared.GuidGenerator;
-import org.testng.annotations.Test;
-
-/**
- * @author Shengzhao Li
- */
-public class GuidTest {
-
-
-    @Test
-    public void guid() {
-        for (int i = 0; i < 5; i++) {
-            String generate = GuidGenerator.generate();
-            System.out.println(generate);
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/src/test/java/cc/wdcy/infrastructure/MD5Test.java b/src/test/java/cc/wdcy/infrastructure/MD5Test.java
deleted file mode 100644
index ceee74f..0000000
--- a/src/test/java/cc/wdcy/infrastructure/MD5Test.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
-import org.testng.annotations.Test;
-
-/**
- * @author Shengzhao Li
- */
-public class MD5Test {
-
-
-    @Test
-    public void encode() {
-        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
-        String encode = encoder.encodePassword("honyee2013", null);
-        System.out.println(encode);
-    }
-
-}
\ No newline at end of file
diff --git a/src/test/java/cc/wdcy/infrastructure/MatchUtilsTest.java b/src/test/java/cc/wdcy/infrastructure/MatchUtilsTest.java
deleted file mode 100644
index 48bb5ea..0000000
--- a/src/test/java/cc/wdcy/infrastructure/MatchUtilsTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013 Honyee Industry Group Co., Ltd
- * www.honyee.biz
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Honyee Industry Group Co., Ltd ("Confidential Information").
- * You shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement you
- * entered into with Honyee Industry Group Co., Ltd.
- */
-package cc.wdcy.infrastructure;
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-/**
- * @author Shengzhao Li
- */
-public class MatchUtilsTest {
-
-
-    @Test
-    public void isEmail() {
-
-        boolean result = MatchUtils.isEmail("addd");
-        assertFalse(result);
-
-        result = MatchUtils.isEmail("addd@honyee.cc");
-        assertTrue(result);
-    }
-
-}
\ No newline at end of file
diff --git a/src/test/resources/dim-code.png b/src/test/resources/dim-code.png
deleted file mode 100644
index 683af6e57a2772f3ab68c681d64cdf9b812d03a5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 345
zcmV-f0jB<mP)<h;3K|Lk000e1NJLTq0077U0077V00000g(H(Q0003XNkl<Zc-rll
zNfLx03`JqZF}NwhO*sZD(#a2&L)+U<7E)NHJQu$*YoK2%yyPW+CN=QNZSW4;kca4o
zG`>cje3JS$@;Y%sMu;QVkV#a_jYCqQ+97Gw<Fjg00&j~s<*n~Huq3A}kwkgUA0x6B
zj^k6^F(j;d!*NMec^}@kCt}6a5sc#PcBwALglk^e_lC#lhBSDW4LPBGUNhL1%%s9O
zcRQO_tm}pll7lN>2`e7S4Pg_)!)O<x`V@)Q1ZmOZy5ZHM8$#$~1!AkpcSMM^kHPIS
zs<<KA%}9i!{*7Covn2b}sqwfx?}cD`nn6b=ouqt`CMEDz`TP*BE=N!ELXOc%CEwz}
rl4zE2JudPQcAf(4$@~A{CHCY4dIHxFA}G^o00000NkvXXu0mjfKK-07

diff --git a/src/test/resources/database.properties b/src/test/resources/test.properties
similarity index 100%
rename from src/test/resources/database.properties
rename to src/test/resources/test.properties
diff --git a/src/test/resources/testApplicationContext.xml b/src/test/resources/testApplicationContext.xml
index 09ed0a6..9e8f3f6 100644
--- a/src/test/resources/testApplicationContext.xml
+++ b/src/test/resources/testApplicationContext.xml
@@ -8,8 +8,7 @@
     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="locations">
             <list>
-                <value>classpath:database.properties</value>
-                <!--<value>classpath:mail.properties</value>-->
+                <value>classpath:test.properties</value>
             </list>
         </property>
     </bean>
@@ -45,20 +44,6 @@
         <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
     </bean>
 
-    <!--Mail configuration-->
-    <!--<bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">-->
-    <!--<property name="host" value="${host.name}"/>-->
-    <!--<property name="port" value="${mail.smtp.port}"/>-->
-    <!--<property name="username" value="${mail.username}"/>-->
-    <!--<property name="password" value="${mail.password}"/>-->
-
-    <!--<property name="defaultEncoding" value="UTF-8"/>-->
-    <!--<property name="javaMailProperties">-->
-    <!--<props>-->
-    <!--<prop key="mail.smtp.auth">${mail.smtp.auth}</prop>-->
-    <!--</props>-->
-    <!--</property>-->
-    <!--</bean>-->
 
 
 </beans>
\ No newline at end of file