Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.Source


                } else {
          sourceName = "(unknown)";
          Resources.copyUnknownLogo(context, sourceUuid);
        }

                Source source = new Source(sourceUuid, sourceName, false);
                context.getBean(SourceRepository.class).save(source);
            }
        }
  }
View Full Code Here


        String newUuid = values.get(SettingManager.SYSTEM_SITE_SITE_ID_PATH);

        if (newUuid != null && !currentUuid.equals(newUuid)) {
            final MetadataRepository metadataRepository = context.getBean(MetadataRepository.class);
            final SourceRepository sourceRepository = context.getBean(SourceRepository.class);
            final Source source = sourceRepository.findOne(currentUuid);
            Source newSource = new Source(newUuid, source.getName(), source.isLocal());
            sourceRepository.save(newSource);

            PathSpec<Metadata, String> servicesPath = new PathSpec<Metadata, String>() {
                @Override
                public Path<String> getPath(Root<Metadata> root) {
View Full Code Here

    @Autowired
    private SourceRepository _repo;

    @Test
    public void testFindOneByName() throws Exception {
        Source source1 = _repo.save(newSource());
        Source source2 = _repo.save(newSource());

        assertEquals(source1.getUuid(), _repo.findOneByName(source1.getName()).getUuid());
        assertEquals(source2.getUuid(), _repo.findOneByName(source2.getName()).getUuid());
    }
View Full Code Here

        assertEquals(source2.getUuid(), _repo.findOneByName(source2.getName()).getUuid());
    }

    @Test
    public void testFindOneByUuid() throws Exception {
        Source source1 = _repo.save(newSource());
        Source source2 = _repo.save(newSource());

        assertEquals(source1.getUuid(), _repo.findOne(source1.getUuid()).getUuid());
        assertEquals(source2.getUuid(), _repo.findOne(source2.getUuid()).getUuid());
    }
View Full Code Here

    }

    public static Source newSource(AtomicInteger inc) {
        int val = inc.incrementAndGet();

        Source source = new Source();
        source.setName("name" + val);
        source.setLocal(val % 2 == 0);
        source.setUuid("uuid" + val);

        return source;
    }
View Full Code Here

        Group group = bean.findAll().get(0);

        MetadataCategory category = serviceContext.getBean(MetadataCategoryRepository.class).findAll().get(0);

        final SourceRepository sourceRepository = serviceContext.getBean(SourceRepository.class);
        Source source = sourceRepository.save(new Source().setLocal(true).setName("GN").setUuid("sourceuuid"));

        final Element sampleMetadataXml = super.getSampleMetadataXml();
        final Metadata metadata = new Metadata();
        metadata.setDataAndFixCR(sampleMetadataXml)
            .setUuid(UUID.randomUUID().toString());
        metadata.getCategories().add(category);
        metadata.getDataInfo().setSchemaId("iso19139");
        metadata.getSourceInfo().setSourceId(source.getUuid());

        final Metadata templateMd = _metadataRepository.save(metadata);
        final String newMetadataId = _dataManager.createMetadata(serviceContext, "" + metadata.getId(), "" + group.getId(), source.getUuid(),
                principal.getId(), templateMd.getUuid(), MetadataType.METADATA.codeString, true);

        Metadata newMetadata = _metadataRepository.findOne(newMetadataId);
        assertEquals(1, newMetadata.getCategories().size());
        assertEquals(category, newMetadata.getCategories().iterator().next());
View Full Code Here

        _applicationContext.getBean(SettingManager.class).setSiteUuid(siteUuid);
        final SourceRepository sourceRepository = _applicationContext.getBean(SourceRepository.class);
        List<Source> sources = sourceRepository.findAll();
        if (sources.isEmpty()) {
            sources = new ArrayList<Source>(1);
            sources.add(sourceRepository.save(new Source().setLocal(true).setName("Name").setUuid(siteUuid)));
        }
        final DataSource dataSource = _applicationContext.getBean(DataSource.class);
        Connection conn = null;
        try {
            conn = dataSource.getConnection();
View Full Code Here

        String schema = dataManager.autodetectSchema(metadata);
        final SourceRepository sourceRepository = _applicationContext.getBean(SourceRepository.class);
        List<Source> sources = sourceRepository.findAll();

        if (sources.isEmpty()) {
            final Source source = sourceRepository.save(new Source().setLocal(true).setName("localsource").setUuid("uuidOfLocalSorce"));
            sources = Lists.newArrayList(source);
        }

        Source source = sources.get(0);
        ArrayList<String> id = new ArrayList<String>(1);
        String createDate = new ISODate().getDateAndTime();
        Importer.importRecord(uuid,
                uuidAction, Lists.newArrayList(metadata), schema, 0,
                source.getUuid(), source.getName(), context,
                id, createDate, createDate,
                "" + groupId, metadataType);

        dataManager.indexMetadata(id.get(0), true);
        return Integer.parseInt(id.get(0));
View Full Code Here

TOP

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

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.