Closed MapZombie closed 7 years ago
The xml files are stored within ElasticSearch. Within the index there is an es type "item", and another type "clob". The xmls are within the "clob" type.
Thanks @umacgillivray . Would you know of an effective way of exporting these from ElasticSearch?
to where?
Java from within geoportal would look something like this `
import com.esri.geoportal.lib.elastic.util.Scroller; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import org.elasticsearch.search.SearchHit;
public static void testExport() throws Exception {
AtomicLong count = new AtomicLong(0);
String dir = "C:/Projects/elastic/metadata/sampledata2/";
Scroller scroller = new Scroller();
scroller.setIndexName("metadata");
scroller.setIndexType("clob");
//scroller.setMaxDocs(10);
scroller.scroll(
new Consumer
Basically I'm just looking to export these to the local geoportal server as individual XMLs.
I appreciate the help @umacgillivray . Would you be able to guide me as to where I would enter this code? Which file(s) would need to be edited? I am not very proficient in Java unfortunately.
Thanks.
Can XMLs be exported server side via editing the JavaScript? I'm getting a grasp of the save function. And looking at whether we can add a function to save to a folder as ".xml" file and elasticsearch as usual.
MetadataEditor.js
_save: function(xmlString,itemId) {
var client = new AppClient();
var url = client.getRestUri()+"/metadata/item";
if (typeof itemId === "string" && itemId.length > 0) {
url += "/"+encodeURIComponent(itemId); /* item name id */
}
url = client.appendAccessToken(url); /* Elasticsearch URL? */
var data = { /* Defines Data */
app_editor_s: "gxe", /* Data is from GXE */
xml: xmlString /* XML String */
};
var headers = {"Content-Type": "application/json"}; /* Header */
var info = {handleAs:"json",headers:headers,data:JSON.stringify(data)}; /* Handles as JSON format */
return dojoRequest.put(url,info); /* push to server */
},
Would this be better done as an enhancement to the geoportal-harvester?
Connect to a geoportal 2.0, export to folder.
yes! especially since harvesting to a folder is already supported. you would create an input broker for Geoportal Server Catalog 2.x.
adding @pandzel in case he has already worked on such a broker for harvester
As the new Geoportal does not use a database, I was wondering where the user created metadata (through metadata editor) files stored?
When a user creates metadata is it stored as an XML file on the server? If not, can this be configured to do so?
Thank you.