This commit is contained in:
Lucio Lelii 2008-12-04 01:13:34 +00:00
parent 15294f965f
commit ebf29c1293
4 changed files with 94 additions and 20 deletions

View File

@ -0,0 +1,8 @@
package org.gcube.vremanagement.vremodeler.impl.util;
import java.util.List;
public interface Listable {
public List<String> getAsStringList();
}

View File

@ -0,0 +1,23 @@
package org.gcube.vremanagement.vremodeler.impl.util;
import java.util.Arrays;
import java.util.List;
public class MFRelationDerivate extends MFRelationNative {
private String transformationProgramId;
public MFRelationDerivate(String collectionId, String metaFormatId, String transformationProgramId) {
super(collectionId, metaFormatId);
this.transformationProgramId= transformationProgramId;
}
public String getTransformationProgramId(){
return this.transformationProgramId;
}
public List<String> getAsStringList(){
return Arrays.asList(new String[]{super.getMetadataCollectionId(), super.getMetadataFormatId(), this.getMetadataFormatId()});
}
}

View File

@ -0,0 +1,33 @@
package org.gcube.vremanagement.vremodeler.impl.util;
import java.util.Arrays;
import java.util.List;
public class MFRelationNative implements Listable{
private String metaCollectionID;
private String metaFormatID;
public MFRelationNative(String collectionId, String metaFormatId){
this.metaCollectionID= collectionId;
this.metaFormatID= metaFormatId;
}
public List<String> getAsStringList(){
return Arrays.asList(new String[]{this.metaCollectionID, this.metaFormatID});
}
public String getMetadataCollectionId(){
return this.metaCollectionID;
}
public String getMetadataFormatId(){
return this.metaFormatID;
}
public boolean equals(Object o){
MFRelationNative mf= (MFRelationNative) o;
return (this.metaCollectionID==mf.getMetadataCollectionId()) && (this.metaFormatID==mf.getMetadataFormatId());
}
}

View File

@ -1,27 +1,33 @@
package org.gcube.vremanagement.vremodeler.impl.util;
import org.gcube.common.core.informationsystem.client.XMLResult;
import org.gcube.common.core.informationsystem.client.XMLResult.ISResultEvaluationException;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import org.gcube.common.core.utils.logging.GCUBELog;
public class MetadataFormat{
public class MetadataFormat implements Listable{
private static GCUBELog log= new GCUBELog(MetadataFormat.class.getName());
private String name;
private String schemaURI;
private String language;
private final static GCUBELog log= new GCUBELog(MetadataFormat.class.getName());
private String id;
private String name;
private URI schemaURI;
private String language;
public MetadataFormat(){}
public MetadataFormat(XMLResult xml){
try {
name= xml.evaluate("//Name/text()").get(0);
schemaURI= xml.evaluate("//SchemaURI/text()").get(0);
language= xml.evaluate("//lng/text()").get(0);
}catch(ISResultEvaluationException ise){
log.error("Error parsing th emetadata "+ise.getMessage());
}
public MetadataFormat(String id, String name, URI schemaURI, String language){
log.trace("created a metadataFormat Object with "+id);
this.id= id;
this.name=name;
this.language= language;
this.schemaURI= schemaURI;
}
public String getId(){
return id;
}
public String getName(){
@ -32,12 +38,12 @@ public class MetadataFormat{
name= Name;
}
public String getSchemaURI(){
public URI getSchemaURI(){
return schemaURI;
}
public void setSchemaURI(String schemaURI){
name= schemaURI;
public void setSchemaURI(URI schemaURI){
this.schemaURI= schemaURI;
}
public String getLanguage(){
@ -45,7 +51,7 @@ public class MetadataFormat{
}
public void setLanguage(String lng){
name= lng;
this.language= lng;
}
@Override
@ -55,7 +61,11 @@ public class MetadataFormat{
(this.language.compareTo(mf.getLanguage())==0) &&
(this.schemaURI.compareTo(mf.getSchemaURI())==0));
}
public List<String> getAsStringList(){
return Arrays.asList(new String[]{this.id, this.name, this.schemaURI.getScheme(), this.language});
}
}