Package org.libreplan.business.common.exceptions

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


    }

    @Override
    public UnitType findByName(String measure) throws InstanceNotFoundException {
        if (StringUtils.isBlank(measure)) {
            throw new InstanceNotFoundException(null, getEntityClass()
                    .getName());
        }

        UnitType unitType = (UnitType) getSession().createCriteria(
                UnitType.class).add(
                Restrictions.eq("measure", measure)).uniqueResult();

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


        Criteria c = getSession().createCriteria(UnitType.class);
        c.add(Restrictions.ilike("measure", measure, MatchMode.EXACT));
        UnitType result = (UnitType) c.uniqueResult();

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

        return result;
    }
View Full Code Here

        Criteria c = getSession().createCriteria(QualityForm.class);
        c.add(Restrictions.eq("name", name));
        QualityForm qualityForm = (QualityForm) c.uniqueResult();

        if (qualityForm == null) {
            throw new InstanceNotFoundException(null, "QualityForm");
        }
        return qualityForm;
    }
View Full Code Here

    @Override
    public CriterionType findUniqueByName(String name)
            throws InstanceNotFoundException {
        CriterionType result = findByName(name);
        if (result == null) {
              throw new InstanceNotFoundException(name,
                  CriterionType.class.getName());
          }
        return result;
    }
View Full Code Here

    public E find(PK id) throws InstanceNotFoundException {

        E entity = (E) getSession().get(entityClass, id);

        if (entity == null) {
            throw new InstanceNotFoundException(id, entityClass.getName());
        }

        return entity;
    }
View Full Code Here

        } catch (HibernateException e) {
            result = (HoursGroup) c.list().get(0);
        }

        if (result == null) {
            throw new InstanceNotFoundException(hoursGroup.getCode(),
                    HoursGroup.class.getName());
        } else {
            return result;
        }
    }
View Full Code Here

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

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

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

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

                .createCriteria(
                EntitySequence.class).add(
                Restrictions.eq("entityName", entityName)).add(
                Restrictions.eq("active", true)).uniqueResult();
        if (entitySequence == null) {
            throw new InstanceNotFoundException(entitySequence,
                    "Entity sequence not exist");
        }
        return entitySequence;
    }
View Full Code Here

        Criteria c = getSession().createCriteria(TypeOfWorkHours.class);
        c.add(Restrictions.eq("code", code));

        TypeOfWorkHours found = (TypeOfWorkHours) c.uniqueResult();
        if (found == null) {
            throw new InstanceNotFoundException(code, TypeOfWorkHours.class.getName());
        }
        return found;
    }
View Full Code Here

        Criteria c = getSession().createCriteria(TypeOfWorkHours.class);
        c.add(Restrictions.eq("name", name.trim()).ignoreCase());

        TypeOfWorkHours found = (TypeOfWorkHours) c.uniqueResult();
        if (found == null) {
            throw new InstanceNotFoundException(name, TypeOfWorkHours.class
                    .getName());
        }
        return found;
    }
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.