Package org.fao.geonet.repository

Examples of org.fao.geonet.repository.SchematronCriteriaRepository


        if (id != null && schematronId != null && groupName != null) {
            throw new IllegalArgumentException("Either one of " + Params.ID + " cannot be present if either "+ PARAM_GROUP_NAME + " or " + PARAM_SCHEMATRON_ID + " are also present.");
        }

        final SchematronCriteriaRepository criteriaRepository = context.getBean(SchematronCriteriaRepository.class);
        final Element element;

        if (id == null) {
            Specifications spec = null;
            if (schematronId != null) {
                spec = Specifications.where(SchematronCriteriaSpecs.hasSchematronId(Integer.parseInt(schematronId)));
            }

            if (groupName != null) {
                final Specification<SchematronCriteria> hasGroupSpec = SchematronCriteriaSpecs.hasGroupName(groupName);
                if (spec == null) {
                    spec = Specifications.where(hasGroupSpec);
                } else {
                    spec = spec.and(hasGroupSpec);
                }
            }
            element = criteriaRepository.findAllAsXml(spec);
        } else {
            final SchematronCriteria criteria = criteriaRepository.findOne(Integer.parseInt(id));

            if (criteria == null) {
                throw new BadParameterEx(Params.ID, id);
            }
            element = new Element(Jeeves.Elem.RESPONSE).addContent(criteria.asXml());
View Full Code Here


        final String value = Util.getParam(params, PARAM_VALUE, null);
        final String uiType = Util.getParam(params, PARAM_UI_TYPE, null);
        final String uiValue = Util.getParam(params, PARAM_UI_VALUE, null);


        final SchematronCriteriaRepository criteriaRepository = context.getBean(SchematronCriteriaRepository.class);
        criteriaRepository.update(id, new Updater<SchematronCriteria>() {
            @Override
            public void apply(@Nonnull SchematronCriteria entity) {
                if (type != null) {
                    entity.setType(SchematronCriteriaType.valueOf(type.toUpperCase()));
                }
View Full Code Here

    @Override
    protected Element delete(Element params, ServiceContext context) throws Exception {
        final Integer id = Integer.valueOf(Util.getParam(params, Params.ID));

        final SchematronCriteriaRepository criteriaRepository = context.getBean(SchematronCriteriaRepository.class);

        if (criteriaRepository.exists(id)) {
            criteriaRepository.delete(id);
            if (!criteriaRepository.exists(id)) {
                return new Element("ok");
            } else {
                throw new IOException("Error deleting criteria object");
            }
        }
View Full Code Here

TOP

Related Classes of org.fao.geonet.repository.SchematronCriteriaRepository

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.