Examples of HarvesterSetting


Examples of org.fao.geonet.domain.HarvesterSetting

    }

    // ---------------------------------------------------------------------------

    public boolean getValueAsBool(String path) {
        HarvesterSetting value = _settingsRepo.findOneByPath(path);

        if (value == null)
            return false;

        return value.getValueAsBool();
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

    }


    @Test
    public void testFindOneByPath() throws Exception {
        HarvesterSetting parent = _repo.save(newSetting().setName("2"));
        HarvesterSetting child2 = _repo.save(newSetting().setParent(parent).setName("2"));
        HarvesterSetting child3 = _repo.save(newSetting().setParent(parent).setName("2"));
        HarvesterSetting child4 = _repo.save(newSetting().setParent(child3).setName("4"));

        String path = child2.getName();
        HarvesterSetting found = _repo.findOneByPath(path);
        assertNotNull(found);
        assertSameContents(child4, found, _skipProps);
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

        assertSameContents(child4, found, _skipProps);
    }

    @Test
    public void testDeleteById() throws Exception {
        HarvesterSetting parent = _repo.save(newSetting().setName("2"));
        _repo.save(newSetting().setParent(parent).setName("2"));
        HarvesterSetting child3 = _repo.save(newSetting().setParent(parent).setName("2"));
        _repo.save(newSetting().setParent(child3).setName("4"));

        _repo.delete(parent.getId());

        assertEquals(0, _repo.count());
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

        assertEquals(0, _repo.count());
    }
    @Test
    public void testDeleteByEntity() throws Exception {
        HarvesterSetting parent = _repo.save(newSetting().setName("2"));
        _repo.save(newSetting().setParent(parent).setName("2"));
        HarvesterSetting child3 = _repo.save(newSetting().setParent(parent).setName("2"));
        _repo.save(newSetting().setParent(child3).setName("4"));

        _repo.delete(parent);

        assertEquals(0, _repo.count());
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

    private HarvesterSetting newSetting() {
        return newSetting(_inc);
    }
    public static HarvesterSetting newSetting(AtomicInteger inc) {
        int id = inc.incrementAndGet();
        return new HarvesterSetting().setName("name " + id).setValue("value " + id);
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

            return false;
        }

        // IPv4

    HarvesterSetting network = _settingRepository.findOneByPath("system/intranet/network");
    HarvesterSetting netmask = _settingRepository.findOneByPath("system/intranet/netmask");

        try {
            if (network != null && netmask != null) {
                long lIntranetNet = getAddress(network.getValue());
                long lIntranetMask = getAddress(netmask.getValue());
                long lAddress = getAddress(ip);
                return (lAddress & lIntranetMask) == lIntranetNet;
            }
        } catch (Exception nfe) {
      nfe.printStackTrace();
View Full Code Here

Examples of org.fao.geonet.domain.HarvesterSetting

    private static void saveParentAndChildHarvesterSetting(ServiceContext context) {
        final String name = UUID.randomUUID().toString();

        final HarvesterSettingRepository settingRepository = context.getBean(HarvesterSettingRepository.class);
        settingRepository.save(new HarvesterSetting().setName(name).setValue("value"));

        final HarvesterSetting parent = settingRepository.findOneByPath(name);
        final HarvesterSetting child = new HarvesterSetting().setValue("childValue").setName("childName")
                .setParent(parent);

        settingRepository.save(child);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.