Examples of autodetectSchema()


Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    DataManager dm = gc.getBean(DataManager.class);

    // get uuid and date modified
    try {
      String schema = dm.autodetectSchema(record);
            if(log.isDebugEnabled())
                log.debug("getRecordInfo (schema): " + schema);

      String identif  = dm.extractUUID(schema, record);
      if (identif.length() == 0) {
View Full Code Here

Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

                Map<String,Pair<String,Element>> mdFiles = new HashMap<String,Pair<String,Element>>();
                for (File file : Files) {
                    if (file != null && !file.isDirectory()) {
                        Element metadata = Xml.loadFile(file);
                        try {
                            String metadataSchema = dm.autodetectSchema(metadata, null);
                            // If local node doesn't know metadata
                            // schema try to load next xml file.
                            if (metadataSchema == null) {
                                continue;
                            }
View Full Code Here

Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

          md.add(index, Xml.transform(md.get(index), stylePath
              + FS + style));
       
       
        final Element metadata = md.get(index);
        String schema = dm.autodetectSchema(metadata, null);

        if (schema == null)
          throw new Exception("Unknown schema");

        // Handle non MEF files insertion
View Full Code Here

Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

        // Apply a stylesheet transformation if requested
        if (!style.equals("_none_"))
            xml = Xml.transform(xml, stylePath +"/"+ style);

        String schema = dataMan.autodetectSchema(xml);
        if (schema == null)
          throw new BadParameterEx("Can't detect schema for metadata automatically.", "schema is unknown");

    if (validate) DataManager.validateMetadata(schema, xml, context);
View Full Code Here

Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

                        final String metadataCategory = metadataCategoryRepository.findAll().get(0).getName();
                        final Element sampleMetadataXml = getSampleMetadataXml();
                        final UserSession userSession = serviceContext.getUserSession();
                        final int userIdAsInt = userSession.getUserIdAsInt();
                        final DataManager dm = DataManagerWorksWithoutTransactionIntegrationTest.this.dataManager;
                        String schema = dm.autodetectSchema(sampleMetadataXml);
                        final String mdId = dm.insertMetadata(serviceContext, schema, sampleMetadataXml,
                                "uuid" + _inc.incrementAndGet(), userIdAsInt, "2", "source",
                                MetadataType.METADATA.codeString, null, metadataCategory, new ISODate().getDateAndTime(),
                                new ISODate().getDateAndTime(), false, false);
                        Element newMd = new Element(sampleMetadataXml.getName(), sampleMetadataXml.getNamespace()).addContent(new Element("fileIdentifier",
View Full Code Here

Examples of org.fao.geonet.kernel.DataManager.autodetectSchema()

     */
    public int importMetadataXML(ServiceContext context, String uuid, InputStream xmlInputStream, MetadataType metadataType,
                                 int groupId, String uuidAction) throws Exception {
        final Element metadata = Xml.loadStream(xmlInputStream);
        final DataManager dataManager = _applicationContext.getBean(DataManager.class);
        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"));
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.