Fixed #19965
This commit is contained in:
parent
f5ebacadb2
commit
9fa15ef84f
8
pom.xml
8
pom.xml
|
@ -8,7 +8,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.spatial.data</groupId>
|
<groupId>org.gcube.spatial.data</groupId>
|
||||||
<artifactId>geonetwork</artifactId>
|
<artifactId>geonetwork</artifactId>
|
||||||
<version>3.4.3-SNAPSHOT</version>
|
<version>3.4.4-SNAPSHOT</version>
|
||||||
<name>geonetwork</name>
|
<name>geonetwork</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -80,12 +80,6 @@
|
||||||
<groupId>it.geosolutions</groupId>
|
<groupId>it.geosolutions</groupId>
|
||||||
<artifactId>geonetwork-manager</artifactId>
|
<artifactId>geonetwork-manager</artifactId>
|
||||||
<version>1.4-SNAPSHOT</version>
|
<version>1.4-SNAPSHOT</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -169,16 +169,17 @@ public class GcubeISOMetadata {
|
||||||
KeywordSet keySet=new KeywordSet();
|
KeywordSet keySet=new KeywordSet();
|
||||||
for(Entry<Thesaurus,HashSet<String> > entry : this.getDescriptiveKeywords().entrySet()) {
|
for(Entry<Thesaurus,HashSet<String> > entry : this.getDescriptiveKeywords().entrySet()) {
|
||||||
|
|
||||||
|
|
||||||
for(String s:entry.getValue()) {
|
for(String s:entry.getValue()) {
|
||||||
keySet.addKeyword(s);
|
keySet.addKeyword(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
desc.addKeywordSet(keySet);
|
|
||||||
|
|
||||||
|
desc.addKeywordSet(keySet);
|
||||||
|
|
||||||
desc.addKeywordSet(new KeywordSet(
|
desc.addKeywordSet(new KeywordSet(
|
||||||
KeywordType.THEME,
|
KeywordType.THEME,
|
||||||
Collections.singleton(getInspireTheme()),
|
Collections.singleton(getInspireTheme()==null?"Species distribution":getInspireTheme()),
|
||||||
org.gcube.spatial.data.geonetwork.iso.tpl.keys.Thesaurus.INSPIRE_THEMES));
|
org.gcube.spatial.data.geonetwork.iso.tpl.keys.Thesaurus.INSPIRE_THEMES));
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ public class GcubeISOMetadata {
|
||||||
}catch(NullPointerException e) {
|
}catch(NullPointerException e) {
|
||||||
log.warn("*******Distribution info is null!!!****** This should happen only in legacy approaches.");
|
log.warn("*******Distribution info is null!!!****** This should happen only in legacy approaches.");
|
||||||
}
|
}
|
||||||
desc.setLineageStatement(this.getLineageStatement());
|
desc.setLineageStatement(this.getLineageStatement()!=null?this.getLineageStatement():"");
|
||||||
desc.setConstraints(this.getContraints());
|
desc.setConstraints(this.getContraints());
|
||||||
|
|
||||||
return ISOMetadataByTemplate.createXML(desc);
|
return ISOMetadataByTemplate.createXML(desc);
|
||||||
|
|
|
@ -63,6 +63,9 @@ public class ISOMetadataByTemplate {
|
||||||
|
|
||||||
|
|
||||||
loaders.add(new ClassTemplateLoader(ISOMetadataByTemplate.class, "/xmlTemplates"));
|
loaders.add(new ClassTemplateLoader(ISOMetadataByTemplate.class, "/xmlTemplates"));
|
||||||
|
|
||||||
|
|
||||||
|
// ISOMetadataByTemplate.class.getClassLoader().get
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
@ -108,7 +111,7 @@ public class ISOMetadataByTemplate {
|
||||||
|
|
||||||
public static final void registerTemplateFolder(File baseDir) throws IOException {
|
public static final void registerTemplateFolder(File baseDir) throws IOException {
|
||||||
loaders.add(new FileTemplateLoader(baseDir));
|
loaders.add(new FileTemplateLoader(baseDir));
|
||||||
reload();;
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
package org.gcube.spatial.data.geonetwork.test;
|
package org.gcube.spatial.data.geonetwork.test;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
||||||
import org.gcube.spatial.data.geonetwork.LoginLevel;
|
import org.gcube.spatial.data.geonetwork.LoginLevel;
|
||||||
|
import org.gcube.spatial.data.geonetwork.iso.GcubeISOMetadata;
|
||||||
|
import org.gcube.spatial.data.geonetwork.iso.Thesaurus;
|
||||||
|
import org.geotoolkit.metadata.iso.extent.DefaultExtent;
|
||||||
|
import org.opengis.metadata.citation.PresentationForm;
|
||||||
|
import org.opengis.metadata.identification.TopicCategory;
|
||||||
|
import org.opengis.metadata.spatial.GeometricObjectType;
|
||||||
|
import org.opengis.metadata.spatial.TopologyLevel;
|
||||||
|
|
||||||
public class GcubeIsoTest {
|
public class GcubeIsoTest {
|
||||||
|
|
||||||
|
@ -11,11 +20,51 @@ public class GcubeIsoTest {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
TokenSetter.set("/gcube/devsec");
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
GeoNetworkReader reader=GeoNetwork.get();
|
GeoNetworkReader reader=GeoNetwork.get();
|
||||||
reader.login(LoginLevel.SCOPE);
|
reader.login(LoginLevel.SCOPE);
|
||||||
System.out.println(reader.getById("0815e357-ebd7-4c02-8dc8-f945eceb870c"));
|
// System.out.println(reader.getById("0815e357-ebd7-4c02-8dc8-f945eceb870c"));
|
||||||
|
|
||||||
|
System.out.println(fillMeta(0.5, "myself.self", "dumb Title", "stupid table", "BS", "no one", "keywordX").getMetadataFile());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// From ecological engine
|
||||||
|
private static GcubeISOMetadata fillMeta(double resolution, String username, String title, String tableName, String purpose, String credits, String keyword) throws Exception {
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (scope == null)
|
||||||
|
scope = ScopeProvider.instance.get();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
|
GcubeISOMetadata meta = new GcubeISOMetadata();
|
||||||
|
meta.setAbstractField("This metadata has been automatically generated from the Statistical Manager on the basis of a distribution of points and according the resolution of " + resolution + " degrees.");
|
||||||
|
meta.setCreationDate(new Date(System.currentTimeMillis()));
|
||||||
|
meta.setExtent((DefaultExtent) DefaultExtent.WORLD);
|
||||||
|
meta.setGeometricObjectType(GeometricObjectType.SURFACE);
|
||||||
|
meta.setPresentationForm(PresentationForm.MAP_DIGITAL);
|
||||||
|
meta.setPurpose(purpose);
|
||||||
|
meta.setResolution(resolution);
|
||||||
|
if (title == null || title.length() == 0)
|
||||||
|
meta.setTitle("Distribution");
|
||||||
|
else
|
||||||
|
meta.setTitle(title);
|
||||||
|
|
||||||
|
meta.setTopologyLevel(TopologyLevel.GEOMETRY_ONLY);
|
||||||
|
meta.setUser(username);
|
||||||
|
|
||||||
|
meta.addGraphicOverview("http://www.d4science.org/D4ScienceOrg-Social-theme/images/custom/D4ScienceInfrastructure.png");
|
||||||
|
meta.addCredits(credits);
|
||||||
|
Thesaurus generalThesaurus = meta.getConfig().getThesauri().get("General");
|
||||||
|
meta.addKeyword(title, generalThesaurus);
|
||||||
|
meta.addKeyword(username, generalThesaurus);
|
||||||
|
meta.addKeyword("DataMiner", generalThesaurus);
|
||||||
|
meta.addKeyword(keyword, generalThesaurus);
|
||||||
|
meta.addKeyword(tableName, generalThesaurus);
|
||||||
|
meta.addTopicCategory(TopicCategory.BIOTA);
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import java.util.Collections;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.gcube.spatial.data.geonetwork.GeoNetworkPublisher;
|
||||||
|
import org.gcube.spatial.data.geonetwork.LoginLevel;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.ISOMetadataByTemplate;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.ISOMetadataByTemplate;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.MetadataDescriptor;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.MetadataDescriptor;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.codelists.GeometricObjectType;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.codelists.GeometricObjectType;
|
||||||
|
@ -22,7 +24,8 @@ import org.gcube.spatial.data.geonetwork.iso.tpl.keys.Thesaurus;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.parties.Contact;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.parties.Contact;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.parties.ResponsibleParty;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.parties.ResponsibleParty;
|
||||||
import org.gcube.spatial.data.geonetwork.iso.tpl.spatial.VectorRepresentation;
|
import org.gcube.spatial.data.geonetwork.iso.tpl.spatial.VectorRepresentation;
|
||||||
import org.geotoolkit.xml.XML;
|
|
||||||
|
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
|
||||||
|
|
||||||
public class TrueMarbleMeta {
|
public class TrueMarbleMeta {
|
||||||
|
|
||||||
|
@ -31,7 +34,7 @@ public class TrueMarbleMeta {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
// TokenSetter.set("/gcube/devNext");
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
// TokenSetter.set("/pred4s/preprod/preVRE");
|
// TokenSetter.set("/pred4s/preprod/preVRE");
|
||||||
// TokenSetter.set("/d4science.research-infrastructures.eu");
|
// TokenSetter.set("/d4science.research-infrastructures.eu");
|
||||||
|
|
||||||
|
@ -136,17 +139,17 @@ public class TrueMarbleMeta {
|
||||||
File metaFile=ISOMetadataByTemplate.createXML(desc);
|
File metaFile=ISOMetadataByTemplate.createXML(desc);
|
||||||
System.out.println("Going to Publish ----->> "+metaFile.getAbsolutePath());
|
System.out.println("Going to Publish ----->> "+metaFile.getAbsolutePath());
|
||||||
|
|
||||||
// GeoNetworkPublisher publisher=TestConfiguration.getClient();
|
GeoNetworkPublisher publisher=TestConfiguration.getClient();
|
||||||
// publisher.login(LoginLevel.SCOPE);
|
publisher.login(LoginLevel.PRIVATE);
|
||||||
// GNInsertConfiguration config=publisher.getCurrentUserConfiguration("dataset", "_none_");
|
GNInsertConfiguration config=publisher.getCurrentUserConfiguration("dataset", "_none_");
|
||||||
//
|
|
||||||
// config.setValidate(true);
|
config.setValidate(false);
|
||||||
// System.out.println("Settings : "+publisher.getConfiguration().getScopeConfiguration());
|
System.out.println("Settings : "+publisher.getConfiguration().getScopeConfiguration());
|
||||||
// System.out.println("Publishing Settings : validate = "+config.getValidate());
|
System.out.println("Publishing Settings : validate = "+config.getValidate());
|
||||||
// long id=publisher.insertMetadata(config, metaFile);
|
long id=publisher.insertMetadata(config, metaFile);
|
||||||
// System.out.println("PUBLISHED WITH ID : "+id);
|
System.out.println("PUBLISHED WITH ID : "+id);
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue