added code to manage namespace for metadatacategory and metadatafield
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/gcubedatacatalogue-metadata-discovery@146304 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6f4b3c0397
commit
8db8f5baad
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.datacatalogue.metadatadiscovery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Mar 23, 2017
|
||||||
|
*/
|
||||||
|
public interface MetadataNamespace {
|
||||||
|
|
||||||
|
public static final String Separator = ":";
|
||||||
|
}
|
|
@ -128,6 +128,4 @@ public class MetadataType implements Serializable{
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.metadatadiscovery.MetadataNamespace;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +38,8 @@ public class MetadataCategory implements Serializable{
|
||||||
|
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
|
private String namespaceCategory = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new metadata category.
|
* Instantiates a new metadata category.
|
||||||
|
@ -52,12 +57,10 @@ public class MetadataCategory implements Serializable{
|
||||||
public MetadataCategory(String id, String title) {
|
public MetadataCategory(String id, String title) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
setId(id);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new metadata category.
|
* Instantiates a new metadata category.
|
||||||
*
|
*
|
||||||
|
@ -68,12 +71,11 @@ public class MetadataCategory implements Serializable{
|
||||||
public MetadataCategory(String id, String title, String description) {
|
public MetadataCategory(String id, String title, String description) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
setId(id);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id.
|
* Gets the id.
|
||||||
*
|
*
|
||||||
|
@ -115,6 +117,16 @@ public class MetadataCategory implements Serializable{
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
setNamespaceCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the namespace category.
|
||||||
|
*/
|
||||||
|
private void setNamespaceCategory() {
|
||||||
|
|
||||||
|
this.namespaceCategory = "metadatacategory"+MetadataNamespace.Separator+id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,6 +152,17 @@ public class MetadataCategory implements Serializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the namespace category.
|
||||||
|
*
|
||||||
|
* @return the namespace category
|
||||||
|
*/
|
||||||
|
public String getNamespaceCategory() {
|
||||||
|
|
||||||
|
return namespaceCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
|
@ -153,8 +176,12 @@ public class MetadataCategory implements Serializable{
|
||||||
builder.append(title);
|
builder.append(title);
|
||||||
builder.append(", description=");
|
builder.append(", description=");
|
||||||
builder.append(description);
|
builder.append(description);
|
||||||
|
builder.append(", namespaceCategory=");
|
||||||
|
builder.append(namespaceCategory);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.metadatadiscovery.MetadataNamespace;
|
||||||
import org.gcube.datacatalogue.metadatadiscovery.adapter.DataTypeAdapter;
|
import org.gcube.datacatalogue.metadatadiscovery.adapter.DataTypeAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +59,9 @@ public class MetadataField implements Serializable{
|
||||||
@XmlElement(name = "grouping")
|
@XmlElement(name = "grouping")
|
||||||
private MetadataGrouping grouping;
|
private MetadataGrouping grouping;
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
|
private String namespaceFieldToCategoryReference = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new metadata field.
|
* Instantiates a new metadata field.
|
||||||
*/
|
*/
|
||||||
|
@ -91,8 +96,28 @@ public class MetadataField implements Serializable{
|
||||||
public void setCategoryRef(String categoryRef) {
|
public void setCategoryRef(String categoryRef) {
|
||||||
|
|
||||||
this.categoryRef = categoryRef;
|
this.categoryRef = categoryRef;
|
||||||
|
setNamespaceFieldToCategoryRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void setNamespaceFieldToCategoryRef() {
|
||||||
|
|
||||||
|
this.namespaceFieldToCategoryReference = "categoryref"+MetadataNamespace.Separator+categoryRef+MetadataNamespace.Separator+fieldName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the namespaceFieldToCategoryReference
|
||||||
|
*/
|
||||||
|
public String getNamespaceFieldToCategoryReference() {
|
||||||
|
|
||||||
|
return namespaceFieldToCategoryReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the fieldName
|
* @return the fieldName
|
||||||
*/
|
*/
|
||||||
|
@ -281,6 +306,8 @@ public class MetadataField implements Serializable{
|
||||||
builder.append(tagging);
|
builder.append(tagging);
|
||||||
builder.append(", grouping=");
|
builder.append(", grouping=");
|
||||||
builder.append(grouping);
|
builder.append(grouping);
|
||||||
|
builder.append(", namespaceFieldToCategoryReference=");
|
||||||
|
builder.append(namespaceFieldToCategoryReference);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,10 @@ public class TestDataCatalogueMetadataFormatReader {
|
||||||
String scopeString = "/gcube/devNext/NextNext";
|
String scopeString = "/gcube/devNext/NextNext";
|
||||||
ScopeProvider.instance.set(scopeString);
|
ScopeProvider.instance.set(scopeString);
|
||||||
DataCalogueMetadataFormatReader reader = new DataCalogueMetadataFormatReader();
|
DataCalogueMetadataFormatReader reader = new DataCalogueMetadataFormatReader();
|
||||||
logger.trace(""+reader.getListOfMetadataTypes());
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (MetadataType mt : reader.getListOfMetadataTypes()) {
|
for (MetadataType mt : reader.getListOfMetadataTypes()) {
|
||||||
MetadataFormat metadataFormat = reader.getMetadataFormatForMetadataType(mt);
|
MetadataFormat metadataFormat = reader.getMetadataFormatForMetadataType(mt);
|
||||||
//logger.trace("\n\n "+ ++i +".) Metadata Format: "+metadataFormat.toString());
|
logger.trace("\n\n "+ ++i +".) Metadata source: "+metadataFormat.getMetadataSource().substring(0, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue