Package com.googlecode.mashups.services.common

Examples of com.googlecode.mashups.services.common.ServiceParameter


    private List<ServiceParameter> prepareQueryParameters(List<ServiceParameter> parameters) {
        if (parameters == null) {
            parameters = new ArrayList<ServiceParameter>();
        }
       
        if (parameters.contains(new ServiceParameter(GoogleSearchServiceParameters.VERSION))) {
            parameters.remove(new ServiceParameter(GoogleSearchServiceParameters.VERSION));
        }
       
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.VERSION, "1.0"));
       
        return parameters;
    }     
View Full Code Here


                // get the component attributes.
                List<ServiceParameter> parameters          = new ArrayList<ServiceParameter>();
                GoogleSearchService    googleSearchService = GoogleServicesFactory.getGoogleSearchService();

                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.VERSION, "1.0"));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.QUERY, googleSearchList.getSearchQuery()));

                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.START, googleSearchList.getStartResultIndex().toString()));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.RSZ, googleSearchList.getResultSetSize()));
                parameters.add(new ServiceParameter(GoogleSearchServiceParameters.HL, googleSearchList.getHostLanguage()));

                if (googleSearchList.getKey() != null) {
                    parameters.add(new ServiceParameter(GoogleSearchServiceParameters.KEY, googleSearchList.getKey()));
                }

                // perform the actual video search on youTube.
                List<GoogleSearchResultItem> googleSearchResults = googleSearchService.getWebSearchResultList(parameters);
View Full Code Here

               
                // get the component attributes.
                List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
                YouTubeSearchService   youTubeSearchService = YouTubeServicesFactory.getYouTubeSearchService();
              
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.VERSION, "2"));     
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.MAX_RESULTS, youTubeVideoList.getMaxResults().toString()));
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.QUERY, youTubeVideoList.getSearchQuery()));
               
                if (youTubeVideoList.getCategory() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.CATEGORY, youTubeVideoList.getCategory()));
                }
               
                if (youTubeVideoList.getLocation() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION, youTubeVideoList.getLocation()));
                }
               
                if (youTubeVideoList.getLocationRadius() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION_RADIUS, youTubeVideoList.getLocationRadius()));
                }
               
                // perform the actual video search on youTube.
                List<YouTubeSearchResultItem> videoResults = youTubeSearchService.getVideoList(parameters);           
   
View Full Code Here

            String                 locationCode        = yahooWeather.getLocationCode();
            String                 temperatureType     = yahooWeather.getTemperatureType();
            List<ServiceParameter> parameters          = new ArrayList<ServiceParameter>();
            YahooWeatherService    yahooWeatherService = YahooServicesFactory.getYahooWeatherService();
           
            parameters.add(new ServiceParameter(YahooWeatherServiceParameters.ZIP_CODE, locationCode));
            parameters.add(new ServiceParameter(YahooWeatherServiceParameters.TEMPERATURE_TYPE, temperatureType));
           
            try {
                YahooWeatherServiceStatus status = yahooWeatherService.getWeatherStatus(parameters);
                
                writer.write(status.toString());
View Full Code Here

public class GoogleSearchServiceTest extends TestCase {
    public void testGetWebSearchResults() throws Exception {
        List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
        GoogleSearchService    googleSearchService  = GoogleServicesFactory.getGoogleSearchService();
      
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.VERSION, "1.0"));     
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.RSZ, "large"));
        parameters.add(new ServiceParameter(GoogleSearchServiceParameters.QUERY, "Egypt Algeria"));       
        
        try {
            List<GoogleSearchResultItem> webSearchResults = googleSearchService.getWebSearchResultList(parameters);
           
            for (GoogleSearchResultItem searchItem : webSearchResults) {
View Full Code Here

public class YahooWeatherServiceTest extends TestCase {
    public void testGetWeatherStatus() {
        List<ServiceParameter> weatherStatusParameters = new ArrayList<ServiceParameter>();
       
        weatherStatusParameters.add(new ServiceParameter(YahooWeatherServiceParameters.ZIP_CODE, "94089"));
        weatherStatusParameters.add(new ServiceParameter(YahooWeatherServiceParameters.TEMPERATURE_TYPE, "c"));
       
        YahooWeatherService yahooWeatherService = YahooServicesFactory.getYahooWeatherService();
       
        try {
            YahooWeatherServiceStatus status = yahooWeatherService.getWeatherStatus(weatherStatusParameters);
View Full Code Here

public class YouTubeSearchServiceTest extends TestCase {
    public void testgGetVideoList() {
        List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
        YouTubeSearchService   youTubeSearchService = YouTubeServicesFactory.getYouTubeSearchService();
      
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.VERSION, "2"));     
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.MAX_RESULTS, "25"));
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.CATEGORY, "sports"));
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.QUERY, "brazil"));         
        
        try {
            List<YouTubeSearchResultItem> videoResults = youTubeSearchService.getVideoList(parameters);
           
            for (YouTubeSearchResultItem searchItem : videoResults) {
View Full Code Here

*/
public class ServiceParameterUtilityTest extends TestCase {
    public void testToParametersString() {
        List<ServiceParameter> parameters = new ArrayList<ServiceParameter>();
       
        parameters.add(new ServiceParameter("c", "123"));
        parameters.add(new ServiceParameter("a", "234"));
       
        System.out.println("The final string is: " + ServiceParametersUtility.toParametersString(parameters));
    }
View Full Code Here

               
                // get the component attributes.
                List<ServiceParameter> parameters        = new ArrayList<ServiceParameter>();    
                DiggSearchService      diggSearchService = DiggServicesFactory.getDiggSearchService();
                
                parameters.add(new ServiceParameter(DiggSearchServiceParameters.SEARCH_ARGS_SEARCH_QUERY, diggSearchList.getSearchQuery()));
                parameters.add(new ServiceParameter(DiggSearchServiceParameters.SEARCH_ARGS_OFFSET, diggSearchList.getStartResultIndex().toString()));
                parameters.add(new ServiceParameter(DiggSearchServiceParameters.SEARCH_ARGS_COUNT, diggSearchList.getResultSetSize().toString()));               
              
               
                if (diggSearchList.getDomain() != null) {
                    parameters.add(new ServiceParameter(DiggSearchServiceParameters.SEARCH_ARGS_DOMAIN, diggSearchList.getDomain()));
                }
               
                if (diggSearchList.getSortBy() != null) {
                    parameters.add(new ServiceParameter(DiggSearchServiceParameters.SEARCH_ARGS_SORT, diggSearchList.getSortBy()));                   
                }
               
                // perform the actual stories search on digg.
                List<DiggSearchStoryResultItem> diggSearchResults = diggSearchService.getStoriesList(parameters).getSearchResultList();
   
View Full Code Here

               
                // get the component attributes.
                List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
                TwitterSearchService   twitterSearchService = TwitterServicesFactory.getTwitterSearchService();
                
                parameters.add(new ServiceParameter(TwitterSearchServiceParameters.QUERY, twitterSearchList.getSearchQuery()));
                parameters.add(new ServiceParameter(TwitterSearchServiceParameters.PAGE, twitterSearchList.getPageNumber().toString()));
                parameters.add(new ServiceParameter(TwitterSearchServiceParameters.TWEETS_PER_PAGE, twitterSearchList.getResultSetSize().toString()));               
                parameters.add(new ServiceParameter(TwitterSearchServiceParameters.SHOW_USER, twitterSearchList.getShowUser()));              
               
                if (twitterSearchList.getResultType() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.RESULT_TYPE, twitterSearchList.getResultType()));
                }
               
                if (twitterSearchList.getSinceDate() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.SINCE_DATE, twitterSearchList.getSinceDate()));                   
                }
               
                if (twitterSearchList.getBeforeDate() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.BEFORE_DATE, twitterSearchList.getBeforeDate()));                   
                }  
               
                if (twitterSearchList.getSinceID() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.SINCE_ID, twitterSearchList.getSinceID()));                   
                }  
               
                if (twitterSearchList.getMaxID() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.MAX_ID, twitterSearchList.getMaxID()));                   
                }   
               
                if (twitterSearchList.getGeocode() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.GEOCODE, twitterSearchList.getGeocode()));                   
                }    
               
                if (twitterSearchList.getLocale() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.LOCALE, twitterSearchList.getLocale()));                   
                }
               
                if (twitterSearchList.getLanguage() != null) {
                    parameters.add(new ServiceParameter(TwitterSearchServiceParameters.LANGUAGE, twitterSearchList.getLanguage()));                   
                }                 
               
                // perform the actual tweets search on twitter.
                List<TwitterSearchResultItem> twitterSearchResults = twitterSearchService.getSearchList(parameters);
   
View Full Code Here

TOP

Related Classes of com.googlecode.mashups.services.common.ServiceParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.