Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.MapServer


     
      ACTION action = ACTION.valueOf(Util.getParam(params, "action"));
      if (action.equals(ACTION.LIST)) {
            return loadDbConfiguration(context);
      } else if (action.equals(ACTION.ADD_NODE)) {
            MapServer m = new MapServer()
                    .setName(Util.getParam(params, "name", ""))
                    .setDescription(Util.getParam(params, "description", ""))
                    .setConfigurl(Util.getParam(params, "configurl", ""))
                    .setWmsurl(Util.getParam(params, "wmsurl", ""))
                    .setWfsurl(Util.getParam(params, "wfsurl", ""))
                    .setWcsurl(Util.getParam(params, "wcsurl", ""))
                    .setStylerurl(Util.getParam(params, "stylerurl", ""))
                    .setUsername(Util.getParam(params, "username", ""))
                    .setPassword(Util.getParam(params, "password", ""))
                    .setNamespace(Util.getParam(params, "namespace", ""))
                    .setNamespacePrefix(Util.getParam(params, "namespaceprefix", ""));
            context.getBean(MapServerRepository.class).save(m);
            return new Element(action.toString())
                        .setText("ok")
                        .setAttribute("id", String.valueOf(m.getId()));
        } else if (action.equals(ACTION.REMOVE_NODE)) {
            MapServer m = repo.findOneById(Util.getParam(params, "id"));
            if (m != null) {
                repo.delete(m);
            }
            return new Element(action.toString()).setText("ok");
        } else if (action.equals(ACTION.UPDATE_NODE)) {
            MapServer m = repo.findOneById(Util.getParam(params, "id"));
            if (m != null) {
                m.setName(Util.getParam(params, "name", ""))
                    .setDescription(Util.getParam(params, "description", ""))
                    .setConfigurl(Util.getParam(params, "configurl", ""))
                    .setWmsurl(Util.getParam(params, "wmsurl", ""))
                    .setWfsurl(Util.getParam(params, "wfsurl", ""))
                    .setWcsurl(Util.getParam(params, "wcsurl", ""))
                    .setStylerurl(Util.getParam(params, "stylerurl", ""))
                    .setNamespace(Util.getParam(params, "namespace", ""))
                    .setNamespacePrefix(Util.getParam(params, "namespaceprefix", ""));
                repo.save(m);
            }
            return new Element(action.toString()).setText("ok");
        } else if (action.equals(ACTION.UPDATE_NODE_ACCOUNT)) {
            MapServer m = repo.findOneById(Util.getParam(params, "id"));
            if (m != null) {
                m.setUsername(Util.getParam(params, "username", ""))
                    .setPassword(Util.getParam(params, "password", ""));
                repo.save(m);
            }
            return new Element(action.toString()).setText("ok");
        } else if (action.equals(ACTION.CREATE) || action.equals(ACTION.UPDATE)
          || action.equals(ACTION.DELETE) || action.equals(ACTION.GET)) {
   
        // Check parameters
        String nodeId = Util.getParam(params, "nodeId");
        String metadataId = Util.getParam(params, "metadataId");
        String metadataUuid = Util.getParam(params, "metadataUuid", "");
        // purge \\n from metadataTitle - geoserver prefers layer titles on a single line
        String metadataTitle = Util.getParam(params, "metadataTitle", "").replace("\\n","");
        // unescape \\n from metadataAbstract so they're properly sent to geoserver
        String metadataAbstract = Util.getParam(params, "metadataAbstract", "").replace("\\n","\n");
            MapServer m = repo.findOneById(nodeId);
            GeoServerNode g = new GeoServerNode(m);

            final GeonetHttpRequestFactory requestFactory = context.getBean(GeonetHttpRequestFactory.class);
            GeoServerRest gs = new GeoServerRest(requestFactory, g.getUrl(),
                    g.getUsername(), g.getUserpassword(),
View Full Code Here


    private AtomicInteger _nextId = new AtomicInteger();

    @Test
    public void test_Save_Count_FindOnly_DeleteAll() throws Exception {
        assertEquals(0, _repo.count());
        MapServer MapServer = newMapServer();
        MapServer savedMapServer = _repo.save(MapServer);

        _repo.flush();
        _entityManager.flush();
        _entityManager.clear();

        MapServer.setId(savedMapServer.getId());
        assertEquals(1, _repo.count());
        assertSameContents(MapServer, _repo.findOneById(MapServer.getId()));

        _repo.deleteAll();
View Full Code Here

    }

    @Test
    public void testUpdate() throws Exception {
        assertEquals(0, _repo.count());
        MapServer MapServer = newMapServer();

        MapServer savedMapServer = _repo.save(MapServer);

        _repo.flush();
        _entityManager.flush();
        _entityManager.clear();

        MapServer.setId(savedMapServer.getId());

        assertEquals(1, _repo.count());
        assertSameContents(MapServer, _repo.findOneById(MapServer.getId()));

        MapServer.setName("New Name");
        MapServer savedMapServer2 = _repo.save(MapServer);

        _repo.flush();
        _entityManager.flush();
        _entityManager.clear();
View Full Code Here

        return newMapServer(_nextId);
    }

    public static MapServer newMapServer(AtomicInteger nextId) {
        int id = nextId.incrementAndGet();
        return new MapServer()
                .setDescription("Desc " + id)
                .setConfigurl("http://mygeoserver.org/" + id + "/rest")
                .setName("Name " + id)
                .setUsername("admin")
                .setPassword("123456")
View Full Code Here

TOP

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

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.