Package org.libreplan.business.common.exceptions

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


    public Label getLabelByType(LabelType type)
            throws InstanceNotFoundException {

        if (type == null) {
            throw new InstanceNotFoundException(type, LabelType.class.getName());
        }

        for (Label l : this.labels) {
            if (l.getType().getId().equals(type.getId())) {
                return l;
            }
        }

        throw new InstanceNotFoundException(type, LabelType.class.getName());
    }
View Full Code Here


            if (each.getId().equals(id)) {
                unit = each;
            }
        }
        if (unit == null) {
            throw new InstanceNotFoundException(id, MachineModel.class
                    .getName());
        }
        return unit;
    }
View Full Code Here

    public Material getMaterialByCode(String code)
            throws InstanceNotFoundException {

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

        for (Material m : this.materials) {
            if (m.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return m;
            }
        }

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

    }
View Full Code Here

    public MaterialCategory getSubcategoryByCode(String code)
            throws InstanceNotFoundException {

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

        for (MaterialCategory s : this.subcategories) {
            if (s.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return s;
            }
        }

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

    }
View Full Code Here

    public DescriptionValue getDescriptionValueByFieldName(String fieldName)
            throws InstanceNotFoundException {

        if (StringUtils.isBlank(fieldName)) {
            throw new InstanceNotFoundException(fieldName,
                    DescriptionValue.class.getName());
        }

        for (DescriptionValue v : this.descriptionValues) {
            if (v.getFieldName().equalsIgnoreCase(StringUtils.trim(fieldName))) {
                return v;
            }
        }

        throw new InstanceNotFoundException(fieldName, DescriptionValue.class
                .getName());
    }
View Full Code Here

    @Transactional(readOnly = true)
    public MaterialCategory findUniqueByName(String name)
            throws InstanceNotFoundException {

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

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

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

            if (l.getType().getId().equals(type.getId())) {
                return l;
            }
        }

        throw new InstanceNotFoundException(type, LabelType.class.getName());
    }
View Full Code Here

    public WorkReportLine getWorkReportLineByCode(String code)
            throws InstanceNotFoundException {

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

        for (WorkReportLine l : this.workReportLines) {
            if (l.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
                return l;
            }
        }

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

    }
View Full Code Here

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

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

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

        if (workReportType == null) {
            throw new InstanceNotFoundException(null, "WorkReportType");
        }
        return workReportType;
    }
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.