package de.mpg.mpiz_koeln.featureClient.test;

import java.util.Collection;

import org.biomoby.shared.MobyException;
import org.biomoby.shared.datatypes.MobyObject;

import de.mpg.mpiz_koeln.featureClient.FeatureClient;
import de.mpg.mpiz_koeln.featureClient.FeatureClientException;
import de.mpg.mpiz_koeln.featureClient.FeatureClientResult;

/**
 * This example shows how to call a service once with a simple object input.
 */
class SimpleSingleCall {
    public static void main( String[] args ) throws FeatureClientException, MobyException {
        FeatureClient client = new FeatureClient();
        client.setTimeout( 45 );
        client.addService( "mpiz-koeln.mpg.de", "ID2IDs" );
        client.setSingleCallInput( "", "NP_176539.1" );
        Collection< FeatureClientResult > result = client.call();

        for ( FeatureClientResult mobyServiceResult : result ) {
            Collection< MobyObject > collection = mobyServiceResult.getSingleCallResult();
            for ( MobyObject mobyObject : collection ) {
                System.out.println( mobyObject.getId() + " " + mobyObject.getNamespace() );
            }
        }
        System.exit( 0 );
    }
}
