Examples of GlobalException


Examples of com.architecture.core.common.i18n.except.GlobalException

    private BaseService service;


    public User login(String username, String password) throws GlobalException {
        if (StringUtils.isEmpty(username)) {
            throw new GlobalException(Err.INVALID_USERNAME);
        }

        if(StringUtils.isEmpty(password)) {
            throw new GlobalException(Err.INVALID_PASSWORD);
        }

        String queryUser = ConfigHandler.getString(Conf.RUNTIME_DB_QL_QUERY_USER);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(KEY_USERNAME, username);
        map.put(KEY_PASSWORD, password);
        User user = (User) service.queryUnique(queryUser,map);

        if (null == user) {
            throw new GlobalException(Err.USERNAME_OR_PASSWORD_ERROR);
        }else{
            return user;
        }

    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

    @javax.annotation.Resource
    private BaseDAO baseDAO;

    public E queryUnique(String queryQL) throws GlobalException {
        if (StringUtils.isBlank(queryQL)) {
            throw new GlobalException(Err.INVALID_STRING);
        }
        return (E) this.baseDAO.queryUnique(queryQL);

    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

    }

    public E queryUnique(String queryQL,Map<String,Object> valMap) throws GlobalException {
        if (StringUtils.isBlank(queryQL)) {
            throw new GlobalException(Err.INVALID_STRING);
        }

        if (CollectionUtils.isEmpty(valMap)) {
            throw new GlobalException((Err.INVALID_COLLECT));
        }

        return (E) this.baseDAO.queryUnique(queryQL, valMap);

    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

     * @return
     * @throws GlobalException
     */
    public E query(Class c, String id) throws GlobalException {
        if (null == c) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(id)) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            return (E) this.baseDAO.queryValidUnique(c, id);
        } catch (Exception ex) {
            throw new GlobalException(Err.QUERY_FAILED);
        }
    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

    }

    public void create(E entity) throws GlobalException {

        if (null == entity) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(entity.getId())) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            this.baseDAO.create(entity);
        } catch (Exception ex) {
            throw new GlobalException(Err.CREATE_FAILED);
        }
    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

    }

    public void del(E entity) throws GlobalException {

        if (null == entity) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(entity.getId())) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            this.baseDAO.del(entity);
        } catch (Exception ex) {
            throw new GlobalException(Err.DEL_FAILED);
        }

    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

     * @throws GlobalException
     */
    public void del(Class c, String id) throws GlobalException {

        if (null == c) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(id)) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            this.baseDAO.del(c, id);
        } catch (Exception ex) {
            throw new GlobalException(Err.DEL_FAILED);
        }
    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

     * @param entity
     * @throws GlobalException
     */
    public void update(E entity) throws GlobalException {
        if (null == entity) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(entity.getId())) {
            throw new GlobalException(Err.INVALID_ID);
        }
        try {
            this.update(entity);
        } catch (Exception ex) {
            throw new GlobalException(Err.UPDATE_FAILED);
        }
    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

     *
     * @param entity
     */
    public void refresh(E entity) throws GlobalException {
        if (null == entity) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(entity.getId())) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            this.baseDAO.refresh(entity);
        } catch (Exception ex) {
            throw new GlobalException(Err.FRESH_FAILED);
        }
    }
View Full Code Here

Examples of com.architecture.core.common.i18n.except.GlobalException

     * @param c
     * @param id
     */
    public void refresh(Class c,String id) throws GlobalException {
        if (null == c) {
            throw new GlobalException(Err.INVALID_OBJECT);
        }

        if (StringUtils.isBlank(id)) {
            throw new GlobalException(Err.INVALID_ID);
        }

        try {
            this.baseDAO.refresh(c,id);
        } catch (Exception ex) {
            throw new GlobalException(Err.FRESH_FAILED);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.