TaggingGroupingValue enhanced
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/gcubedatacatalogue-metadata-discovery@146251 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1d9fda8845
commit
eda283325a
|
@ -8,6 +8,7 @@ import java.io.Serializable;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
|
@ -32,6 +33,7 @@ public class MetadataGrouping implements Serializable{
|
|||
private Boolean create = false;
|
||||
|
||||
@XmlJavaTypeAdapter(TaggingGroupingAdapter.class)
|
||||
@XmlElement(required=true)
|
||||
private TaggingGroupingValue groupingValue = null;
|
||||
|
||||
/**
|
||||
|
@ -39,4 +41,58 @@ public class MetadataGrouping implements Serializable{
|
|||
*/
|
||||
public MetadataGrouping() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the create
|
||||
*/
|
||||
public Boolean getCreate() {
|
||||
|
||||
return create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the groupingValue
|
||||
*/
|
||||
public TaggingGroupingValue getGroupingValue() {
|
||||
|
||||
return groupingValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param create the create to set
|
||||
*/
|
||||
public void setCreate(Boolean create) {
|
||||
|
||||
this.create = create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param groupingValue the groupingValue to set
|
||||
*/
|
||||
public void setGroupingValue(TaggingGroupingValue groupingValue) {
|
||||
|
||||
this.groupingValue = groupingValue;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("MetadataGrouping [create=");
|
||||
builder.append(create);
|
||||
builder.append(", groupingValue=");
|
||||
builder.append(groupingValue);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.Serializable;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
|
@ -30,6 +31,7 @@ public class MetadataTagging implements Serializable{
|
|||
private String separator = ":";
|
||||
|
||||
@XmlJavaTypeAdapter(TaggingGroupingAdapter.class)
|
||||
@XmlElement(required=true)
|
||||
private TaggingGroupingValue taggingValue = null;
|
||||
|
||||
/**
|
||||
|
@ -42,4 +44,78 @@ public class MetadataTagging implements Serializable{
|
|||
*/
|
||||
public MetadataTagging() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the create
|
||||
*/
|
||||
public Boolean getCreate() {
|
||||
|
||||
return create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the separator
|
||||
*/
|
||||
public String getSeparator() {
|
||||
|
||||
return separator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the taggingValue
|
||||
*/
|
||||
public TaggingGroupingValue getTaggingValue() {
|
||||
|
||||
return taggingValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param create the create to set
|
||||
*/
|
||||
public void setCreate(Boolean create) {
|
||||
|
||||
this.create = create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param separator the separator to set
|
||||
*/
|
||||
public void setSeparator(String separator) {
|
||||
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param taggingValue the taggingValue to set
|
||||
*/
|
||||
public void setTaggingValue(TaggingGroupingValue taggingValue) {
|
||||
|
||||
this.taggingValue = taggingValue;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("MetadataTagging [create=");
|
||||
builder.append(create);
|
||||
builder.append(", separator=");
|
||||
builder.append(separator);
|
||||
builder.append(", taggingValue=");
|
||||
builder.append(taggingValue);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,22 @@ package org.gcube.datacatalogue.metadatadiscovery.bean.jaxb;
|
|||
*/
|
||||
public enum TaggingGroupingValue {
|
||||
|
||||
onFieldName,
|
||||
onValue;
|
||||
onFieldName("onFieldName"),
|
||||
onValue("onValue"),
|
||||
onFieldName_onValue("onFieldName onValue"),
|
||||
onValue_onFieldName("onValue onFieldName");
|
||||
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* Instantiates a new tagging grouping value.
|
||||
*
|
||||
* @param value the value
|
||||
*/
|
||||
TaggingGroupingValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Value.
|
||||
|
@ -21,24 +35,28 @@ public enum TaggingGroupingValue {
|
|||
* @return the string
|
||||
*/
|
||||
public String value() {
|
||||
return name();
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* From value.
|
||||
*
|
||||
* @param v the v
|
||||
* @return the tagging grouping value
|
||||
* @param value the value
|
||||
* @return the TaggingGroupingValue matching the input value or default value {@link TaggingGroupingValue#onValue}
|
||||
*/
|
||||
public static TaggingGroupingValue fromValue(String v) {
|
||||
TaggingGroupingValue vv;
|
||||
public static TaggingGroupingValue fromValue(String value) {
|
||||
|
||||
try{
|
||||
vv = valueOf(v);
|
||||
for (TaggingGroupingValue tgv : TaggingGroupingValue.values()) {
|
||||
if(tgv.value.equals(value))
|
||||
return tgv;
|
||||
}
|
||||
}catch(Exception e){
|
||||
return TaggingGroupingValue.onValue;
|
||||
}
|
||||
|
||||
return vv;
|
||||
return TaggingGroupingValue.onValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,15 +117,13 @@ public class TestJaxbMetadataMarshUnmarsh {
|
|||
//We had written this file in marshalling example
|
||||
MetadataFormat mtds = (MetadataFormat) jaxbUnmarshaller.unmarshal(new File(tmpFileXML));
|
||||
|
||||
for(MetadataField mtd : mtds.getMetadataFields())
|
||||
{
|
||||
System.out.println("Unmarshall: "+mtd);
|
||||
}
|
||||
System.out.println(mtds);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println(DataType.valueOf("aa"));
|
||||
//System.out.println(DataType.valueOf("aa"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue