Package org.libreplan.business.common.exceptions

Examples of org.libreplan.business.common.exceptions.InstanceNotFoundException


    @Override
    @Transactional(readOnly = true)
    public CalendarExceptionType findUniqueByName(String name) throws InstanceNotFoundException {
        if (StringUtils.isBlank(name)) {
            throw new InstanceNotFoundException(null, CalendarExceptionType.class.getName());
        }

        CalendarExceptionType calendarExceptionType = (CalendarExceptionType) getSession().createCriteria(
                CalendarExceptionType.class).add(
                Restrictions.eq("name", name.trim()).ignoreCase())
                .uniqueResult();

        if (calendarExceptionType == null) {
            throw new InstanceNotFoundException(name, CalendarExceptionType.class.getName());
        } else {
            return calendarExceptionType;
        }

    }
View Full Code Here


    @Override
    @Transactional(readOnly = true)
    public Order findByCode(String code) throws InstanceNotFoundException {

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(null, getEntityClass()
                    .getName());
        }

        Order entity = (Order) getSession().createCriteria(getEntityClass())
                .add(
                        Restrictions.eq("infoComponent.code", code.trim())
                                .ignoreCase()).uniqueResult();

        if (entity == null) {
            throw new InstanceNotFoundException(code, getEntityClass()
                    .getName());
        } else {
            return entity;
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    private Order findByName(String name) throws InstanceNotFoundException {

        if (StringUtils.isBlank(name)) {
            throw new InstanceNotFoundException(null,
                getEntityClass().getName());
        }

        Order order = (Order) getSession().createCriteria(getEntityClass())
                .add(Restrictions.eq("infoComponent.name", name).ignoreCase())
                .uniqueResult();

        if (order == null) {
            throw new InstanceNotFoundException(
                name, getEntityClass().getName());
        } else {
            return order;
        }
View Full Code Here

        Criteria c = getSession().createCriteria(AdvanceType.class);
        c.add(Restrictions.ilike("unitName", name, MatchMode.EXACT));
        AdvanceType result = (AdvanceType) c.uniqueResult();

        if (result == null) {
            throw new InstanceNotFoundException(name,
                    getEntityClass().getName());
        }

        return result;
    }
View Full Code Here

            if (c.getName().equalsIgnoreCase(criterionName)) {
                return c;
            }
        }

        throw new InstanceNotFoundException(criterionName,
            Criterion.class.getName());

    }
View Full Code Here

    public Criterion getCriterionByCode(String code)
        throws InstanceNotFoundException {

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(code,
                 Criterion.class.getName());
        }

        for (Criterion c : criterions) {
            if (c.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return c;
            }
        }

        throw new InstanceNotFoundException(code,
            Criterion.class.getName());

    }
View Full Code Here

    public CalendarException getCalendarExceptionByCode(String code)
            throws InstanceNotFoundException {

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(code, CalendarException.class
                    .getName());
        }

        for (CalendarException e : this.exceptions) {
            if (e.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return e;
            }
        }

        throw new InstanceNotFoundException(code, CalendarException.class
                .getName());

    }
View Full Code Here

    public CalendarData getCalendarDataByCode(String code)
            throws InstanceNotFoundException {

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(code, CalendarData.class
                    .getName());
        }

        for (CalendarData e : this.calendarDataVersions) {
            if (e.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return e;
            }
        }

        throw new InstanceNotFoundException(code, CalendarData.class.getName());

    }
View Full Code Here

        Criteria c = getSession().createCriteria(User.class);
        c.add(Restrictions.eq("loginName", loginName).ignoreCase());
        User user = (User) c.uniqueResult();

        if (user == null) {
            throw new InstanceNotFoundException(loginName,
                User.class.getName());
        } else {
            return user;
        }
View Full Code Here

        c.add(Restrictions.eq("loginName", loginName).ignoreCase());
        c.add(Restrictions.eq("disabled", false));
        User user = (User) c.uniqueResult();

        if (user == null) {
            throw new InstanceNotFoundException(loginName,
                User.class.getName());
        } else {
            return user;
        }
View Full Code Here

TOP

Related Classes of org.libreplan.business.common.exceptions.InstanceNotFoundException

Copyright © 2018 www.massapicom. 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.