Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.Service


            MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE })
    public @ResponseBody
    CswVirtualServiceResponse exec(@RequestParam String id)
            throws Exception {

        final Service service = serviceRepository.findOne(Integer.valueOf(id));

        CswVirtualServiceResponse response = new CswVirtualServiceResponse(service);

        return response;
    }
View Full Code Here


        filters.put(Params.FILTER_CATALOG, filterCatalog);
        filters.put(Params.FILTER_GROUP, filterGroup);
        filters.put(Params.FILTER_CATEGORY, filterCategory);

        if (operation.equals(Params.Operation.NEWSERVICE)) {
            Service service = serviceRepository.findOneByName(serviceName);

            if (service != null) {
                throw new IllegalArgumentException("Service with name "
                        + serviceName + " already exists");
            }

            service = new org.fao.geonet.domain.Service();
            service.setDescription(serviceDescription);
            service.setClassName(className);
            service.setName(serviceName);


            for (Map.Entry<String, String> filter : filters.entrySet()) {
                if (filter.getValue() != null && !filter.getValue().equals("")) {
                    service.getParameters().put(filter.getKey(), filter.getValue());
                }
            }
            serviceRepository.save(service);
            serviceId = String.valueOf(service.getId());
        } else if (operation.equals(Params.Operation.UPDATESERVICE)) {
            final Service service = serviceRepository.findOne(Integer.valueOf(serviceId));
            service.setClassName(className);
            service.setName(serviceName);
            service.setDescription(serviceDescription);

            for (Map.Entry<String, String> filter : filters.entrySet()) {
                service.getParameters().put(filter.getKey(), filter.getValue());
            }

            serviceRepository.save(service);
        }
View Full Code Here

    @Autowired
    ServiceRepository _repo;

    @Test
    public void testFindOne() throws Exception {
        Service service = newService();
        service = _repo.save(service);

        Service service1 = newService();
        service1 = _repo.save(service1);

        _EntityManager.flush();
        _EntityManager.clear();

        final Service found1 = _repo.findOne(service1.getId());
        assertEquals(2, found1.getParameters().size());
        assertSameContents(service1, found1);
        final Service found = _repo.findOne(service.getId());
        assertEquals(2, found.getParameters().size());
        assertSameContents(service, found);


    }
View Full Code Here

    }

    @Test
    public void testFindOneByName() {
        Service service = newService();
        service = _repo.save(service);

        Service service1 = newService();
        service1 = _repo.save(service1);

        assertEquals(service1, _repo.findOneByName(service1.getName()));
        assertEquals(service, _repo.findOneByName(service.getName()));
    }
View Full Code Here

        return newService(_inc);
    }
    public static Service newService(AtomicInteger inc) {
        int val = inc.incrementAndGet();

        Service service = new Service();

        service.setId(val);
        service.setName("name" + val);
        service.setClassName("classname" + val);
        service.setDescription("description" + val);

        HashMap<String, String> params = new HashMap<String, String>();
        params.put("name_1_" + val, "value_1_" + val);
        params.put("name_2_" + val, "value_2_" + val);
        service.setParameters(params);

        return service;
    }
View Full Code Here

        assertEquals(4, _searchRequestParamRepo.count());
        _searchRequestParamRepo.saveAndFlush(SearchRequestParamRepositoryTest.newRequestParam(_inc));
        assertEquals(39, _searchRequestRepo.count());
        _searchRequestRepo.saveAndFlush(SearchRequestRepositoryTest.newSearchRequest(_inc));
        assertEquals(0, _serviceRepo.count());
        Service service = ServiceRepositoryTest.newService(_inc);
        service.getParameters().clear();
        service = _serviceRepo.saveAndFlush(service);
        service.getParameters().put("p1", "p2");
        _serviceRepo.saveAndFlush(service);
        assertTrue(_settingRepo.count() > 0);
        _settingRepo.update("system/csw/metadataPublic", new Updater<Setting>() {
            @Override
            public void apply(@Nonnull Setting entity) {
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.Service

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.