first commit

This commit is contained in:
rpidikiti
2011-07-06 07:45:16 -07:00
commit d8c0f69ad4
229 changed files with 25265 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.wordnik.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to provide list of possible values
* @author ramesh
*
*/
@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface AllowableValues {
String value() default "";
}

View File

@@ -0,0 +1,13 @@
package com.wordnik.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MethodArgumentNames {
String value() default "";
}

View File

@@ -0,0 +1,17 @@
package com.wordnik.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to indicate given property or field is required or not
* @author ramesh
*
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Required {
}

View File

@@ -0,0 +1,290 @@
package com.wordnik.api;
import com.wordnik.common.*;
import com.wordnik.common.ext.*;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.*;
import java.util.*;
import com.wordnik.annotations.MethodArgumentNames;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
/**
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class AccountAPI extends WordnikAPI {
/**
* Authenticates a User
* @param username A confirmed Wordnik username
* @param password The user's password
*
* @return AuthenticationToken {@link AuthenticationToken}
* @throws WordnikAPIException 403 - Account not available. 404 - User not found.
*/
@MethodArgumentNames(value="username, password")
public static AuthenticationToken authenticate(String username, String password) throws WordnikAPIException {
//parse inputs
String resourcePath = "/account.{format}/authenticate/{username}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( password != null) {
queryParams.put("password", password);
}
if( username != null) {
resourcePath = resourcePath.replace("{username}", username);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
AuthenticationToken responseObject = (AuthenticationToken)deserialize(response, AuthenticationToken.class);
return responseObject;
}
/**
* Returns usage statistics for the API account.
*
* @return ApiTokenStatus {@link ApiTokenStatus}
* @throws WordnikAPIException 400 - No token supplied. 404 - No API account with supplied token.
*/
public static ApiTokenStatus getApiTokenStatus() throws WordnikAPIException {
//parse inputs
String resourcePath = "/account.{format}/apiTokenStatus";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
ApiTokenStatus responseObject = (ApiTokenStatus)deserialize(response, ApiTokenStatus.class);
return responseObject;
}
/**
* Returns an ApiResponse indicating whether or not a username is available
* @param username Username
*
* @return ApiResponse {@link ApiResponse}
* @throws WordnikAPIException 400 - Invalid username supplied. 404 - No activation code available.
*/
@MethodArgumentNames(value="username")
public static ApiResponse getUsernameAvailable(String username) throws WordnikAPIException {
//parse inputs
String resourcePath = "/account.{format}/usernameAvailable/{username}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( username != null) {
resourcePath = resourcePath.replace("{username}", username);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
ApiResponse responseObject = (ApiResponse)deserialize(response, ApiResponse.class);
return responseObject;
}
/**
* Regenerates an API Token. Currently not supported or tested.
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid token supplied.
*/
public static void createApiAccount() throws WordnikAPIException {
//parse inputs
String resourcePath = "/account.{format}/regenerateApiToken";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
}
/**
* Authenticates a user
* @param username A confirmed Wordnik username
* @param postObject The user's password
*
* @return AuthenticationToken {@link AuthenticationToken}
* @throws WordnikAPIException 403 - Account not available. 404 - User not found.
*/
@MethodArgumentNames(value="username, postObject")
public static AuthenticationToken authenticatePost(String username, String postObject) throws WordnikAPIException {
//parse inputs
String resourcePath = "/account.{format}/authenticate/{username}";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
if( username != null) {
resourcePath = resourcePath.replace("{username}", username);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
AuthenticationToken responseObject = (AuthenticationToken)deserialize(response, AuthenticationToken.class);
return responseObject;
}
/**
* Returns the logged-in User
Requires a valid auth_token to be set.
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return User {@link User}
* @throws WordnikAPIException 403 - Not logged in. 404 - User not found.
*/
@MethodArgumentNames(value="authToken")
public static User getLoggedInUser(String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/account.{format}/user";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
User responseObject = (User)deserialize(response, User.class);
return responseObject;
}
/**
* Fetches WordList objects for the logged-in user.
* @param authToken auth_token of logged-in user
* @param skip Results to skip
* @param limit Maximum number of results to return
*
* @return List<WordList> {@link WordList}
* @throws WordnikAPIException 403 - Not authenticated. 404 - User account not found.
*/
@MethodArgumentNames(value="authToken, skip, limit")
public static List<WordList> getWordListsForCurrentUser(String authToken, String skip, String limit) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/account.{format}/wordLists";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( skip != null) {
queryParams.put("skip", skip);
}
if( limit != null) {
queryParams.put("limit", limit);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordList>> typeRef = new TypeReference<ArrayList<WordList>>() {
};
try {
List<WordList> responseObject = (List<WordList>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
}

View File

@@ -0,0 +1,18 @@
package com.wordnik.api;
/**
* Maintains the compatible server version against which the drive is written
* @author ramesh
*
*/
public class VersionChecker {
private String compatibleVersion = "4.07.10";
/**
* Gets the version against which the driver code was written
*/
public String getCompatibleVersion() {
return compatibleVersion;
}
}

View File

@@ -0,0 +1,690 @@
package com.wordnik.api;
import com.wordnik.common.*;
import com.wordnik.common.ext.*;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.*;
import java.util.*;
import com.wordnik.annotations.MethodArgumentNames;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
/**
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordAPI extends AbstractWordAPI {
/**
* Given a word as a string, returns the WordObject that represents it
* @param word String value of WordObject to return
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
* @param includeSuggestions Return suggestions (for correct spelling, case variants, etc.)
*
* @return WordObject {@link WordObject}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, useCanonical, includeSuggestions")
public static WordObject getWord(String word, String useCanonical, String includeSuggestions) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( includeSuggestions != null) {
queryParams.put("includeSuggestions", includeSuggestions);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordObject responseObject = (WordObject)deserialize(response, WordObject.class);
return responseObject;
}
/**
* Returns examples for a word
* @param wordExamplesInput
*
* @return ExampleSearchResults {@link ExampleSearchResults}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="wordExamplesInput")
public static ExampleSearchResults getExamples(WordExamplesInput wordExamplesInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/examples";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordExamplesInput != null && wordExamplesInput.getLimit() != null) {
queryParams.put("limit", wordExamplesInput.getLimit());
}
if( wordExamplesInput != null && wordExamplesInput.getIncludeDuplicates() != null) {
queryParams.put("includeDuplicates", wordExamplesInput.getIncludeDuplicates());
}
if( wordExamplesInput != null && wordExamplesInput.getContentProvider() != null) {
queryParams.put("contentProvider", wordExamplesInput.getContentProvider());
}
if( wordExamplesInput != null && wordExamplesInput.getUseCanonical() != null) {
queryParams.put("useCanonical", wordExamplesInput.getUseCanonical());
}
if( wordExamplesInput != null && wordExamplesInput.getSkip() != null) {
queryParams.put("skip", wordExamplesInput.getSkip());
}
if( wordExamplesInput != null && wordExamplesInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordExamplesInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
ExampleSearchResults responseObject = (ExampleSearchResults)deserialize(response, ExampleSearchResults.class);
return responseObject;
}
/**
* Return definitions for a word
* @param wordDefinitionsInput
*
* @return List<Definition> {@link Definition}
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No definitions found.
*/
@MethodArgumentNames(value="wordDefinitionsInput")
public static List<Definition> getDefinitions(WordDefinitionsInput wordDefinitionsInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/definitions";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordDefinitionsInput != null && wordDefinitionsInput.getLimit() != null) {
queryParams.put("limit", wordDefinitionsInput.getLimit());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getPartOfSpeech() != null) {
queryParams.put("partOfSpeech", wordDefinitionsInput.getPartOfSpeech());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getIncludeRelated() != null) {
queryParams.put("includeRelated", wordDefinitionsInput.getIncludeRelated());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getSourceDictionaries() != null) {
queryParams.put("sourceDictionaries", wordDefinitionsInput.getSourceDictionaries());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getUseCanonical() != null) {
queryParams.put("useCanonical", wordDefinitionsInput.getUseCanonical());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getIncludeTags() != null) {
queryParams.put("includeTags", wordDefinitionsInput.getIncludeTags());
}
if( wordDefinitionsInput != null && wordDefinitionsInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordDefinitionsInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<Definition>> typeRef = new TypeReference<ArrayList<Definition>>() {
};
try {
List<Definition> responseObject = (List<Definition>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Returns a top example for a word
* @param word Word to fetch examples for
* @param contentProvider Return results from a specific ContentProvider
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
*
* @return Example {@link Example}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, contentProvider, useCanonical")
public static Example getTopExample(String word, String contentProvider, String useCanonical) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/topExample";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( contentProvider != null) {
queryParams.put("contentProvider", contentProvider);
}
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
Example responseObject = (Example)deserialize(response, Example.class);
return responseObject;
}
/**
* Return related words (thesaurus data) for a word
* @param wordRelatedInput
*
* @return List<Related> {@link Related}
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No definitions found.
*/
@MethodArgumentNames(value="wordRelatedInput")
public static List<Related> getRelatedWords(WordRelatedInput wordRelatedInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/related";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordRelatedInput != null && wordRelatedInput.getPartOfSpeech() != null) {
queryParams.put("partOfSpeech", wordRelatedInput.getPartOfSpeech());
}
if( wordRelatedInput != null && wordRelatedInput.getSourceDictionary() != null) {
queryParams.put("sourceDictionary", wordRelatedInput.getSourceDictionary());
}
if( wordRelatedInput != null && wordRelatedInput.getLimit() != null) {
queryParams.put("limit", wordRelatedInput.getLimit());
}
if( wordRelatedInput != null && wordRelatedInput.getUseCanonical() != null) {
queryParams.put("useCanonical", wordRelatedInput.getUseCanonical());
}
if( wordRelatedInput != null && wordRelatedInput.getType() != null) {
queryParams.put("type", wordRelatedInput.getType());
}
if( wordRelatedInput != null && wordRelatedInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordRelatedInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<Related>> typeRef = new TypeReference<ArrayList<Related>>() {
};
try {
List<Related> responseObject = (List<Related>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Fetches bi-gram phrases for a word
* @param word Word to fetch phrases for
* @param limit Maximum number of results to return
* @param wlmi Minimum WLMI for the phrase
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
*
* @return List<Bigram> {@link Bigram}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, limit, wlmi, useCanonical")
public static List<Bigram> getPhrases(String word, String limit, String wlmi, String useCanonical) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/phrases";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( limit != null) {
queryParams.put("limit", limit);
}
if( wlmi != null) {
queryParams.put("wlmi", wlmi);
}
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<Bigram>> typeRef = new TypeReference<ArrayList<Bigram>>() {
};
try {
List<Bigram> responseObject = (List<Bigram>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Returns syllable information for a word
* @param word Word to get syllables for
* @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
* @param sourceDictionary Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.
* @param limit Maximum number of results to return
*
* @return List<Syllable> {@link Syllable}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, useCanonical, sourceDictionary, limit")
public static List<Syllable> getHyphenation(String word, String useCanonical, String sourceDictionary, String limit) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/hyphenation";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( sourceDictionary != null) {
queryParams.put("sourceDictionary", sourceDictionary);
}
if( limit != null) {
queryParams.put("limit", limit);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<Syllable>> typeRef = new TypeReference<ArrayList<Syllable>>() {
};
try {
List<Syllable> responseObject = (List<Syllable>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Returns text pronunciations for a given word
* @param wordPronunciationsInput
*
* @return List<TextPron> {@link TextPron}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="wordPronunciationsInput")
public static List<TextPron> getTextPronunciations(WordPronunciationsInput wordPronunciationsInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/pronunciations";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordPronunciationsInput != null && wordPronunciationsInput.getUseCanonical() != null) {
queryParams.put("useCanonical", wordPronunciationsInput.getUseCanonical());
}
if( wordPronunciationsInput != null && wordPronunciationsInput.getSourceDictionary() != null) {
queryParams.put("sourceDictionary", wordPronunciationsInput.getSourceDictionary());
}
if( wordPronunciationsInput != null && wordPronunciationsInput.getTypeFormat() != null) {
queryParams.put("typeFormat", wordPronunciationsInput.getTypeFormat());
}
if( wordPronunciationsInput != null && wordPronunciationsInput.getLimit() != null) {
queryParams.put("limit", wordPronunciationsInput.getLimit());
}
if( wordPronunciationsInput != null && wordPronunciationsInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordPronunciationsInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<TextPron>> typeRef = new TypeReference<ArrayList<TextPron>>() {
};
try {
List<TextPron> responseObject = (List<TextPron>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Returns other forms of a word
* @param word Word to fetch forms for
* @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
*
* @return RelationshipMap {@link RelationshipMap}
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No results.
*/
@MethodArgumentNames(value="word, useCanonical")
public static RelationshipMap getWordForms(String word, String useCanonical) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/wordForms";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
RelationshipMap responseObject = (RelationshipMap)deserialize(response, RelationshipMap.class);
return responseObject;
}
/**
* Returns definitions for a word based on the sentence in which it is found
Use the offset parameter when the word occurs more than once in the sentence
* @param wordContextualLookupInput
*
* @return DefinitionSearchResults {@link DefinitionSearchResults}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="wordContextualLookupInput")
public static DefinitionSearchResults contextualLookup(WordContextualLookupInput wordContextualLookupInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/contextualLookup";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordContextualLookupInput != null && wordContextualLookupInput.getSentence() != null) {
queryParams.put("sentence", wordContextualLookupInput.getSentence());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getOffset() != null) {
queryParams.put("offset", wordContextualLookupInput.getOffset());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getExpandTerms() != null) {
queryParams.put("expandTerms", wordContextualLookupInput.getExpandTerms());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getIncludeSourceDictionaries() != null) {
queryParams.put("includeSourceDictionaries", wordContextualLookupInput.getIncludeSourceDictionaries());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getExcludeSourceDictionaries() != null) {
queryParams.put("excludeSourceDictionaries", wordContextualLookupInput.getExcludeSourceDictionaries());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getSkip() != null) {
queryParams.put("skip", wordContextualLookupInput.getSkip());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getLimit() != null) {
queryParams.put("limit", wordContextualLookupInput.getLimit());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordContextualLookupInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
return responseObject;
}
/**
* Returns definitions for a word based on the sentence in which it is found
Use the offset parameter when the word occurs more than once in the sentence
* @param postObject The sentence in which the word occurs
* @param wordContextualLookupInput
*
* @return DefinitionSearchResults {@link DefinitionSearchResults}
* @throws WordnikAPIException 400 - Invalid term supplied.
*/
@MethodArgumentNames(value="postObject, wordContextualLookupInput")
public static DefinitionSearchResults contextualLookupPost(String postObject, WordContextualLookupInput wordContextualLookupInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/contextualLookup";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordContextualLookupInput != null && wordContextualLookupInput.getOffset() != null) {
queryParams.put("offset", wordContextualLookupInput.getOffset());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getExpandTerms() != null) {
queryParams.put("expandTerms", wordContextualLookupInput.getExpandTerms());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getIncludeSourceDictionaries() != null) {
queryParams.put("includeSourceDictionaries", wordContextualLookupInput.getIncludeSourceDictionaries());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getExcludeSourceDictionaries() != null) {
queryParams.put("excludeSourceDictionaries", wordContextualLookupInput.getExcludeSourceDictionaries());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getSkip() != null) {
queryParams.put("skip", wordContextualLookupInput.getSkip());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getLimit() != null) {
queryParams.put("limit", wordContextualLookupInput.getLimit());
}
if( wordContextualLookupInput != null && wordContextualLookupInput.getWord() != null) {
resourcePath = resourcePath.replace("{word}", wordContextualLookupInput.getWord());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
return responseObject;
}
/**
* Returns Flickr images for a word
* @param word Word to get flickr images for.
* @param size Image size
* Allowed values are - thumb,small,med,lg,orig
* @param limit Maximum number of results to return
*
* @return List<Photo> {@link Photo}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, size, limit")
public static List<Photo> getFlickrImages(String word, String size, String limit) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/images/flickr";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( size != null) {
queryParams.put("size", size);
}
if( limit != null) {
queryParams.put("limit", limit);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<Photo>> typeRef = new TypeReference<ArrayList<Photo>>() {
};
try {
List<Photo> responseObject = (List<Photo>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
}

View File

@@ -0,0 +1,282 @@
package com.wordnik.api;
import com.wordnik.common.*;
import com.wordnik.common.ext.*;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.*;
import java.util.*;
import com.wordnik.annotations.MethodArgumentNames;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
/**
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordListAPI extends WordnikAPI {
/**
* Fetches a WordList by ID
* @param wordListId ID of WordList to fetch
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return WordList {@link WordList}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
*/
@MethodArgumentNames(value="wordListId, authToken")
public static WordList getWordListById(String wordListId, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListId != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListId);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordList responseObject = (WordList)deserialize(response, WordList.class);
return responseObject;
}
/**
* Fetches words in a WordList
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
* @param wordListWordsInput
*
* @return List<WordListWord> {@link WordListWord}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
*/
@MethodArgumentNames(value="authToken, wordListWordsInput")
public static List<WordListWord> getWordListWords(String authToken, WordListWordsInput wordListWordsInput) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}/words";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListWordsInput != null && wordListWordsInput.getSortBy() != null) {
queryParams.put("sortBy", wordListWordsInput.getSortBy());
}
if( wordListWordsInput != null && wordListWordsInput.getSortOrder() != null) {
queryParams.put("sortOrder", wordListWordsInput.getSortOrder());
}
if( wordListWordsInput != null && wordListWordsInput.getSkip() != null) {
queryParams.put("skip", wordListWordsInput.getSkip());
}
if( wordListWordsInput != null && wordListWordsInput.getLimit() != null) {
queryParams.put("limit", wordListWordsInput.getLimit());
}
if( wordListWordsInput != null && wordListWordsInput.getWordListId() != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListWordsInput.getWordListId());
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordListWord>> typeRef = new TypeReference<ArrayList<WordListWord>>() {
};
try {
List<WordListWord> responseObject = (List<WordListWord>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Adds words to a WordList
* @param wordListId ID of WordList to user
* @param postObject Words to add to WordList
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
*/
@MethodArgumentNames(value="wordListId, postObject, authToken")
public static void addWordsToWordList(String wordListId, StringValue[] postObject, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}/words";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListId != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListId);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
}
/**
* Updates an existing WordList
* @param wordListId ID of WordList to update
* @param postObject Updated WordList
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to update WordList 404 - WordList not found
*/
@MethodArgumentNames(value="wordListId, postObject, authToken")
public static void updateWordList(String wordListId, WordList postObject, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}";
resourcePath = resourcePath.replace("{format}","json");
String method = "PUT";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListId != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListId);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
}
/**
* Deletes an existing WordList
* @param wordListId ID of WordList to delete
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to delete WordList 404 - WordList not found
*/
@MethodArgumentNames(value="wordListId, authToken")
public static void deleteWordList(String wordListId, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}";
resourcePath = resourcePath.replace("{format}","json");
String method = "DELETE";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListId != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListId);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
}
/**
* Removes words from a WordList
* @param wordListId ID of WordList to use
* @param postObject Words to remove from WordList
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to modify WordList 404 - WordList not found
*/
@MethodArgumentNames(value="wordListId, postObject, authToken")
public static void deleteWordsFromWordList(String wordListId, StringValue[] postObject, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordList.{format}/{wordListId}/deleteWords";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordListId != null) {
resourcePath = resourcePath.replace("{wordListId}", wordListId);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
}
}

View File

@@ -0,0 +1,94 @@
package com.wordnik.api;
import com.wordnik.common.*;
import com.wordnik.common.ext.*;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.*;
import java.util.*;
import com.wordnik.annotations.MethodArgumentNames;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
/**
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordListsAPI extends WordnikAPI {
/**
* Returns information about API parameters
*
* @return Doc {@link Doc}
* @throws WordnikAPIException 404 - No data available
*/
public static Doc getHelp() throws WordnikAPIException {
//parse inputs
String resourcePath = "/wordLists.{format}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
Doc responseObject = (Doc)deserialize(response, Doc.class);
return responseObject;
}
/**
* Creates a WordList.
* @param postObject WordList to create
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
*
* @return WordList {@link WordList}
* @throws WordnikAPIException 400 - Invalid WordList supplied or mandatory fields are missing. 403 - Not authenticated. 404 - WordList owner not found.
*/
@MethodArgumentNames(value="postObject, authToken")
public static WordList createWordList(WordList postObject, String authToken) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/wordLists.{format}";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordList responseObject = (WordList)deserialize(response, WordList.class);
return responseObject;
}
}

View File

@@ -0,0 +1,848 @@
package com.wordnik.api;
import com.wordnik.common.*;
import com.wordnik.common.ext.*;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.*;
import java.util.*;
import com.wordnik.annotations.MethodArgumentNames;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
/**
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsAPI extends WordnikAPI {
/**
* Returns a single random WordObject, in the format specified by the URL
* @param wordsRandomWordInput
*
* @return WordObject {@link WordObject}
* @throws WordnikAPIException 404 - No word found.
*/
@MethodArgumentNames(value="wordsRandomWordInput")
public static WordObject getRandomWord(WordsRandomWordInput wordsRandomWordInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/randomWord";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordsRandomWordInput != null && wordsRandomWordInput.getHasDictionaryDef() != null) {
queryParams.put("hasDictionaryDef", wordsRandomWordInput.getHasDictionaryDef());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getIncludePartOfSpeech() != null) {
queryParams.put("includePartOfSpeech", wordsRandomWordInput.getIncludePartOfSpeech());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getExcludePartOfSpeech() != null) {
queryParams.put("excludePartOfSpeech", wordsRandomWordInput.getExcludePartOfSpeech());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinCorpusCount() != null) {
queryParams.put("minCorpusCount", wordsRandomWordInput.getMinCorpusCount());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxCorpusCount() != null) {
queryParams.put("maxCorpusCount", wordsRandomWordInput.getMaxCorpusCount());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinDictionaryCount() != null) {
queryParams.put("minDictionaryCount", wordsRandomWordInput.getMinDictionaryCount());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxDictionaryCount() != null) {
queryParams.put("maxDictionaryCount", wordsRandomWordInput.getMaxDictionaryCount());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinLength() != null) {
queryParams.put("minLength", wordsRandomWordInput.getMinLength());
}
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxLength() != null) {
queryParams.put("maxLength", wordsRandomWordInput.getMaxLength());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordObject responseObject = (WordObject)deserialize(response, WordObject.class);
return responseObject;
}
/**
* Returns an array of random WordObjects, in the format specified by the URL
* @param wordsRandomWordsInput
*
* @return List<WordObject> {@link WordObject}
* @throws WordnikAPIException 400 - Invalid term supplied. 404 - No results.
*/
@MethodArgumentNames(value="wordsRandomWordsInput")
public static List<WordObject> getRandomWords(WordsRandomWordsInput wordsRandomWordsInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/randomWords";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getHasDictionaryDef() != null) {
queryParams.put("hasDictionaryDef", wordsRandomWordsInput.getHasDictionaryDef());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getIncludePartOfSpeech() != null) {
queryParams.put("includePartOfSpeech", wordsRandomWordsInput.getIncludePartOfSpeech());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getExcludePartOfSpeech() != null) {
queryParams.put("excludePartOfSpeech", wordsRandomWordsInput.getExcludePartOfSpeech());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinCorpusCount() != null) {
queryParams.put("minCorpusCount", wordsRandomWordsInput.getMinCorpusCount());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxCorpusCount() != null) {
queryParams.put("maxCorpusCount", wordsRandomWordsInput.getMaxCorpusCount());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinDictionaryCount() != null) {
queryParams.put("minDictionaryCount", wordsRandomWordsInput.getMinDictionaryCount());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxDictionaryCount() != null) {
queryParams.put("maxDictionaryCount", wordsRandomWordsInput.getMaxDictionaryCount());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinLength() != null) {
queryParams.put("minLength", wordsRandomWordsInput.getMinLength());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxLength() != null) {
queryParams.put("maxLength", wordsRandomWordsInput.getMaxLength());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getSortBy() != null) {
queryParams.put("sortBy", wordsRandomWordsInput.getSortBy());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getSortOrder() != null) {
queryParams.put("sortOrder", wordsRandomWordsInput.getSortOrder());
}
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getLimit() != null) {
queryParams.put("limit", wordsRandomWordsInput.getLimit());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordObject>> typeRef = new TypeReference<ArrayList<WordObject>>() {
};
try {
List<WordObject> responseObject = (List<WordObject>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Searches words.
* @param wordsSearchInput
*
* @return List<WordFrequency> {@link WordFrequency}
* @throws WordnikAPIException 400 - Invalid term supplied. 404 - No results.
*/
@MethodArgumentNames(value="wordsSearchInput")
public static List<WordFrequency> searchWords(WordsSearchInput wordsSearchInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/search";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordsSearchInput != null && wordsSearchInput.getQuery() != null) {
queryParams.put("query", wordsSearchInput.getQuery());
}
if( wordsSearchInput != null && wordsSearchInput.getCaseSensitive() != null) {
queryParams.put("caseSensitive", wordsSearchInput.getCaseSensitive());
}
if( wordsSearchInput != null && wordsSearchInput.getIncludePartOfSpeech() != null) {
queryParams.put("includePartOfSpeech", wordsSearchInput.getIncludePartOfSpeech());
}
if( wordsSearchInput != null && wordsSearchInput.getExcludePartOfSpeech() != null) {
queryParams.put("excludePartOfSpeech", wordsSearchInput.getExcludePartOfSpeech());
}
if( wordsSearchInput != null && wordsSearchInput.getMinCorpusCount() != null) {
queryParams.put("minCorpusCount", wordsSearchInput.getMinCorpusCount());
}
if( wordsSearchInput != null && wordsSearchInput.getMaxCorpusCount() != null) {
queryParams.put("maxCorpusCount", wordsSearchInput.getMaxCorpusCount());
}
if( wordsSearchInput != null && wordsSearchInput.getMinDictionaryCount() != null) {
queryParams.put("minDictionaryCount", wordsSearchInput.getMinDictionaryCount());
}
if( wordsSearchInput != null && wordsSearchInput.getMaxDictionaryCount() != null) {
queryParams.put("maxDictionaryCount", wordsSearchInput.getMaxDictionaryCount());
}
if( wordsSearchInput != null && wordsSearchInput.getMinLength() != null) {
queryParams.put("minLength", wordsSearchInput.getMinLength());
}
if( wordsSearchInput != null && wordsSearchInput.getMaxLength() != null) {
queryParams.put("maxLength", wordsSearchInput.getMaxLength());
}
if( wordsSearchInput != null && wordsSearchInput.getSkip() != null) {
queryParams.put("skip", wordsSearchInput.getSkip());
}
if( wordsSearchInput != null && wordsSearchInput.getLimit() != null) {
queryParams.put("limit", wordsSearchInput.getLimit());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordFrequency>> typeRef = new TypeReference<ArrayList<WordFrequency>>() {
};
try {
List<WordFrequency> responseObject = (List<WordFrequency>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Fetches an array of WordOfTheDayList basd on a criteria
* @param containsWord Lists must contain a specific word
* @param subscriberCount Lists must have the specified number of subscribers
* @param itemCount Lists must have the specified number of items
* @param includeAll Returns future WordOfTheDay items
*
* @return List<WordOfTheDayList> {@link WordOfTheDayList}
* @throws WordnikAPIException 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="containsWord, subscriberCount, itemCount, includeAll")
public static List<WordOfTheDayList> getWordOfTheDayListsContainingWord(String containsWord, String subscriberCount, String itemCount, String includeAll) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayLists";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( containsWord != null) {
queryParams.put("containsWord", containsWord);
}
if( subscriberCount != null) {
queryParams.put("subscriberCount", subscriberCount);
}
if( itemCount != null) {
queryParams.put("itemCount", itemCount);
}
if( includeAll != null) {
queryParams.put("includeAll", includeAll);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordOfTheDayList>> typeRef = new TypeReference<ArrayList<WordOfTheDayList>>() {
};
try {
List<WordOfTheDayList> responseObject = (List<WordOfTheDayList>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Fetches WordOfTheDay objects for a specific date
* @param date ID of WordOfTheDayList
* @param includeAll Returns future WordOfTheDay items
*
* @return List<WordOfTheDay> {@link WordOfTheDay}
* @throws WordnikAPIException 400 - Invalid ID supplied 404 - WordOfTheDayList or User not found
*/
@MethodArgumentNames(value="date, includeAll")
public static List<WordOfTheDay> getWordOfTheDayListsForDate(String date, String includeAll) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayLists/{date}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( includeAll != null) {
queryParams.put("includeAll", includeAll);
}
if( date != null) {
resourcePath = resourcePath.replace("{date}", date);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordOfTheDay>> typeRef = new TypeReference<ArrayList<WordOfTheDay>>() {
};
try {
List<WordOfTheDay> responseObject = (List<WordOfTheDay>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Subscribes a user to a WordOfTheDayList
* @param authToken auth_token of logged-in user
* @param permalink ID of WordOfTheDayList
* @param medium Medium to subscribe with
* @param postObject Username to subscribe
*
* @return void {@link Void}
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not authorized to subscribe 404 - WordOfTheDayList or User not found
*/
@MethodArgumentNames(value="authToken, permalink, medium, postObject")
public static void subscribeToList(String authToken, String permalink, String medium, String postObject) throws WordnikAPIException {
if(authToken == null || authToken.length() == 0) {
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
}
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}/subscription";
resourcePath = resourcePath.replace("{format}","json");
String method = "POST";
Map<String, String> queryParams = new HashMap<String, String>();
if( medium != null) {
queryParams.put("medium", medium);
}
if( permalink != null) {
resourcePath = resourcePath.replace("{permalink}", permalink);
}
//make the API Call
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
//create output objects if the response has more than one object
}
/**
* Searches definitions.
* @param wordsSearchDefinitionsInput
*
* @return DefinitionSearchResults {@link DefinitionSearchResults}
* @throws WordnikAPIException 400 - Invalid term supplied.
*/
@MethodArgumentNames(value="wordsSearchDefinitionsInput")
public static DefinitionSearchResults searchDefinitions(WordsSearchDefinitionsInput wordsSearchDefinitionsInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/searchDefinitions";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getQuery() != null) {
queryParams.put("query", wordsSearchDefinitionsInput.getQuery());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getDefinedWordSearchTerm() != null) {
queryParams.put("definedWordSearchTerm", wordsSearchDefinitionsInput.getDefinedWordSearchTerm());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludeSourceDictionaries() != null) {
queryParams.put("includeSourceDictionaries", wordsSearchDefinitionsInput.getIncludeSourceDictionaries());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExcludeSourceDictionaries() != null) {
queryParams.put("excludeSourceDictionaries", wordsSearchDefinitionsInput.getExcludeSourceDictionaries());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludePartOfSpeech() != null) {
queryParams.put("includePartOfSpeech", wordsSearchDefinitionsInput.getIncludePartOfSpeech());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExcludePartOfSpeech() != null) {
queryParams.put("excludePartOfSpeech", wordsSearchDefinitionsInput.getExcludePartOfSpeech());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMinCorpusCount() != null) {
queryParams.put("minCorpusCount", wordsSearchDefinitionsInput.getMinCorpusCount());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMaxCorpusCount() != null) {
queryParams.put("maxCorpusCount", wordsSearchDefinitionsInput.getMaxCorpusCount());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMinLength() != null) {
queryParams.put("minLength", wordsSearchDefinitionsInput.getMinLength());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMaxLength() != null) {
queryParams.put("maxLength", wordsSearchDefinitionsInput.getMaxLength());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExpandTerms() != null) {
queryParams.put("expandTerms", wordsSearchDefinitionsInput.getExpandTerms());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getWordTypes() != null) {
queryParams.put("wordTypes", wordsSearchDefinitionsInput.getWordTypes());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludeTags() != null) {
queryParams.put("includeTags", wordsSearchDefinitionsInput.getIncludeTags());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSortBy() != null) {
queryParams.put("sortBy", wordsSearchDefinitionsInput.getSortBy());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSortOrder() != null) {
queryParams.put("sortOrder", wordsSearchDefinitionsInput.getSortOrder());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSkip() != null) {
queryParams.put("skip", wordsSearchDefinitionsInput.getSkip());
}
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getLimit() != null) {
queryParams.put("limit", wordsSearchDefinitionsInput.getLimit());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
return responseObject;
}
/**
* Searches dictionary entries.
* @param query Search term
* @param skip Results to skip
* Allowed values are - 0 to 1000
* @param limit Maximum number of results to return
* Allowed values are - 1 to 1000
*
* @return EntrySearchResults {@link EntrySearchResults}
* @throws WordnikAPIException 400 - Invalid term supplied.
*/
@MethodArgumentNames(value="query, skip, limit")
public static EntrySearchResults searchEntries(String query, String skip, String limit) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/searchEntries";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( query != null) {
queryParams.put("query", query);
}
if( skip != null) {
queryParams.put("skip", skip);
}
if( limit != null) {
queryParams.put("limit", limit);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
EntrySearchResults responseObject = (EntrySearchResults)deserialize(response, EntrySearchResults.class);
return responseObject;
}
/**
* Fetches surface forms of a word
* @param term Word to get surface forms for.
*
* @return String {@link String}
* @throws WordnikAPIException 400 - Invalid term supplied.
*/
@MethodArgumentNames(value="term")
public static String getSurfaceForms(String term) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/surfaceForms";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( term != null) {
queryParams.put("term", term);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
String responseObject = (String)deserialize(response, String.class);
return responseObject;
}
/**
* Returns a specific WordOfTheDay
* @param date Fetches by date in yyyy-MM-dd
* @param category Filters response by category
* @param creator Filters response by username
*
* @return WordOfTheDay {@link WordOfTheDay}
* @throws WordnikAPIException 404 - No data available
*/
@MethodArgumentNames(value="date, category, creator")
public static WordOfTheDay getWordOfTheDay(String date, String category, String creator) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDay";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( date != null) {
queryParams.put("date", date);
}
if( category != null) {
queryParams.put("category", category);
}
if( creator != null) {
queryParams.put("creator", creator);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordOfTheDay responseObject = (WordOfTheDay)deserialize(response, WordOfTheDay.class);
return responseObject;
}
/**
* Returns a WordOfTheDay range
* @param wordsWordOfTheDayInputRangeInput
*
* @return List<WordOfTheDay> {@link WordOfTheDay}
* @throws WordnikAPIException 404 - No data available
*/
@MethodArgumentNames(value="wordsWordOfTheDayInputRangeInput")
public static List<WordOfTheDay> getWordOfTheDayRange(WordsWordOfTheDayInputRangeInput wordsWordOfTheDayInputRangeInput) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDay/range";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getCategory() != null) {
queryParams.put("category", wordsWordOfTheDayInputRangeInput.getCategory());
}
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getCreator() != null) {
queryParams.put("creator", wordsWordOfTheDayInputRangeInput.getCreator());
}
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getProvider() != null) {
queryParams.put("provider", wordsWordOfTheDayInputRangeInput.getProvider());
}
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getSkip() != null) {
queryParams.put("skip", wordsWordOfTheDayInputRangeInput.getSkip());
}
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getLimit() != null) {
queryParams.put("limit", wordsWordOfTheDayInputRangeInput.getLimit());
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordOfTheDay>> typeRef = new TypeReference<ArrayList<WordOfTheDay>>() {
};
try {
List<WordOfTheDay> responseObject = (List<WordOfTheDay>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Fetches a WordOfTheDayList by ID
* @param permalink ID of WordOfTheDayList
* @param includeAll Returns future WordOfTheDay items
*
* @return WordOfTheDayList {@link WordOfTheDayList}
* @throws WordnikAPIException 400 - Invalid id supplied 404 - WordOfTheDayList not found
*/
@MethodArgumentNames(value="permalink, includeAll")
public static WordOfTheDayList getWordOfTheDayList(String permalink, String includeAll) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( includeAll != null) {
queryParams.put("includeAll", includeAll);
}
if( permalink != null) {
resourcePath = resourcePath.replace("{permalink}", permalink);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordOfTheDayList responseObject = (WordOfTheDayList)deserialize(response, WordOfTheDayList.class);
return responseObject;
}
/**
* Fetches a WordOfTheDayList by ID
* @param permalink ID of WordOfTheDayList
* @param specifier Specifier for the item to fetch. Either 'current' or a date.
*
* @return WordOfTheDay {@link WordOfTheDay}
* @throws WordnikAPIException 400 - Invalid id supplied 404 - WordOfTheDayList not found
*/
@MethodArgumentNames(value="permalink, specifier")
public static WordOfTheDay getWordOfTheDayListItem(String permalink, String specifier) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}/{specifier}";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( permalink != null) {
resourcePath = resourcePath.replace("{permalink}", permalink);
}
if( specifier != null) {
resourcePath = resourcePath.replace("{specifier}", specifier);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
WordOfTheDay responseObject = (WordOfTheDay)deserialize(response, WordOfTheDay.class);
return responseObject;
}
/**
* Fetches recently created WordOfTheDayLists
* @param skip Results to skip
* @param limit Maximum number of results to return
*
* @return List<WordOfTheDayList> {@link WordOfTheDayList}
* @throws WordnikAPIException 404 - No WordOfTheDayLists found.
*/
@MethodArgumentNames(value="skip, limit")
public static List<WordOfTheDayList> getRecentWordOfTheDayLists(String skip, String limit) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayLists/recent";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( skip != null) {
queryParams.put("skip", skip);
}
if( limit != null) {
queryParams.put("limit", limit);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference<ArrayList<WordOfTheDayList>> typeRef = new TypeReference<ArrayList<WordOfTheDayList>>() {
};
try {
List<WordOfTheDayList> responseObject = (List<WordOfTheDayList>) mapper.readValue(response, typeRef);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, typeRef.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* Returns whether or not a subscription process has been run.
Uses the current server time (day resolution) as the default date to check for, optionally a dateString can be supplied for a specific date to check for.
* @param date Date string to fetch for.
*
* @return String {@link String}
* @throws WordnikAPIException 400 - Invalid date format supplied.
*/
@MethodArgumentNames(value="date")
public static String getWordOfTheDayListSubscriptionProcessStatus(String date) throws WordnikAPIException {
//parse inputs
String resourcePath = "/words.{format}/wordOfTheDayLists/subscriptionProcess";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( date != null) {
queryParams.put("date", date);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
String responseObject = (String)deserialize(response, String.class);
return responseObject;
}
}

View File

@@ -0,0 +1,11 @@
package com.wordnik.common;
/**
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 7/5/11
* Time: 6:09 PM
* To change this template use File | Settings | File Templates.
*/
public class Size {
}

View File

@@ -0,0 +1,22 @@
package com.wordnik.common;
/**
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 4/12/11
* Time: 5:46 PM
* To change this template use File | Settings | File Templates.
*/
public class StringValue {
String word;
public String getWord() {
return word;
}
public void setWord(String value) {
this.word = value;
}
}

View File

@@ -0,0 +1,15 @@
package com.wordnik.common;
/**
* This is a model class tht needs to be generated by the system.
* APIs use this class but REST documentation is not returning model object for this class, hence we created dummy version
* REMOVE this class after API documentation is fixed.
* @author ramesh
*
*/
public class WordListType {
public WordListType() {
}
}

View File

@@ -0,0 +1,218 @@
package com.wordnik.common;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.ws.rs.core.MultivaluedMap;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.SerializationConfig;
import org.codehaus.jackson.type.TypeReference;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.WebResource.Builder;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.exception.WordnikExceptionCodes;
/**
* Provides way to initialize the communication with Wordnik API server.
* This is also a Base class for all API classes
* @author ramesh
*
*/
public class WordnikAPI {
private static String apiServer = "http://api.wordnik.com/v4";
private static String apiKey = "";
private static boolean loggingEnabled;
private static Logger logger = null;
protected static String POST = "POST";
protected static String GET = "GET";
protected static String PUT = "PUT";
protected static String DELETE = "DELETE";
protected static ObjectMapper mapper = new ObjectMapper();
static{
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.getSerializationConfig().set(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(SerializationConfig.Feature.WRITE_NULL_PROPERTIES, false);
mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
}
/**
* Initializes the API communication with required inputs.
* @param apiKey provide the key provided as part of registration
* @param apiServer Sets the URL for the API server. It is defaulted to the server
* used while building the driver. This value should be provided while testing the APIs against
* test servers or if there is any changes in production server URLs.
* @param enableLogging This will enable the logging using Jersey logging filter. Refer the following documentation
* for more details. {@link LoggingFilter}. Default output is sent to system.out.
* Create a logger ({@link Logger} class and set using setLogger method.
*/
public static void initialize(String apiKey, String apiServer, boolean enableLogging) {
setApiKey(apiKey);
if(apiServer != null && apiServer.length() > 0) {
if(apiServer.substring(apiServer.length()-1).equals("/")){
apiServer = apiServer.substring(0, apiServer.length()-1);
}
setApiServer(apiServer);
}
loggingEnabled = enableLogging;
}
/**
* Set the logger instance used for Jersey logging.
* @param aLogger
*/
public static void setLogger(Logger aLogger) {
logger = aLogger;
}
/**
* Gets the API key used for server communication.
* This value is set using initialize method.
* @return
*/
public static String getApiKey() {
return apiKey;
}
private static void setApiKey(String apiKey) {
WordnikAPI.apiKey = apiKey;
}
/**
* Sets the URL for the API server. It is defaulted to the server used while building the driver.
* @return
*/
private static String getApiServer() {
return apiServer;
}
private static void setApiServer(String server) {
WordnikAPI.apiServer = server;
}
/**
* Invokes the API and returns the response as json string.
* This is an internal method called by individual APIs for communication. It sets the required HTTP headers
* based on API key and auth token.
* @param authToken - token that is received as part of authentication call. This is only needed for the calls that are secure.
* @param resourceURL - URL for the rest resource
* @param method - Method we should use for communicating to the back end.
* @param postObject - if the method is POST, provide the object that should be sent as part of post request.
* @return JSON response of the API call.
* @throws WordnikAPIException if the call to API server fails.
*/
protected static String invokeAPI(String authToken, String resourceURL, String method, Map<String,
String> queryParams, Object postObject) throws WordnikAPIException {
Client apiClient = Client.create();
//check for app key and server values
if(getApiKey() == null || getApiKey().length() == 0) {
String[] args = {getApiKey()};
throw new WordnikAPIException(WordnikExceptionCodes.API_KEY_NOT_VALID, args);
}
if(getApiServer() == null || getApiServer().length() == 0) {
String[] args = {getApiServer()};
throw new WordnikAPIException(WordnikExceptionCodes.API_SERVER_NOT_VALID, args);
}
//initialize the logger if needed
if(loggingEnabled) {
if(logger == null) {
apiClient.addFilter(new LoggingFilter());
}else{
apiClient.addFilter(new LoggingFilter(logger));
}
}
//make the communication
resourceURL = getApiServer() + resourceURL;
if(queryParams.keySet().size() > 0){
int i=0;
for(String paramName : queryParams.keySet()){
String symbol = "&";
if(i==0){
symbol = "?";
}
resourceURL = resourceURL + symbol + paramName + "=" + queryParams.get(paramName);
i++;
}
}
WebResource aResource = apiClient.resource(resourceURL);
// aResource.queryParams(queryParams);
//set the required HTTP headers
Builder builder = aResource.type("application/json");
builder.header("api_key", getApiKey());
if(authToken != null){
builder.header("auth_token", authToken);
}
ClientResponse clientResponse = null;
if(method.equals(GET)) {
clientResponse = builder.get(ClientResponse.class);
}else if (method.equals(POST)) {
clientResponse = builder.post(ClientResponse.class, serialize(postObject));
}else if (method.equals(PUT)) {
clientResponse = builder.put(ClientResponse.class, serialize(postObject));
}else if (method.equals(DELETE)) {
clientResponse = builder.delete(ClientResponse.class);
}
//process the response
if(clientResponse.getClientResponseStatus() == ClientResponse.Status.OK) {
String response = clientResponse.getEntity(String.class);
return response;
}else{
int responseCode = clientResponse.getClientResponseStatus().getStatusCode() ;
throw new WordnikAPIException(responseCode, clientResponse.getEntity(String.class));
}
}
/**
* De-serialize the object from String to object of type input class name.
* @param response
* @param inputClassName
* @return
*/
public static Object deserialize(String response, Class inputClassName) throws WordnikAPIException {
try {
System.out.println("Input :::::" + response);
Object responseObject = mapper.readValue(response, inputClassName);
return responseObject;
} catch (IOException ioe) {
String[] args = new String[]{response, inputClassName.toString()};
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in coversting response json value to java object : " + ioe.getMessage(), ioe);
}
}
/**
* serialize the object from String to input object.
* @param input
* @return
*/
public static String serialize(Object input) throws WordnikAPIException {
try {
if(input != null) {
return mapper.writeValueAsString(input);
}else{
return "";
}
} catch (IOException ioe) {
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JAVA_TO_JSON, "Error in coverting input java to json : " + ioe.getMessage(), ioe);
}
}
}

View File

@@ -0,0 +1,11 @@
package com.wordnik.common;
/**
* This is super class of all the model classes.
* Any common attributes or methods across all model objects can be added here
* @author ramesh
*
*/
public class WordnikObject {
}

View File

@@ -0,0 +1,14 @@
package com.wordnik.common;
/**
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 4/14/11
* Time: 9:51 AM
* To change this template use File | Settings | File Templates.
*/
public class WordnikOutputObject {
// public WordnikObject deserializeToOutput
}

View File

@@ -0,0 +1,132 @@
package com.wordnik.common.ext;
import com.wordnik.annotations.MethodArgumentNames;
import com.wordnik.common.WordnikAPI;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.exception.WordnikExceptionCodes;
import com.wordnik.model.AudioFile;
import com.wordnik.model.FrequencySummary;
import com.wordnik.model.GetFrequencyOutput;
import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jackson.type.TypeReference;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class is written to provide implementations for some of the methods that are not possible from code generation.
* Example: For getting the word frequency we have the possiblity of to output bsed on the type of input, this will be
* difficult to model with code generation hence the overwriten calls is provided and the ode generation ignores
* these methods while generating the code.
* User: ramesh
* Date: 4/26/11
* Time: 7:51 AM
*/
public abstract class AbstractWordAPI extends WordnikAPI {
/**
* Fetches audio metadata for a word.
*
* The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API.
* Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported.
*
* @param word Word to get audio for.
* @param useCanonical Use the canonical form of the word.
* @param limit Maximum number of results to return
*
* @return GetAudioOutput {@link com.wordnik.model.AudioFile}
* @throws com.wordnik.exception.WordnikAPIException 400 - Invalid word supplied. 400 - Invalid word supplied.
*/
@MethodArgumentNames(value="word, useCanonical, limit")
public static List<AudioFile> getAudio(String word, String useCanonical, String limit) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/audio";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( limit != null) {
queryParams.put("limit", limit);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
TypeReference ref = new TypeReference<List<AudioFile>>() { };
try {
List<AudioFile> responseObject = (List<AudioFile>)mapper.readValue(response, TypeFactory.type(ref));
return responseObject;
}catch(Exception e){
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, e.getMessage());
}
}
/**
* Returns word usage over tim
*
* @param word Word to return
*
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns
* exactly what was requested.
*
* @param startYear Starting Year
*
* @param endYear Ending Year
*
* @return GetFrequencyOutput {@link com.wordnik.model.GetFrequencyOutput}
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No results. 400 - Invalid word supplied. 404 - No results.
*/
@MethodArgumentNames(value="word, useCanonical, startYear, endYear")
public static FrequencySummary getWordFrequency(String word, String useCanonical, String startYear,
String endYear) throws WordnikAPIException {
//parse inputs
String resourcePath = "/word.{format}/{word}/frequency";
resourcePath = resourcePath.replace("{format}","json");
String method = "GET";
Map<String, String> queryParams = new HashMap<String, String>();
if( useCanonical != null) {
queryParams.put("useCanonical", useCanonical);
}
if( startYear != null) {
queryParams.put("startYear", startYear);
}
if( endYear != null) {
queryParams.put("endYear", endYear);
}
if( word != null) {
resourcePath = resourcePath.replace("{word}", word);
}
//make the API Call
String response = invokeAPI(null, resourcePath, method, queryParams, null);
//create output objects if the response has more than one object
if(response == null || response.length() == 0){
return null;
}
FrequencySummary responseObject = (FrequencySummary)deserialize(response, FrequencySummary.class);
return responseObject;
}
}

View File

@@ -0,0 +1,25 @@
package com.wordnik.exception;
/**
* Exception raised while generating code for java driver.
* User: ramesh
* Date: 3/31/11
* Time: 9:29 AM
*/
public class CodeGenerationException extends RuntimeException {
private String message;
public CodeGenerationException(String message){
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@@ -0,0 +1,89 @@
package com.wordnik.exception;
import java.util.List;
import com.sun.jersey.api.client.ClientResponse;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonMethod;
import org.codehaus.jackson.annotate.JsonProperty;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
/**
* Exception that is thrown if there are any issues in invoking Wordnik API.
*
* Each exception carries a code and message. Code can be either HTTP error response code {@link ClientResponse.Status}
* or The list of possible Wordnik exception code that are listed in the interface {@link WordnikExceptionCodes}.
* User: ramesh
* Date: 3/31/11
* Time: 9:27 AM
*/
public class WordnikAPIException extends Exception {
private String message;
private int code;
private String[] args;
@JsonCreator
public WordnikAPIException() {
}
public WordnikAPIException(String message) {
super(message);
}
public WordnikAPIException(int code) {
this.code = code;
}
public WordnikAPIException(int code, String message, Throwable t) {
super(message, t);
this.message = message;
this.code = code;
}
public WordnikAPIException(int code, String[] args, String message, Throwable t) {
super(message, t);
this.message = message;
this.code = code;
this.args = args;
}
public WordnikAPIException(int code, String message) {
super(message);
this.message = message;
this.code = code;
}
public WordnikAPIException(int code, String[] args, String message) {
super(message);
this.message = message;
this.code = code;
this.args = args;
}
public WordnikAPIException(int code, String[] args) {
this.code = code;
this.args = args;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}

View File

@@ -0,0 +1,38 @@
package com.wordnik.exception;
/**
* Lists all the possible exception codes
* @author ramesh
*
*/
public interface WordnikExceptionCodes {
/**
* System exception.
*/
public static final int SYSTEM_EXCEPTION = 0;
/**
* With Arguments as current key.
*/
public static final int API_KEY_NOT_VALID = 1000;
/**
* With arguments as current token value
*/
public static final int AUTH_TOKEN_NOT_VALID = 1001;
/**
* With arguments as input JSON and output class anme
*/
public static final int ERROR_CONVERTING_JSON_TO_JAVA = 1002;
/**
* With arguments as JAVA class name
*/
public static final int ERROR_CONVERTING_JAVA_TO_JSON = 1003;
public static final int ERROR_FROM_WEBSERVICE_CALL = 1004;
/**
* With arguments as current API server name
*/
public static final int API_SERVER_NOT_VALID = 1005;
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ApiResponse extends WordnikObject {
//
private String message ;
//
private String type ;
//
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
//
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ApiTokenStatus extends WordnikObject {
//
private String token ;
//
private Long expiresInMillis ;
//
private Long totalRequests ;
//
private Long remainingCalls ;
//
private Long resetsInMillis ;
//
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
//
public Long getExpiresInMillis() {
return expiresInMillis;
}
public void setExpiresInMillis(Long expiresInMillis) {
this.expiresInMillis = expiresInMillis;
}
//
public Long getTotalRequests() {
return totalRequests;
}
public void setTotalRequests(Long totalRequests) {
this.totalRequests = totalRequests;
}
//
public Long getRemainingCalls() {
return remainingCalls;
}
public void setRemainingCalls(Long remainingCalls) {
this.remainingCalls = remainingCalls;
}
//
public Long getResetsInMillis() {
return resetsInMillis;
}
public void setResetsInMillis(Long resetsInMillis) {
this.resetsInMillis = resetsInMillis;
}
}

View File

@@ -0,0 +1,158 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.Date;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class AudioFile extends WordnikObject {
//
private Long id ;
//
private String description ;
//
private Double duration ;
//
private String word ;
//
private String createdBy ;
//
private Date createdAt ;
//
private int commentCount ;
//
private int voteCount ;
//
private float voteAverage ;
//
private float voteWeightedAverage ;
//
private String fileUrl ;
//
private String audioType ;
//
@Required
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
//
public Double getDuration() {
return duration;
}
public void setDuration(Double duration) {
this.duration = duration;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
//
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
//
public int getCommentCount() {
return commentCount;
}
public void setCommentCount(int commentCount) {
this.commentCount = commentCount;
}
//
public int getVoteCount() {
return voteCount;
}
public void setVoteCount(int voteCount) {
this.voteCount = voteCount;
}
//
public float getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage;
}
//
public float getVoteWeightedAverage() {
return voteWeightedAverage;
}
public void setVoteWeightedAverage(float voteWeightedAverage) {
this.voteWeightedAverage = voteWeightedAverage;
}
//
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
//
public String getAudioType() {
return audioType;
}
public void setAudioType(String audioType) {
this.audioType = audioType;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class AudioType extends WordnikObject {
//
private String name ;
//
private int id ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class AuthenticationToken extends WordnikObject {
//
private String token ;
//
private Long userId ;
//
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
//
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Bigram extends WordnikObject {
//
private Long count ;
//
private String gram1 ;
//
private String gram2 ;
//
private Double mi ;
//
private Double wlmi ;
//
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
//
public String getGram1() {
return gram1;
}
public void setGram1(String gram1) {
this.gram1 = gram1;
}
//
public String getGram2() {
return gram2;
}
public void setGram2(String gram2) {
this.gram2 = gram2;
}
//
public Double getMi() {
return mi;
}
public void setMi(Double mi) {
this.mi = mi;
}
//
public Double getWlmi() {
return wlmi;
}
public void setWlmi(Double wlmi) {
this.wlmi = wlmi;
}
}

View File

@@ -0,0 +1,34 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Category extends WordnikObject {
//
private String name ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Citation extends WordnikObject {
//
private String source ;
//
private String cite ;
//
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
//
public String getCite() {
return cite;
}
public void setCite(String cite) {
this.cite = cite;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ContentProvider extends WordnikObject {
//
private String name ;
//
private int id ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@@ -0,0 +1,179 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Definition extends WordnikObject {
//
private List<ExampleUsage> exampleUses = new ArrayList<ExampleUsage>();
//
private String word ;
//
private String text ;
//
private List<TextPron> textProns = new ArrayList<TextPron>();
//
private float score ;
//
private String partOfSpeech ;
//
private List<Note> notes = new ArrayList<Note>();
//
private List<Citation> citations = new ArrayList<Citation>();
//
private List<Related> relatedWords = new ArrayList<Related>();
//
private String sourceDictionary ;
//
private List<Label> labels = new ArrayList<Label>();
//
private String sequence ;
//
private String seqString ;
//
private String extendedText ;
//
public List<ExampleUsage> getExampleUses() {
return exampleUses;
}
public void setExampleUses(List<ExampleUsage> exampleUses) {
this.exampleUses = exampleUses;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
//
public List<TextPron> getTextProns() {
return textProns;
}
public void setTextProns(List<TextPron> textProns) {
this.textProns = textProns;
}
//
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
//
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
//
public List<Note> getNotes() {
return notes;
}
public void setNotes(List<Note> notes) {
this.notes = notes;
}
//
public List<Citation> getCitations() {
return citations;
}
public void setCitations(List<Citation> citations) {
this.citations = citations;
}
//
public List<Related> getRelatedWords() {
return relatedWords;
}
public void setRelatedWords(List<Related> relatedWords) {
this.relatedWords = relatedWords;
}
//
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
//
public List<Label> getLabels() {
return labels;
}
public void setLabels(List<Label> labels) {
this.labels = labels;
}
//
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
//
public String getSeqString() {
return seqString;
}
public void setSeqString(String seqString) {
this.seqString = seqString;
}
//
public String getExtendedText() {
return extendedText;
}
public void setExtendedText(String extendedText) {
this.extendedText = extendedText;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class DefinitionSearchResults extends WordnikObject {
//
private int totalResults ;
//
private List<Definition> results = new ArrayList<Definition>();
//
public int getTotalResults() {
return totalResults;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//
public List<Definition> getResults() {
return results;
}
public void setResults(List<Definition> results) {
this.results = results;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Doc extends WordnikObject {
//
private List<Endpoint> endPoints = new ArrayList<Endpoint>();
//
private List<Object> models = new ArrayList<Object>();
//
public List<Endpoint> getEndPoints() {
return endPoints;
}
public void setEndPoints(List<Endpoint> endPoints) {
this.endPoints = endPoints;
}
//
public List<Object> getModels() {
return models;
}
public void setModels(List<Object> models) {
this.models = models;
}
}

View File

@@ -0,0 +1,58 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Endpoint extends WordnikObject {
//
private String path ;
//
private String description ;
//
private List<Operation> operations = new ArrayList<Operation>();
//
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
//
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
//
public List<Operation> getOperations() {
return operations;
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
}

View File

@@ -0,0 +1,69 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class EntrySearchResult extends WordnikObject {
//
private List<Definition> definitions = new ArrayList<Definition>();
//
private String sourceDictionary ;
//
private String headWord ;
//
private Long entryId ;
//
public List<Definition> getDefinitions() {
return definitions;
}
public void setDefinitions(List<Definition> definitions) {
this.definitions = definitions;
}
//
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
//
public String getHeadWord() {
return headWord;
}
public void setHeadWord(String headWord) {
this.headWord = headWord;
}
//
public Long getEntryId() {
return entryId;
}
public void setEntryId(Long entryId) {
this.entryId = entryId;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class EntrySearchResults extends WordnikObject {
//
private int totalResults ;
//
private List<EntrySearchResult> searchResults = new ArrayList<EntrySearchResult>();
//
public int getTotalResults() {
return totalResults;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//
public List<EntrySearchResult> getSearchResults() {
return searchResults;
}
public void setSearchResults(List<EntrySearchResult> searchResults) {
this.searchResults = searchResults;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Error extends WordnikObject {
//
private String reason ;
//
private int code ;
//
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
//
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}

View File

@@ -0,0 +1,122 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Example extends WordnikObject {
//
private int year ;
//
private ContentProvider provider ;
//
private String url ;
//
private String word ;
//
private String text ;
//
private String title ;
//
private float rating ;
//
private Long exampleId ;
//
private Long documentId ;
//
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
//
public ContentProvider getProvider() {
return provider;
}
public void setProvider(ContentProvider provider) {
this.provider = provider;
}
//
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
//
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//
public float getRating() {
return rating;
}
public void setRating(float rating) {
this.rating = rating;
}
//
public Long getExampleId() {
return exampleId;
}
public void setExampleId(Long exampleId) {
this.exampleId = exampleId;
}
//
public Long getDocumentId() {
return documentId;
}
public void setDocumentId(Long documentId) {
this.documentId = documentId;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ExampleSearchResults extends WordnikObject {
//
private List<Facet> facets = new ArrayList<Facet>();
//
private List<Example> examples = new ArrayList<Example>();
//
public List<Facet> getFacets() {
return facets;
}
public void setFacets(List<Facet> facets) {
this.facets = facets;
}
//
public List<Example> getExamples() {
return examples;
}
public void setExamples(List<Example> examples) {
this.examples = examples;
}
}

View File

@@ -0,0 +1,34 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ExampleUsage extends WordnikObject {
//
private String text ;
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Facet extends WordnikObject {
//
private String name ;
//
private List<FacetValue> facetValues = new ArrayList<FacetValue>();
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public List<FacetValue> getFacetValues() {
return facetValues;
}
public void setFacetValues(List<FacetValue> facetValues) {
this.facetValues = facetValues;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class FacetValue extends WordnikObject {
//
private String value ;
//
private Long count ;
//
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
//
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Frequency extends WordnikObject {
//
private int year ;
//
private Long count ;
//
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
//
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class FrequencyElement extends WordnikObject {
//
private int year ;
//
private Double lowerWisker ;
//
private Double upperWisker ;
//
private Double lowerBox ;
//
private Double upperBox ;
//
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
//
public Double getLowerWisker() {
return lowerWisker;
}
public void setLowerWisker(Double lowerWisker) {
this.lowerWisker = lowerWisker;
}
//
public Double getUpperWisker() {
return upperWisker;
}
public void setUpperWisker(Double upperWisker) {
this.upperWisker = upperWisker;
}
//
public Double getLowerBox() {
return lowerBox;
}
public void setLowerBox(Double lowerBox) {
this.lowerBox = lowerBox;
}
//
public Double getUpperBox() {
return upperBox;
}
public void setUpperBox(Double upperBox) {
this.upperBox = upperBox;
}
}

View File

@@ -0,0 +1,69 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class FrequencySummary extends WordnikObject {
//
private String word ;
//
private Long totalCount ;
//
private List<Frequency> frequency = new ArrayList<Frequency>();
//
private int unknownYearCount ;
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
//
public List<Frequency> getFrequency() {
return frequency;
}
public void setFrequency(List<Frequency> frequency) {
this.frequency = frequency;
}
//
public int getUnknownYearCount() {
return unknownYearCount;
}
public void setUnknownYearCount(int unknownYearCount) {
this.unknownYearCount = unknownYearCount;
}
}

View File

@@ -0,0 +1,36 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class FrequencySummaryE extends WordnikObject {
//
private List<FrequencyElement> elements = new ArrayList<FrequencyElement>();
//
public List<FrequencyElement> getElements() {
return elements;
}
public void setElements(List<FrequencyElement> elements) {
this.elements = elements;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class GetFrequencyOutput extends WordnikObject {
//
private FrequencySummary frequencySummary ;
//
private FrequencySummaryE frequencySummaryE ;
//
public FrequencySummary getFrequencySummary() {
return frequencySummary;
}
public void setFrequencySummary(FrequencySummary frequencySummary) {
this.frequencySummary = frequencySummary;
}
//
public FrequencySummaryE getFrequencySummaryE() {
return frequencySummaryE;
}
public void setFrequencySummaryE(FrequencySummaryE frequencySummaryE) {
this.frequencySummaryE = frequencySummaryE;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Label extends WordnikObject {
//
private String type ;
//
private String text ;
//
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View File

@@ -0,0 +1,69 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Note extends WordnikObject {
//Contains the type of note
private String noteType ;
//
private int pos ;
//
private String value ;
//
private List<String> appliesTo = new ArrayList<String>();
//Contains the type of note
@AllowableValues(value="x, y, z")
public String getNoteType() {
return noteType;
}
public void setNoteType(String noteType) {
this.noteType = noteType;
}
//
public int getPos() {
return pos;
}
public void setPos(int pos) {
this.pos = pos;
}
//
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
//
public List<String> getAppliesTo() {
return appliesTo;
}
public void setAppliesTo(List<String> appliesTo) {
this.appliesTo = appliesTo;
}
}

View File

@@ -0,0 +1,58 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Object extends WordnikObject {
//
private String name ;
//
private List<Parameter> fields = new ArrayList<Parameter>();
//
private String uniqueFieldName ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public List<Parameter> getFields() {
return fields;
}
public void setFields(List<Parameter> fields) {
this.fields = fields;
}
//
public String getUniqueFieldName() {
return uniqueFieldName;
}
public void setUniqueFieldName(String uniqueFieldName) {
this.uniqueFieldName = uniqueFieldName;
}
}

View File

@@ -0,0 +1,124 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Operation extends WordnikObject {
//
private List<Parameter> parameters = new ArrayList<Parameter>();
//
private List<Response> response = new ArrayList<Response>();
//
private String category ;
//
private String summary ;
//
private String suggestedName ;
//
private boolean deprecated ;
//
private boolean open ;
//
private String notes ;
//
private String httpMethod ;
//
public List<Parameter> getParameters() {
return parameters;
}
public void setParameters(List<Parameter> parameters) {
this.parameters = parameters;
}
//
public List<Response> getResponse() {
return response;
}
public void setResponse(List<Response> response) {
this.response = response;
}
//
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
//
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
//
public String getSuggestedName() {
return suggestedName;
}
public void setSuggestedName(String suggestedName) {
this.suggestedName = suggestedName;
}
//
public boolean getDeprecated() {
return deprecated;
}
public void setDeprecated(boolean deprecated) {
this.deprecated = deprecated;
}
//
public boolean getOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
//
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
//
public String getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(String httpMethod) {
this.httpMethod = httpMethod;
}
}

View File

@@ -0,0 +1,133 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Parameter extends WordnikObject {
//
private String name ;
//
private String defaultValue ;
//
private String description ;
//
private boolean required ;
//
private String dataType ;
//
private String allowableValues ;
//
private String wrapperName ;
//
private String internalDescription ;
//
private String paramAccess ;
//
private String paramType ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
//
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
//
public boolean getRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
//
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
//
public String getAllowableValues() {
return allowableValues;
}
public void setAllowableValues(String allowableValues) {
this.allowableValues = allowableValues;
}
//
public String getWrapperName() {
return wrapperName;
}
public void setWrapperName(String wrapperName) {
this.wrapperName = wrapperName;
}
//
public String getInternalDescription() {
return internalDescription;
}
public void setInternalDescription(String internalDescription) {
this.internalDescription = internalDescription;
}
//
public String getParamAccess() {
return paramAccess;
}
public void setParamAccess(String paramAccess) {
this.paramAccess = paramAccess;
}
//
public String getParamType() {
return paramType;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
}

View File

@@ -0,0 +1,36 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class PartOfSpeech extends WordnikObject {
//
private List<Root> roots = new ArrayList<Root>();
//
public List<Root> getRoots() {
return roots;
}
public void setRoots(List<Root> roots) {
this.roots = roots;
}
}

View File

@@ -0,0 +1,166 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Photo extends WordnikObject {
//
private Long id ;
//
private String owner ;
//
private int server ;
//
private String title ;
//
private String ownername ;
//
private String secret ;
//
private int farm ;
//
private int ispublic ;
//
private int isfriend ;
//
private int isfamily ;
//
private String ownerLink ;
//
private String linkUri ;
//
private Size size ;
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
//
public int getServer() {
return server;
}
public void setServer(int server) {
this.server = server;
}
//
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//
public String getOwnername() {
return ownername;
}
public void setOwnername(String ownername) {
this.ownername = ownername;
}
//
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
//
public int getFarm() {
return farm;
}
public void setFarm(int farm) {
this.farm = farm;
}
//
public int getIspublic() {
return ispublic;
}
public void setIspublic(int ispublic) {
this.ispublic = ispublic;
}
//
public int getIsfriend() {
return isfriend;
}
public void setIsfriend(int isfriend) {
this.isfriend = isfriend;
}
//
public int getIsfamily() {
return isfamily;
}
public void setIsfamily(int isfamily) {
this.isfamily = isfamily;
}
//
public String getOwnerLink() {
return ownerLink;
}
public void setOwnerLink(String ownerLink) {
this.ownerLink = ownerLink;
}
//
public String getLinkUri() {
return linkUri;
}
public void setLinkUri(String linkUri) {
this.linkUri = linkUri;
}
//
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
}

View File

@@ -0,0 +1,102 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Related extends WordnikObject {
//
private List<String> words = new ArrayList<String>();
//
private String relationshipType ;
//
private String label1 ;
//
private String label2 ;
//
private String label3 ;
//
private String label4 ;
//
private String gram ;
//
public List<String> getWords() {
return words;
}
public void setWords(List<String> words) {
this.words = words;
}
//
public String getRelationshipType() {
return relationshipType;
}
public void setRelationshipType(String relationshipType) {
this.relationshipType = relationshipType;
}
//
public String getLabel1() {
return label1;
}
public void setLabel1(String label1) {
this.label1 = label1;
}
//
public String getLabel2() {
return label2;
}
public void setLabel2(String label2) {
this.label2 = label2;
}
//
public String getLabel3() {
return label3;
}
public void setLabel3(String label3) {
this.label3 = label3;
}
//
public String getLabel4() {
return label4;
}
public void setLabel4(String label4) {
this.label4 = label4;
}
//
public String getGram() {
return gram;
}
public void setGram(String gram) {
this.gram = gram;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class RelationshipMap extends WordnikObject {
//
private String sourceWordstring ;
//
private List<Suggestion> suggestions = new ArrayList<Suggestion>();
//
public String getSourceWordstring() {
return sourceWordstring;
}
public void setSourceWordstring(String sourceWordstring) {
this.sourceWordstring = sourceWordstring;
}
//
public List<Suggestion> getSuggestions() {
return suggestions;
}
public void setSuggestions(List<Suggestion> suggestions) {
this.suggestions = suggestions;
}
}

View File

@@ -0,0 +1,69 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Response extends WordnikObject {
//
private String valueType ;
//
private List<Error> errorResponses = new ArrayList<Error>();
//
private String occurs ;
//
private String condition ;
//
public String getValueType() {
return valueType;
}
public void setValueType(String valueType) {
this.valueType = valueType;
}
//
public List<Error> getErrorResponses() {
return errorResponses;
}
public void setErrorResponses(List<Error> errorResponses) {
this.errorResponses = errorResponses;
}
//
public String getOccurs() {
return occurs;
}
public void setOccurs(String occurs) {
this.occurs = occurs;
}
//
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
}

View File

@@ -0,0 +1,47 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Root extends WordnikObject {
//
private String name ;
//
private List<Category> categories = new ArrayList<Category>();
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public List<Category> getCategories() {
return categories;
}
public void setCategories(List<Category> categories) {
this.categories = categories;
}
}

View File

@@ -0,0 +1,100 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class ScoredWord extends WordnikObject {
//
private Long id ;
//
private String wordType ;
//
private int position ;
//
private String word ;
//
private float score ;
//
private Long sentenceId ;
//
private String partOfSpeech ;
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public String getWordType() {
return wordType;
}
public void setWordType(String wordType) {
this.wordType = wordType;
}
//
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
//
public Long getSentenceId() {
return sentenceId;
}
public void setSentenceId(Long sentenceId) {
this.sentenceId = sentenceId;
}
//
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
}

View File

@@ -0,0 +1,80 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Sentence extends WordnikObject {
//
private Long id ;
//
private List<ScoredWord> scoredWords = new ArrayList<ScoredWord>();
//
private String display ;
//
private Long documentMetadataId ;
//
private int rating ;
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public List<ScoredWord> getScoredWords() {
return scoredWords;
}
public void setScoredWords(List<ScoredWord> scoredWords) {
this.scoredWords = scoredWords;
}
//
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
//
public Long getDocumentMetadataId() {
return documentMetadataId;
}
public void setDocumentMetadataId(Long documentMetadataId) {
this.documentMetadataId = documentMetadataId;
}
//
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
}

View File

@@ -0,0 +1,67 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class SimpleDefinition extends WordnikObject {
//
private String text ;
//
private String partOfSpeech ;
//
private String note ;
//
private String source ;
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
//
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
//
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
//
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}

View File

@@ -0,0 +1,67 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class SimpleExample extends WordnikObject {
//
private String url ;
//
private String text ;
//
private String title ;
//
private Long id ;
//
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
//
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@@ -0,0 +1,36 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Sizes extends WordnikObject {
//
private List<Size> size = new ArrayList<Size>();
//
public List<Size> getSize() {
return size;
}
public void setSize(List<Size> size) {
this.size = size;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class SubscriptionStatus extends WordnikObject {
//
private String name ;
//
private int id ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Suggestion extends WordnikObject {
//
private int type ;
//
private String wordstring ;
//
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
//
public String getWordstring() {
return wordstring;
}
public void setWordstring(String wordstring) {
this.wordstring = wordstring;
}
}

View File

@@ -0,0 +1,56 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class Syllable extends WordnikObject {
//
private String type ;
//
private int seq ;
//
private String text ;
//
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
//
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
//
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View File

@@ -0,0 +1,608 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class TestData extends WordnikObject {
//
private List<Note> noteList ;
//
private List<Example> exampleList ;
//
private List<Definition> definitionList ;
//
private List<Photo> photoList ;
//
private List<Category> categoryList ;
//
private List<Frequency> frequencyList ;
//
private List<ContentProvider> contentProviderList ;
//
private List<ExampleUsage> exampleUsageList ;
//
private List<Root> rootList ;
//
private List<FrequencySummary> frequencySummaryList ;
//
private List<AudioType> audioTypeList ;
//
private List<Citation> citationList ;
//
private List<ScoredWord> scoredWordList ;
//
private List<FacetValue> facetValueList ;
//
private List<Sentence> sentenceList ;
//
private List<Facet> facetList ;
//
private List<WordObject> wordObjectList ;
//
private List<RelationshipMap> relationshipMapList ;
//
private List<Bigram> bigramList ;
//
private List<Related> relatedList ;
//
private List<ExampleSearchResults> exampleSearchResultsList ;
//
private List<FrequencySummaryE> frequencySummaryEList ;
//
private List<PartOfSpeech> partOfSpeechList ;
//
private List<Sizes> sizesList ;
//
private List<AudioFile> audioFileList ;
//
private List<Syllable> syllableList ;
//
private List<TextPron> textPronList ;
//
private List<Label> labelList ;
//
private List<DefinitionSearchResults> definitionSearchResultsList ;
//
private List<FrequencyElement> frequencyElementList ;
//
private List<Suggestion> suggestionList ;
//
private List<WordFrequency> wordFrequencyList ;
//
private List<EntrySearchResult> entrySearchResultList ;
//
private List<WordOfTheDayList> wordOfTheDayListList ;
//
private List<WordOfTheDay> wordOfTheDayList ;
//
private List<SubscriptionStatus> subscriptionStatusList ;
//
private List<SimpleDefinition> simpleDefinitionList ;
//
private List<SimpleExample> simpleExampleList ;
//
private List<EntrySearchResults> entrySearchResultsList ;
//
private List<WordList> wordListList ;
//
private List<WordListWord> wordListWordList ;
//
private List<Error> errorList ;
//
private List<Response> responseList ;
//
private List<Parameter> parameterList ;
//
private List<Doc> docList ;
//
private List<Object> objectList ;
//
private List<Endpoint> endpointList ;
//
private List<Operation> operationList ;
//
private List<ApiResponse> apiResponseList ;
//
private List<ApiTokenStatus> apiTokenStatusList ;
//
private List<AuthenticationToken> authenticationTokenList ;
//
private List<User> userList ;
//
private List<StringValue> StringValueList ;
//
public List<Note> getNoteList() {
return noteList;
}
public void setNoteList(List<Note> noteList) {
this.noteList = noteList;
}
//
public List<Example> getExampleList() {
return exampleList;
}
public void setExampleList(List<Example> exampleList) {
this.exampleList = exampleList;
}
//
public List<Definition> getDefinitionList() {
return definitionList;
}
public void setDefinitionList(List<Definition> definitionList) {
this.definitionList = definitionList;
}
//
public List<Photo> getPhotoList() {
return photoList;
}
public void setPhotoList(List<Photo> photoList) {
this.photoList = photoList;
}
//
public List<Category> getCategoryList() {
return categoryList;
}
public void setCategoryList(List<Category> categoryList) {
this.categoryList = categoryList;
}
//
public List<Frequency> getFrequencyList() {
return frequencyList;
}
public void setFrequencyList(List<Frequency> frequencyList) {
this.frequencyList = frequencyList;
}
//
public List<ContentProvider> getContentProviderList() {
return contentProviderList;
}
public void setContentProviderList(List<ContentProvider> contentProviderList) {
this.contentProviderList = contentProviderList;
}
//
public List<ExampleUsage> getExampleUsageList() {
return exampleUsageList;
}
public void setExampleUsageList(List<ExampleUsage> exampleUsageList) {
this.exampleUsageList = exampleUsageList;
}
//
public List<Root> getRootList() {
return rootList;
}
public void setRootList(List<Root> rootList) {
this.rootList = rootList;
}
//
public List<FrequencySummary> getFrequencySummaryList() {
return frequencySummaryList;
}
public void setFrequencySummaryList(List<FrequencySummary> frequencySummaryList) {
this.frequencySummaryList = frequencySummaryList;
}
//
public List<AudioType> getAudioTypeList() {
return audioTypeList;
}
public void setAudioTypeList(List<AudioType> audioTypeList) {
this.audioTypeList = audioTypeList;
}
//
public List<Citation> getCitationList() {
return citationList;
}
public void setCitationList(List<Citation> citationList) {
this.citationList = citationList;
}
//
public List<ScoredWord> getScoredWordList() {
return scoredWordList;
}
public void setScoredWordList(List<ScoredWord> scoredWordList) {
this.scoredWordList = scoredWordList;
}
//
public List<FacetValue> getFacetValueList() {
return facetValueList;
}
public void setFacetValueList(List<FacetValue> facetValueList) {
this.facetValueList = facetValueList;
}
//
public List<Sentence> getSentenceList() {
return sentenceList;
}
public void setSentenceList(List<Sentence> sentenceList) {
this.sentenceList = sentenceList;
}
//
public List<Facet> getFacetList() {
return facetList;
}
public void setFacetList(List<Facet> facetList) {
this.facetList = facetList;
}
//
public List<WordObject> getWordObjectList() {
return wordObjectList;
}
public void setWordObjectList(List<WordObject> wordObjectList) {
this.wordObjectList = wordObjectList;
}
//
public List<RelationshipMap> getRelationshipMapList() {
return relationshipMapList;
}
public void setRelationshipMapList(List<RelationshipMap> relationshipMapList) {
this.relationshipMapList = relationshipMapList;
}
//
public List<Bigram> getBigramList() {
return bigramList;
}
public void setBigramList(List<Bigram> bigramList) {
this.bigramList = bigramList;
}
//
public List<Related> getRelatedList() {
return relatedList;
}
public void setRelatedList(List<Related> relatedList) {
this.relatedList = relatedList;
}
//
public List<ExampleSearchResults> getExampleSearchResultsList() {
return exampleSearchResultsList;
}
public void setExampleSearchResultsList(List<ExampleSearchResults> exampleSearchResultsList) {
this.exampleSearchResultsList = exampleSearchResultsList;
}
//
public List<FrequencySummaryE> getFrequencySummaryEList() {
return frequencySummaryEList;
}
public void setFrequencySummaryEList(List<FrequencySummaryE> frequencySummaryEList) {
this.frequencySummaryEList = frequencySummaryEList;
}
//
public List<PartOfSpeech> getPartOfSpeechList() {
return partOfSpeechList;
}
public void setPartOfSpeechList(List<PartOfSpeech> partOfSpeechList) {
this.partOfSpeechList = partOfSpeechList;
}
//
public List<Sizes> getSizesList() {
return sizesList;
}
public void setSizesList(List<Sizes> sizesList) {
this.sizesList = sizesList;
}
//
public List<AudioFile> getAudioFileList() {
return audioFileList;
}
public void setAudioFileList(List<AudioFile> audioFileList) {
this.audioFileList = audioFileList;
}
//
public List<Syllable> getSyllableList() {
return syllableList;
}
public void setSyllableList(List<Syllable> syllableList) {
this.syllableList = syllableList;
}
//
public List<TextPron> getTextPronList() {
return textPronList;
}
public void setTextPronList(List<TextPron> textPronList) {
this.textPronList = textPronList;
}
//
public List<Label> getLabelList() {
return labelList;
}
public void setLabelList(List<Label> labelList) {
this.labelList = labelList;
}
//
public List<DefinitionSearchResults> getDefinitionSearchResultsList() {
return definitionSearchResultsList;
}
public void setDefinitionSearchResultsList(List<DefinitionSearchResults> definitionSearchResultsList) {
this.definitionSearchResultsList = definitionSearchResultsList;
}
//
public List<FrequencyElement> getFrequencyElementList() {
return frequencyElementList;
}
public void setFrequencyElementList(List<FrequencyElement> frequencyElementList) {
this.frequencyElementList = frequencyElementList;
}
//
public List<Suggestion> getSuggestionList() {
return suggestionList;
}
public void setSuggestionList(List<Suggestion> suggestionList) {
this.suggestionList = suggestionList;
}
//
public List<WordFrequency> getWordFrequencyList() {
return wordFrequencyList;
}
public void setWordFrequencyList(List<WordFrequency> wordFrequencyList) {
this.wordFrequencyList = wordFrequencyList;
}
//
public List<EntrySearchResult> getEntrySearchResultList() {
return entrySearchResultList;
}
public void setEntrySearchResultList(List<EntrySearchResult> entrySearchResultList) {
this.entrySearchResultList = entrySearchResultList;
}
//
public List<WordOfTheDayList> getWordOfTheDayListList() {
return wordOfTheDayListList;
}
public void setWordOfTheDayListList(List<WordOfTheDayList> wordOfTheDayListList) {
this.wordOfTheDayListList = wordOfTheDayListList;
}
//
public List<WordOfTheDay> getWordOfTheDayList() {
return wordOfTheDayList;
}
public void setWordOfTheDayList(List<WordOfTheDay> wordOfTheDayList) {
this.wordOfTheDayList = wordOfTheDayList;
}
//
public List<SubscriptionStatus> getSubscriptionStatusList() {
return subscriptionStatusList;
}
public void setSubscriptionStatusList(List<SubscriptionStatus> subscriptionStatusList) {
this.subscriptionStatusList = subscriptionStatusList;
}
//
public List<SimpleDefinition> getSimpleDefinitionList() {
return simpleDefinitionList;
}
public void setSimpleDefinitionList(List<SimpleDefinition> simpleDefinitionList) {
this.simpleDefinitionList = simpleDefinitionList;
}
//
public List<SimpleExample> getSimpleExampleList() {
return simpleExampleList;
}
public void setSimpleExampleList(List<SimpleExample> simpleExampleList) {
this.simpleExampleList = simpleExampleList;
}
//
public List<EntrySearchResults> getEntrySearchResultsList() {
return entrySearchResultsList;
}
public void setEntrySearchResultsList(List<EntrySearchResults> entrySearchResultsList) {
this.entrySearchResultsList = entrySearchResultsList;
}
//
public List<WordList> getWordListList() {
return wordListList;
}
public void setWordListList(List<WordList> wordListList) {
this.wordListList = wordListList;
}
//
public List<WordListWord> getWordListWordList() {
return wordListWordList;
}
public void setWordListWordList(List<WordListWord> wordListWordList) {
this.wordListWordList = wordListWordList;
}
//
public List<Error> getErrorList() {
return errorList;
}
public void setErrorList(List<Error> errorList) {
this.errorList = errorList;
}
//
public List<Response> getResponseList() {
return responseList;
}
public void setResponseList(List<Response> responseList) {
this.responseList = responseList;
}
//
public List<Parameter> getParameterList() {
return parameterList;
}
public void setParameterList(List<Parameter> parameterList) {
this.parameterList = parameterList;
}
//
public List<Doc> getDocList() {
return docList;
}
public void setDocList(List<Doc> docList) {
this.docList = docList;
}
//
public List<Object> getObjectList() {
return objectList;
}
public void setObjectList(List<Object> objectList) {
this.objectList = objectList;
}
//
public List<Endpoint> getEndpointList() {
return endpointList;
}
public void setEndpointList(List<Endpoint> endpointList) {
this.endpointList = endpointList;
}
//
public List<Operation> getOperationList() {
return operationList;
}
public void setOperationList(List<Operation> operationList) {
this.operationList = operationList;
}
//
public List<ApiResponse> getApiResponseList() {
return apiResponseList;
}
public void setApiResponseList(List<ApiResponse> apiResponseList) {
this.apiResponseList = apiResponseList;
}
//
public List<ApiTokenStatus> getApiTokenStatusList() {
return apiTokenStatusList;
}
public void setApiTokenStatusList(List<ApiTokenStatus> apiTokenStatusList) {
this.apiTokenStatusList = apiTokenStatusList;
}
//
public List<AuthenticationToken> getAuthenticationTokenList() {
return authenticationTokenList;
}
public void setAuthenticationTokenList(List<AuthenticationToken> authenticationTokenList) {
this.authenticationTokenList = authenticationTokenList;
}
//
public List<User> getUserList() {
return userList;
}
public void setUserList(List<User> userList) {
this.userList = userList;
}
//
public List<StringValue> getStringValueList() {
return StringValueList;
}
public void setStringValueList(List<StringValue> StringValueList) {
this.StringValueList = StringValueList;
}
}

View File

@@ -0,0 +1,67 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class TextPron extends WordnikObject {
//
private Long id ;
//
private int seq ;
//
private String raw ;
//
private String rawType ;
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
//
public String getRaw() {
return raw;
}
public void setRaw(String raw) {
this.raw = raw;
}
//
public String getRawType() {
return rawType;
}
public void setRawType(String rawType) {
this.rawType = rawType;
}
}

View File

@@ -0,0 +1,100 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class User extends WordnikObject {
//Unique idenitifier for a user
private Long id ;
//Display name
private String displayName ;
//Account status
private int status ;
//
private String password ;
//User name
private String userName ;
//Email address
private String email ;
//Facebook ID
private String faceBookId ;
//Unique idenitifier for a user
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//Display name
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
//Account status
@AllowableValues(value="0,1,2,3")
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
//
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
//User name
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
//Email address
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
//Facebook ID
public String getFaceBookId() {
return faceBookId;
}
public void setFaceBookId(String faceBookId) {
this.faceBookId = faceBookId;
}
}

View File

@@ -0,0 +1,111 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordContextualLookupInput extends WordnikObject {
//Word to return definitions for
private String word ;
//The sentence in which the word occurs
private String sentence ;
//The start character offset of the word in the given sentence
private String offset ;
//Expand context terms using related words
private String expandTerms ;
//Only include these comma-delimited source dictionaries
private String includeSourceDictionaries ;
//Exclude these comma-delimited source dictionaries
private String excludeSourceDictionaries ;
//Results to skip
private String skip ;
//Maximum number of results to return
private String limit ;
//Word to return definitions for
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//The sentence in which the word occurs
public String getSentence() {
return sentence;
}
public void setSentence(String sentence) {
this.sentence = sentence;
}
//The start character offset of the word in the given sentence
@AllowableValues(value="0 to 4096")
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
//Expand context terms using related words
@AllowableValues(value="true,false")
public String getExpandTerms() {
return expandTerms;
}
public void setExpandTerms(String expandTerms) {
this.expandTerms = expandTerms;
}
//Only include these comma-delimited source dictionaries
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getIncludeSourceDictionaries() {
return includeSourceDictionaries;
}
public void setIncludeSourceDictionaries(String includeSourceDictionaries) {
this.includeSourceDictionaries = includeSourceDictionaries;
}
//Exclude these comma-delimited source dictionaries
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getExcludeSourceDictionaries() {
return excludeSourceDictionaries;
}
public void setExcludeSourceDictionaries(String excludeSourceDictionaries) {
this.excludeSourceDictionaries = excludeSourceDictionaries;
}
//Results to skip
@AllowableValues(value="0 to 1000")
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
//Maximum number of results to return
@AllowableValues(value="1 to 1000")
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,100 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordDefinitionsInput extends WordnikObject {
//Word to return definitions for
private String word ;
//Maximum number of results to return
private String limit ;
//CSV list of part-of-speech types
private String partOfSpeech ;
//Return related words with definitions
private String includeRelated ;
//Gets from dictionaries in the supplied order of precedence
private String sourceDictionaries ;
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
private String useCanonical ;
//Return a closed set of XML tags in response
private String includeTags ;
//Word to return definitions for
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
//CSV list of part-of-speech types
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
//Return related words with definitions
@AllowableValues(value="true,false")
public String getIncludeRelated() {
return includeRelated;
}
public void setIncludeRelated(String includeRelated) {
this.includeRelated = includeRelated;
}
//Gets from dictionaries in the supplied order of precedence
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getSourceDictionaries() {
return sourceDictionaries;
}
public void setSourceDictionaries(String sourceDictionaries) {
this.sourceDictionaries = sourceDictionaries;
}
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
@AllowableValues(value="false,true")
public String getUseCanonical() {
return useCanonical;
}
public void setUseCanonical(String useCanonical) {
this.useCanonical = useCanonical;
}
//Return a closed set of XML tags in response
@AllowableValues(value="false,true")
public String getIncludeTags() {
return includeTags;
}
public void setIncludeTags(String includeTags) {
this.includeTags = includeTags;
}
}

View File

@@ -0,0 +1,89 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordExamplesInput extends WordnikObject {
//Word to return examples for
private String word ;
//Maximum number of results to return
private String limit ;
//Show duplicate examples from different sources
private String includeDuplicates ;
//Return results from a specific ContentProvider
private String contentProvider ;
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
private String useCanonical ;
//Results to skip
private String skip ;
//Word to return examples for
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
//Show duplicate examples from different sources
public String getIncludeDuplicates() {
return includeDuplicates;
}
public void setIncludeDuplicates(String includeDuplicates) {
this.includeDuplicates = includeDuplicates;
}
//Return results from a specific ContentProvider
public String getContentProvider() {
return contentProvider;
}
public void setContentProvider(String contentProvider) {
this.contentProvider = contentProvider;
}
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
public String getUseCanonical() {
return useCanonical;
}
public void setUseCanonical(String useCanonical) {
this.useCanonical = useCanonical;
}
//Results to skip
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordFrequency extends WordnikObject {
//
private Long count ;
//
private String wordstring ;
//
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
//
public String getWordstring() {
return wordstring;
}
public void setWordstring(String wordstring) {
this.wordstring = wordstring;
}
}

View File

@@ -0,0 +1,134 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.Date;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordList extends WordnikObject {
//
private String name ;
//
private Long id ;
//
private String type ;
//
private String description ;
//
private Long userId ;
//
private String permalink ;
//
private Date createdAt ;
//
private String username ;
//
private Date updatedAt ;
//
private Long numberWordsInList ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
//
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
//
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
//
public String getPermalink() {
return permalink;
}
public void setPermalink(String permalink) {
this.permalink = permalink;
}
//
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
//
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
//
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
//
public Long getNumberWordsInList() {
return numberWordsInList;
}
public void setNumberWordsInList(Long numberWordsInList) {
this.numberWordsInList = numberWordsInList;
}
}

View File

@@ -0,0 +1,90 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.Date;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordListWord extends WordnikObject {
//
private Long userId ;
//
private String word ;
//
private Date createdAt ;
//
private String username ;
//
private Long numberCommentsOnWord ;
//
private Long numberLists ;
//
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
//
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
//
public Long getNumberCommentsOnWord() {
return numberCommentsOnWord;
}
public void setNumberCommentsOnWord(Long numberCommentsOnWord) {
this.numberCommentsOnWord = numberCommentsOnWord;
}
//
public Long getNumberLists() {
return numberLists;
}
public void setNumberLists(Long numberLists) {
this.numberLists = numberLists;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordListWordsInput extends WordnikObject {
//ID of WordList to use
private String wordListId ;
//Field to sort by
private String sortBy ;
//Direction to sort
private String sortOrder ;
//Results to skip
private String skip ;
//Maximum number of results to return
private String limit ;
//ID of WordList to use
public String getWordListId() {
return wordListId;
}
public void setWordListId(String wordListId) {
this.wordListId = wordListId;
}
//Field to sort by
@AllowableValues(value="createDate,alpha")
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
//Direction to sort
@AllowableValues(value="asc,desc")
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
//Results to skip
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordObject extends WordnikObject {
//
private String word ;
//
private String vulgar ;
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public String getVulgar() {
return vulgar;
}
public void setVulgar(String vulgar) {
this.vulgar = vulgar;
}
}

View File

@@ -0,0 +1,160 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordOfTheDay extends WordnikObject {
//
private Long id ;
//
private String category ;
//
private List<SimpleExample> examples = new ArrayList<SimpleExample>();
//
private String word ;
//
private String createdBy ;
//
private List<SimpleDefinition> definitions = new ArrayList<SimpleDefinition>();
//
private ContentProvider contentProvider ;
//
private Date createdAt ;
//
private Date publishDate ;
//
private String parentId ;
//
private String note ;
//
private String htmlExtra ;
//
@Required
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
//
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
//
public List<SimpleExample> getExamples() {
return examples;
}
public void setExamples(List<SimpleExample> examples) {
this.examples = examples;
}
//
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
//
public List<SimpleDefinition> getDefinitions() {
return definitions;
}
public void setDefinitions(List<SimpleDefinition> definitions) {
this.definitions = definitions;
}
//
public ContentProvider getContentProvider() {
return contentProvider;
}
public void setContentProvider(ContentProvider contentProvider) {
this.contentProvider = contentProvider;
}
//
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
//
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
//
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
//
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
//
public String getHtmlExtra() {
return htmlExtra;
}
public void setHtmlExtra(String htmlExtra) {
this.htmlExtra = htmlExtra;
}
}

View File

@@ -0,0 +1,237 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordOfTheDayList extends WordnikObject {
//
private String name ;
//
private String id ;
//
private String description ;
//
private String category ;
//
private String createdBy ;
//
private List<WordOfTheDay> items = new ArrayList<WordOfTheDay>();
//
private int subscriberCount ;
//
private String subscriptionStatus ;
//
private Date createdAt ;
//
private int commentCount ;
//
private int voteCount ;
//
private float voteAverage ;
//
private float voteWeightedAverage ;
//
private int itemCount ;
//
private Date firstItemDate ;
//
private Date lastItemDate ;
//
private String subscriptionSchedule ;
//
private String subscriptionNamespace ;
//
private String subscriptionIdentifier ;
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//
@Required
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
//
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
//
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
//
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
//
public List<WordOfTheDay> getItems() {
return items;
}
public void setItems(List<WordOfTheDay> items) {
this.items = items;
}
//
public int getSubscriberCount() {
return subscriberCount;
}
public void setSubscriberCount(int subscriberCount) {
this.subscriberCount = subscriberCount;
}
//
public String getSubscriptionStatus() {
return subscriptionStatus;
}
public void setSubscriptionStatus(String subscriptionStatus) {
this.subscriptionStatus = subscriptionStatus;
}
//
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
//
public int getCommentCount() {
return commentCount;
}
public void setCommentCount(int commentCount) {
this.commentCount = commentCount;
}
//
public int getVoteCount() {
return voteCount;
}
public void setVoteCount(int voteCount) {
this.voteCount = voteCount;
}
//
public float getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage;
}
//
public float getVoteWeightedAverage() {
return voteWeightedAverage;
}
public void setVoteWeightedAverage(float voteWeightedAverage) {
this.voteWeightedAverage = voteWeightedAverage;
}
//
public int getItemCount() {
return itemCount;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
//
public Date getFirstItemDate() {
return firstItemDate;
}
public void setFirstItemDate(Date firstItemDate) {
this.firstItemDate = firstItemDate;
}
//
public Date getLastItemDate() {
return lastItemDate;
}
public void setLastItemDate(Date lastItemDate) {
this.lastItemDate = lastItemDate;
}
//
public String getSubscriptionSchedule() {
return subscriptionSchedule;
}
public void setSubscriptionSchedule(String subscriptionSchedule) {
this.subscriptionSchedule = subscriptionSchedule;
}
//
public String getSubscriptionNamespace() {
return subscriptionNamespace;
}
public void setSubscriptionNamespace(String subscriptionNamespace) {
this.subscriptionNamespace = subscriptionNamespace;
}
//
public String getSubscriptionIdentifier() {
return subscriptionIdentifier;
}
public void setSubscriptionIdentifier(String subscriptionIdentifier) {
this.subscriptionIdentifier = subscriptionIdentifier;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordPronunciationsInput extends WordnikObject {
//Word to get pronunciations for
private String word ;
//If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
private String useCanonical ;
//Get from a single dictionary.
private String sourceDictionary ;
//Text pronunciation type
private String typeFormat ;
//Maximum number of results to return
private String limit ;
//Word to get pronunciations for
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
public String getUseCanonical() {
return useCanonical;
}
public void setUseCanonical(String useCanonical) {
this.useCanonical = useCanonical;
}
//Get from a single dictionary.
@AllowableValues(value="ahd,century,cmu,macmillan,wiktionary,webster,wordnet")
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
//Text pronunciation type
@AllowableValues(value="ahd,arpabet,gcide-diacritical,IPA")
public String getTypeFormat() {
return typeFormat;
}
public void setTypeFormat(String typeFormat) {
this.typeFormat = typeFormat;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,89 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordRelatedInput extends WordnikObject {
//Word for which to return related words
private String word ;
//CSV list of part-of-speech types
private String partOfSpeech ;
//Get data from a single dictionary
private String sourceDictionary ;
//Maximum number of results to return
private String limit ;
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
private String useCanonical ;
//Relationship type
private String type ;
//Word for which to return related words
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
//CSV list of part-of-speech types
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
//Get data from a single dictionary
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
@AllowableValues(value="false,true")
public String getUseCanonical() {
return useCanonical;
}
public void setUseCanonical(String useCanonical) {
this.useCanonical = useCanonical;
}
//Relationship type
@AllowableValues(value="synonym,antonym,variant,equivalent,cross-reference,related-word,rhyme,form,etymologically-related-term,hypernym,hyponym,inflected-form,primary,same-context,verb-form,verb-stem,unknown")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@@ -0,0 +1,122 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsRandomWordInput extends WordnikObject {
//Only return words with dictionary definitions
private String hasDictionaryDef ;
//CSV part-of-speech values to include
private String includePartOfSpeech ;
//CSV part-of-speech values to exclude
private String excludePartOfSpeech ;
//Minimum corpus frequency for terms
private String minCorpusCount ;
//Maximum corpus frequency for terms
private String maxCorpusCount ;
//Minimum dictionary count
private String minDictionaryCount ;
//Maximum dictionary count
private String maxDictionaryCount ;
//Minimum word length
private String minLength ;
//Maximum word length
private String maxLength ;
//Only return words with dictionary definitions
@AllowableValues(value="false,true")
public String getHasDictionaryDef() {
return hasDictionaryDef;
}
public void setHasDictionaryDef(String hasDictionaryDef) {
this.hasDictionaryDef = hasDictionaryDef;
}
//CSV part-of-speech values to include
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getIncludePartOfSpeech() {
return includePartOfSpeech;
}
public void setIncludePartOfSpeech(String includePartOfSpeech) {
this.includePartOfSpeech = includePartOfSpeech;
}
//CSV part-of-speech values to exclude
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getExcludePartOfSpeech() {
return excludePartOfSpeech;
}
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
this.excludePartOfSpeech = excludePartOfSpeech;
}
//Minimum corpus frequency for terms
public String getMinCorpusCount() {
return minCorpusCount;
}
public void setMinCorpusCount(String minCorpusCount) {
this.minCorpusCount = minCorpusCount;
}
//Maximum corpus frequency for terms
public String getMaxCorpusCount() {
return maxCorpusCount;
}
public void setMaxCorpusCount(String maxCorpusCount) {
this.maxCorpusCount = maxCorpusCount;
}
//Minimum dictionary count
public String getMinDictionaryCount() {
return minDictionaryCount;
}
public void setMinDictionaryCount(String minDictionaryCount) {
this.minDictionaryCount = minDictionaryCount;
}
//Maximum dictionary count
public String getMaxDictionaryCount() {
return maxDictionaryCount;
}
public void setMaxDictionaryCount(String maxDictionaryCount) {
this.maxDictionaryCount = maxDictionaryCount;
}
//Minimum word length
public String getMinLength() {
return minLength;
}
public void setMinLength(String minLength) {
this.minLength = minLength;
}
//Maximum word length
public String getMaxLength() {
return maxLength;
}
public void setMaxLength(String maxLength) {
this.maxLength = maxLength;
}
}

View File

@@ -0,0 +1,155 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsRandomWordsInput extends WordnikObject {
//Only return words with dictionary definitions
private String hasDictionaryDef ;
//CSV part-of-speech values to include
private String includePartOfSpeech ;
//CSV part-of-speech values to exclude
private String excludePartOfSpeech ;
//Minimum corpus frequency for terms (integer)
private String minCorpusCount ;
//Maximum corpus frequency for terms (integer)
private String maxCorpusCount ;
//Minimum dictionary count (integer)
private String minDictionaryCount ;
//Maximum dictionary count (integer)
private String maxDictionaryCount ;
//Minimum word length (characters)
private String minLength ;
//Maximum word length (characters)
private String maxLength ;
//Attribute to sort by
private String sortBy ;
//Sort direction
private String sortOrder ;
//Maximum number of results to return
private String limit ;
//Only return words with dictionary definitions
@AllowableValues(value="false,true")
public String getHasDictionaryDef() {
return hasDictionaryDef;
}
public void setHasDictionaryDef(String hasDictionaryDef) {
this.hasDictionaryDef = hasDictionaryDef;
}
//CSV part-of-speech values to include
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getIncludePartOfSpeech() {
return includePartOfSpeech;
}
public void setIncludePartOfSpeech(String includePartOfSpeech) {
this.includePartOfSpeech = includePartOfSpeech;
}
//CSV part-of-speech values to exclude
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getExcludePartOfSpeech() {
return excludePartOfSpeech;
}
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
this.excludePartOfSpeech = excludePartOfSpeech;
}
//Minimum corpus frequency for terms (integer)
public String getMinCorpusCount() {
return minCorpusCount;
}
public void setMinCorpusCount(String minCorpusCount) {
this.minCorpusCount = minCorpusCount;
}
//Maximum corpus frequency for terms (integer)
public String getMaxCorpusCount() {
return maxCorpusCount;
}
public void setMaxCorpusCount(String maxCorpusCount) {
this.maxCorpusCount = maxCorpusCount;
}
//Minimum dictionary count (integer)
public String getMinDictionaryCount() {
return minDictionaryCount;
}
public void setMinDictionaryCount(String minDictionaryCount) {
this.minDictionaryCount = minDictionaryCount;
}
//Maximum dictionary count (integer)
public String getMaxDictionaryCount() {
return maxDictionaryCount;
}
public void setMaxDictionaryCount(String maxDictionaryCount) {
this.maxDictionaryCount = maxDictionaryCount;
}
//Minimum word length (characters)
public String getMinLength() {
return minLength;
}
public void setMinLength(String minLength) {
this.minLength = minLength;
}
//Maximum word length (characters)
public String getMaxLength() {
return maxLength;
}
public void setMaxLength(String maxLength) {
this.maxLength = maxLength;
}
//Attribute to sort by
@AllowableValues(value="alpha,count")
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
//Sort direction
@AllowableValues(value="asc,desc")
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,210 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsSearchDefinitionsInput extends WordnikObject {
//Search term
private String query ;
//Defined word search term
private String definedWordSearchTerm ;
//Only include these comma-delimited source dictionaries
private String includeSourceDictionaries ;
//Exclude these comma-delimited source dictionaries
private String excludeSourceDictionaries ;
//Only include these comma-delimited parts of speech
private String includePartOfSpeech ;
//Exclude these comma-delimited parts of speech
private String excludePartOfSpeech ;
//Minimum corpus frequency for terms
private String minCorpusCount ;
//Maximum corpus frequency for terms
private String maxCorpusCount ;
//Minimum word length
private String minLength ;
//Maximum word length
private String maxLength ;
//Expand terms
private String expandTerms ;
//Word types
private String wordTypes ;
//Return a closed set of XML tags in response
private String includeTags ;
//Attribute to sort by
private String sortBy ;
//Sort direction
private String sortOrder ;
//Results to skip
private String skip ;
//Maximum number of results to return
private String limit ;
//Search term
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
//Defined word search term
public String getDefinedWordSearchTerm() {
return definedWordSearchTerm;
}
public void setDefinedWordSearchTerm(String definedWordSearchTerm) {
this.definedWordSearchTerm = definedWordSearchTerm;
}
//Only include these comma-delimited source dictionaries
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getIncludeSourceDictionaries() {
return includeSourceDictionaries;
}
public void setIncludeSourceDictionaries(String includeSourceDictionaries) {
this.includeSourceDictionaries = includeSourceDictionaries;
}
//Exclude these comma-delimited source dictionaries
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
public String getExcludeSourceDictionaries() {
return excludeSourceDictionaries;
}
public void setExcludeSourceDictionaries(String excludeSourceDictionaries) {
this.excludeSourceDictionaries = excludeSourceDictionaries;
}
//Only include these comma-delimited parts of speech
public String getIncludePartOfSpeech() {
return includePartOfSpeech;
}
public void setIncludePartOfSpeech(String includePartOfSpeech) {
this.includePartOfSpeech = includePartOfSpeech;
}
//Exclude these comma-delimited parts of speech
public String getExcludePartOfSpeech() {
return excludePartOfSpeech;
}
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
this.excludePartOfSpeech = excludePartOfSpeech;
}
//Minimum corpus frequency for terms
@AllowableValues(value="non-negative integer")
public String getMinCorpusCount() {
return minCorpusCount;
}
public void setMinCorpusCount(String minCorpusCount) {
this.minCorpusCount = minCorpusCount;
}
//Maximum corpus frequency for terms
@AllowableValues(value="non-negative integer")
public String getMaxCorpusCount() {
return maxCorpusCount;
}
public void setMaxCorpusCount(String maxCorpusCount) {
this.maxCorpusCount = maxCorpusCount;
}
//Minimum word length
@AllowableValues(value="0 to 1024")
public String getMinLength() {
return minLength;
}
public void setMinLength(String minLength) {
this.minLength = minLength;
}
//Maximum word length
@AllowableValues(value="0 to 1024")
public String getMaxLength() {
return maxLength;
}
public void setMaxLength(String maxLength) {
this.maxLength = maxLength;
}
//Expand terms
@AllowableValues(value="synonym,hypernym")
public String getExpandTerms() {
return expandTerms;
}
public void setExpandTerms(String expandTerms) {
this.expandTerms = expandTerms;
}
//Word types
@AllowableValues(value="word,multi-word-unit")
public String getWordTypes() {
return wordTypes;
}
public void setWordTypes(String wordTypes) {
this.wordTypes = wordTypes;
}
//Return a closed set of XML tags in response
@AllowableValues(value="false,true")
public String getIncludeTags() {
return includeTags;
}
public void setIncludeTags(String includeTags) {
this.includeTags = includeTags;
}
//Attribute to sort by
@AllowableValues(value="alpha,count,length")
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
//Sort direction
@AllowableValues(value="asc,desc")
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
//Results to skip
@AllowableValues(value="0 to 1000")
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
//Maximum number of results to return
@AllowableValues(value="1 to 1000")
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,155 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsSearchInput extends WordnikObject {
//Search term
private String query ;
//Search case sensitive
private String caseSensitive ;
//Only include these comma-delimited parts of speech
private String includePartOfSpeech ;
//Exclude these comma-delimited parts of speech
private String excludePartOfSpeech ;
//Minimum corpus frequency for terms
private String minCorpusCount ;
//Maximum corpus frequency for terms
private String maxCorpusCount ;
//Minimum number of dictionary entries
private String minDictionaryCount ;
//Maximum dictionary count
private String maxDictionaryCount ;
//Minimum word length
private String minLength ;
//Maximum word length
private String maxLength ;
//Results to skip
private String skip ;
//Maximum number of results to return
private String limit ;
//Search term
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
//Search case sensitive
@AllowableValues(value="true | false")
public String getCaseSensitive() {
return caseSensitive;
}
public void setCaseSensitive(String caseSensitive) {
this.caseSensitive = caseSensitive;
}
//Only include these comma-delimited parts of speech
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
public String getIncludePartOfSpeech() {
return includePartOfSpeech;
}
public void setIncludePartOfSpeech(String includePartOfSpeech) {
this.includePartOfSpeech = includePartOfSpeech;
}
//Exclude these comma-delimited parts of speech
public String getExcludePartOfSpeech() {
return excludePartOfSpeech;
}
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
this.excludePartOfSpeech = excludePartOfSpeech;
}
//Minimum corpus frequency for terms
@AllowableValues(value="non-negative integer")
public String getMinCorpusCount() {
return minCorpusCount;
}
public void setMinCorpusCount(String minCorpusCount) {
this.minCorpusCount = minCorpusCount;
}
//Maximum corpus frequency for terms
@AllowableValues(value="non-negative integer")
public String getMaxCorpusCount() {
return maxCorpusCount;
}
public void setMaxCorpusCount(String maxCorpusCount) {
this.maxCorpusCount = maxCorpusCount;
}
//Minimum number of dictionary entries
@AllowableValues(value="non-negative integer")
public String getMinDictionaryCount() {
return minDictionaryCount;
}
public void setMinDictionaryCount(String minDictionaryCount) {
this.minDictionaryCount = minDictionaryCount;
}
//Maximum dictionary count
@AllowableValues(value="non-negative integer")
public String getMaxDictionaryCount() {
return maxDictionaryCount;
}
public void setMaxDictionaryCount(String maxDictionaryCount) {
this.maxDictionaryCount = maxDictionaryCount;
}
//Minimum word length
@AllowableValues(value="0 to 1024")
public String getMinLength() {
return minLength;
}
public void setMinLength(String minLength) {
this.minLength = minLength;
}
//Maximum word length
@AllowableValues(value="0 to 1024")
public String getMaxLength() {
return maxLength;
}
public void setMaxLength(String maxLength) {
this.maxLength = maxLength;
}
//Results to skip
@AllowableValues(value="0 to 1000")
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
//Maximum number of results to return
@AllowableValues(value="1 to 1000")
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,78 @@
package com.wordnik.model;
import com.wordnik.common.WordnikObject;
import com.wordnik.annotations.AllowableValues;
import com.wordnik.annotations.Required;
import com.wordnik.common.WordListType;
import com.wordnik.common.StringValue;
import com.wordnik.common.Size;
/**
*
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
* @author ramesh
*
*/
public class WordsWordOfTheDayInputRangeInput extends WordnikObject {
//Filters response by category
private String category ;
//Filters response by username
private String creator ;
//Filters response by ContentProvider
private String provider ;
//Results to skip
private String skip ;
//Maximum number of results to return
private String limit ;
//Filters response by category
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
//Filters response by username
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
//Filters response by ContentProvider
public String getProvider() {
return provider;
}
public void setProvider(String provider) {
this.provider = provider;
}
//Results to skip
public String getSkip() {
return skip;
}
public void setSkip(String skip) {
this.skip = skip;
}
//Maximum number of results to return
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}

View File

@@ -0,0 +1,545 @@
package com.wordnik.test;
import java.io.*;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.wordnik.codegen.config.CodeGenConfig;
import com.wordnik.codegen.java.JavaCodeGenConfig;
import com.wordnik.common.*;
import com.wordnik.exception.WordnikAPIException;
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import com.wordnik.api.WordAPI;
import com.wordnik.codegen.resource.Resource;
import com.wordnik.model.TestData;
import org.codehaus.jackson.map.SerializationConfig;
import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jettison.json.JSONObject;
/**
* Instance of this class is used to run the tests and assert the results based on
* JSON based test script.
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 3/30/11
* Time: 6:27 PM
*/
public class APITestRunner {
private static String INPUT_DATA_EXPRESSION_PREFIX = "${data";
private static String OUTPUT_DATA_EXPRESSION_PREFIX = "${output";
private static String CONDITION_EQUAL = "==";
private static String CONDITION_NOT_EQUAL = "!=";
private static String CONDITION_GREATER = ">";
private static String CONDITION_LESSER = "<";
private static String CONDITION_GREATER_EQUAL = ">=";
private static String CONDITION_LESSER_EQUAL = "<=";
private TestOutput testCaseOutput = new TestOutput();
private TestStatus testStatus = new TestStatus();
private TestData testData = null;
private TestPackage aPackage = null;
private static String JAVA = "JAVA";
private static String SCALA = "SCALA";
private static String PYTHON = "PYTHON";
private static String RUBY = "RUBY";
private static String ANDROID = "ANDROID";
private static String OBJECTIVE_C = "OBJECTIVE_C";
private static String AS3 = "AS3";
private static String NET = "NET";
private static String PHP = "PHP";
private static String HASKEL = "HASKEL";
private static String CLOJURE = "CLOJURE";
private static ObjectMapper mapper = new ObjectMapper();
static{
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationConfig.Feature.WRITE_NULL_PROPERTIES, false);
mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
}
private CodeGenConfig config = new JavaCodeGenConfig();
/**
* Follow the following argument pattern
* First argument should be execte full test suite or single test case
* -ts means execute execute full test suite
* -tc means execute individual test case
* Second argument is api <apiKey>
* third argument is auth token <auth token>
* forth argument will be name of resource
* fifth argument will be HTTP method name
* sixth argument will be suggested methdo name
* 7 and 8th argument is optional and specify while calling single test case
* -qp ~ seperated name=value pairs Example: username=test~password=password123
* 9 and 10th argument is optional and specified while calling individual test case
* -postData -- object tht should be used for sending post data (this is a json representation of post data)
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
WordAPI.initialize("c1431550c97c589f2bc1012d963142422a4270d8018aad4b0", "http://beta.wordnik.com/v4/",false);
APITestRunner runner = new APITestRunner();
String language = args[0];
String suiteId = "0";
if(args.length > 1){
suiteId = args[1];
}
runner.initialize();
runner.runTests(language, new Integer(suiteId));
}
public void initialize() throws Exception {
//load test script
File aFile = new File("../conf/driver_regression_testscript.json");
BufferedReader reader = new BufferedReader(new FileReader(aFile));
StringBuilder builder = new StringBuilder();
while(true){
String line = reader.readLine();
if(line == null){
break;
}else{
builder.append(line);
}
}
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
aPackage = (TestPackage) mapper.readValue(builder.toString(), TestPackage.class);
//load test data
aFile = new File("../conf/driver_regression_testdata.json");
reader = new BufferedReader(new FileReader(aFile));
builder = new StringBuilder();
while(true){
String line = reader.readLine();
if(line == null){
break;
}else{
builder.append(line);
}
}
testData = (TestData) mapper.readValue(builder.toString(), TestData.class);
reader.close();
}
/**
* Gets the package that is initialized for testing
* @return
*/
public TestPackage getTestPackage() {
return aPackage;
}
/**
* Run the tests after reading test script and test data files.
* @throws Exception
*/
public void runTests(String language, int suiteId) throws Exception {
runTestPackageExternal(aPackage, language, suiteId);
}
/***
* Runs individual test cases in all test suites and stored the result in output object
* @param testPackage
*/
private void runTestPackageExternal(TestPackage testPackage, String language, int suiteId) throws Exception {
/**
* Logic:
*
* 1. Get each test case
*
* 2. based on the patch arrive at the method that needs to be executed
*
* 3. From the method get list of input parameters
*
* 4. Read input parameters based on input structure
*
* 5 Execute method by calling system command
*
* 6. Get the output
*
* 7. Store output in output object
*
* 8. execute assertions
*
* 9. Continue with next test case
*/
Map<Integer, TestResource> resourceMap = new HashMap<Integer, TestResource>();
for(TestResource resource: testPackage.getResources()){
resourceMap.put(resource.getId(), resource);
}
int testPackageId = testPackage.getId();
for(TestSuite suite : testPackage.getTestSuites()) {
if(suiteId != 0 && suiteId != suite.getId()){
continue;
}
int testSuiteId = suite.getId();
//1
for(TestCase testCase : suite.getTestCases()){
String testCasePath = testCasePath(testPackageId , testSuiteId , testCase.getId());
//2
TestResource resource = resourceMap.get(testCase.getResourceId());
String path = resource.getPath();
String className = config.getNameGenerator().getServiceName(path);
String methodName = resource.getSuggestedMethodName();
//3
Class apiClass = Class.forName("com.wordnik.api." + className);
Method[] methods = apiClass.getMethods();
Method methodToExecute = null;
for(Method method : methods){
if(method.getName().equals(methodName)){
methodToExecute = method;
break;
}
}
try {
if(methodToExecute != null) {
//4
Map<String, Object> arguments = getArgumentsForMethodCall(methodToExecute, testCase);
String authToken = "\"\"";
String postData = "\"\"";
StringBuilder queryPathParameters = new StringBuilder();
for(String argName : arguments.keySet()){
Object value = arguments.get(argName);
if(argName.equals("authToken")){
authToken = value.toString();
}else if (argName.equals("postObject")){
postData = convertObjectToJSONString(value);
}else{
if(queryPathParameters.toString().length()> 0){
queryPathParameters.append("~");
}
queryPathParameters.append(argName+"="+value.toString());
}
}
//get eternal command
String[] externalCommand = constructExternalCommand(WordnikAPI.getApiKey(), authToken,
resource.getPath(), resource.getHttpMethod(), resource.getSuggestedMethodName(),
queryPathParameters.toString(), postData, language);
//print the command
System.out.println("Test Case :" + testCasePath);
for(String arg : externalCommand){
System.out.print(arg + " ");
}
System.out.println("");
//execute and get data
String outputString = executeExternalTestCaseAndGetResult(externalCommand);
Object output = null;
if(outputString != null && outputString.length() > 0) {
output = convertJSONStringToObject(outputString, methodToExecute.getReturnType());
}
//6
Class returnType = methodToExecute.getReturnType();
if(!returnType.getName().equalsIgnoreCase("void")){
//7
testCaseOutput.getData().put(testCasePath, output);
}
//8
//log it as passed, if there is any failures in assertions, assertions will update the status
//to failed
testStatus.logStatus(testCase, testCasePath, true);
executeAssertions(testCasePath, testCase);
}
}catch(Exception e){
boolean asserted = false;
if(testCase.getAssertions() != null) {
for(Assertion assertion : testCase.getAssertions()){
if(assertion.getExpectedOutput().equalsIgnoreCase("Exception")){
testStatus.logStatus(testCase, testCasePath, true);
asserted = true;
}
}
}
if(!asserted){
testStatus.logStatus(testCase, testCasePath, false, e.getMessage(), e);
}
}
}
}
System.out.println(testStatus.printTestStatus());
}
/**
* Populate necessayr argument values tat needs ot be populated before calling the method
* @return
*/
protected Map<String, Object> getArgumentsForMethodCall(Method methodToExecute, TestCase testCase) throws Exception {
Map<String, Object> queryPathParameters = new HashMap<String, Object>();
if(testCase.getInput() != null) {
for(String inputParamName: testCase.getInput().keySet()){
Object value = getParamValue(testCase.getInput().get(inputParamName));
queryPathParameters.put(inputParamName, value);
}
}
return queryPathParameters;
}
/**
* Execute all assertions in the test case. If there are nay failures test case will be amrked as failed
* and logged into test status object.
* @param testCase
*/
private void executeAssertions(String testCasePath, TestCase testCase) {
List<Assertion> assertions = testCase.getAssertions();
if(assertions != null) {
for(Assertion assertion: assertions){
try{
Object actualOutPut = getParamValue(assertion.getActualOutput());
Object expectedValue = getParamValue(assertion.getExpectedOutput());
boolean failed = false;
if(assertion.getCondition().equals(CONDITION_EQUAL)){
if(expectedValue.toString().equalsIgnoreCase("NULL") && actualOutPut == null){
failed = false;
}else{
if(expectedValue.getClass().isAssignableFrom(String.class)){
actualOutPut = actualOutPut.toString();
}
if(!actualOutPut.equals(expectedValue)){
failed = true;
}
}
}else if(assertion.getCondition().equals(CONDITION_NOT_EQUAL)){
if(expectedValue.toString().equalsIgnoreCase("EXCEPTION")){
//this means user is not expecting any exception, output can be null, if we have reached
// here means there are no exceptions hence we can call the assertion is passed.
failed = false;
}
else if(actualOutPut == null || actualOutPut.equals(expectedValue)){
failed = true;
}
}else{
float actual = new Float(actualOutPut.toString());
float expected = new Float(expectedValue.toString());
if(assertion.getCondition().equals(CONDITION_GREATER)){
if(!(actual > expected)){
failed = true;
}
}else if(assertion.getCondition().equals(CONDITION_LESSER)){
if(!(actual < expected)){
failed = true;
}
}else if(assertion.getCondition().equals(CONDITION_LESSER_EQUAL)){
if(!(actual <= expected)){
failed = true;
}
}else if(assertion.getCondition().equals(CONDITION_GREATER_EQUAL)){
if(!(actual >= expected)){
failed = true;
}
}
}
if(failed) {
if(actualOutPut == null) {
testStatus.logAssertionStatus(testCasePath, false, expectedValue.toString(), null, assertion.getCondition());
}else{
testStatus.logAssertionStatus(testCasePath, false, expectedValue.toString(), actualOutPut.toString(), assertion.getCondition());
}
} else{
if(actualOutPut == null) {
testStatus.logAssertionStatus(testCasePath, true, expectedValue.toString(), "null", assertion.getCondition());
}else{
testStatus.logAssertionStatus(testCasePath, true, expectedValue.toString(), actualOutPut.toString(), assertion.getCondition());
}
}
}catch(Exception e){
e.printStackTrace();
testStatus.logAssertionStatus(testCasePath, false, assertion.getExpectedOutput(), assertion.getActualOutput(), assertion.getCondition(), e);
}
}
}
}
/**
* creates the test case unique path
* @param packageId
* @param suiteId
* @param caseId
* @return
*/
private String testCasePath(int packageId, int suiteId, int caseId) {
return packageId + "." + suiteId + "." + caseId;
}
/**
* Read the values based on expression.
* The expression can refer the value in input data structure or outputs generated from executing the current or previous
* test cases or direct input. The Test script follow the syntax of ${output if it is referring output data,
* ${input if it is referring input data.
* @param name
* @return
* @throws Exception
*/
private Object getParamValue(String name) throws Exception {
//this means we should use the input form previous steps or data file.
if(name.startsWith("$")){
if(name.startsWith(INPUT_DATA_EXPRESSION_PREFIX)){
String expression = name.substring(7, name.length()-1);
boolean hasSize = false;
if(expression.endsWith("size")){
expression = expression.substring(0, expression.length()-5);
hasSize = true;
}
Object value = PropertyUtils.getProperty(testData, expression);
if(hasSize){
return MethodUtils.invokeMethod(value, "size", null);
}
return value;
}else if(name.startsWith(OUTPUT_DATA_EXPRESSION_PREFIX)) {
String expression = name.substring(9, name.length()-1);
boolean hasSize = false;
if(expression.endsWith("size")){
expression = expression.substring(0, expression.length()-5);
hasSize = true;
}
Object value = PropertyUtils.getProperty(testCaseOutput, expression);
if(hasSize){
return MethodUtils.invokeMethod(value, "size", null);
}
return value;
}else{
throw new RuntimeException("Input expression for parameter " + name + "is not as per valid syntax ");
}
}else{
return name;
}
}
/**
* Converts JSON string to object.
*/
public static Object convertJSONStringToObject(String inputJSON, Class objectType) throws Exception {
boolean isArray = false;
boolean isList = false;
Class className = objectType;
String ObjectTypeName = objectType.getName();
//identify if the input is a array
if(ObjectTypeName.startsWith("[")){
isArray = true;
className = objectType.getComponentType();
}
//identify if the input is a list
if(List.class.isAssignableFrom(objectType)){
isList = true;
}
if(isArray || isList){
Object responseObject = mapper.readValue(inputJSON, TypeFactory.type(objectType));
return responseObject;
}else{
return WordnikAPI.deserialize(inputJSON, className);
}
}
/**
* Converts JSON string to object.
*/
public static String convertObjectToJSONString(Object input) throws Exception {
return WordnikAPI.serialize(input);
}
/**
* Reads the test case results from standard out, converts that into java object and stores the value
* in test case output data so that the same can be used in subsequent test case execution
*
* First line fo response should be a status line with possible values as SUCCESS, ERROR
*/
private String executeExternalTestCaseAndGetResult(String[] command) throws Exception {
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
StringBuilder output = new StringBuilder();
String s = null;
boolean isStatusLine = true;
String status = "";
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
if(isStatusLine){
status = s;
if(status.equalsIgnoreCase("SUCCESS")||status.equalsIgnoreCase("OK") ) {
isStatusLine = false;
}
}else{
output.append(s);
}
}
if(status.equalsIgnoreCase("SUCCESS")||status.equalsIgnoreCase("OK") ) {
return output.toString();
}else{
WordnikAPIException exception = (WordnikAPIException)convertJSONStringToObject(output.toString(),
WordnikAPIException.class);
throw exception;
}
}
/**
* Get the java command line that needs to be executed for runnign a test case
*/
private String[] constructExternalCommand(String apiKey, String authToken, String resource, String httpMethod,
String suggestedMethodName, String queryAndPathParams, String postData,
String language) {
List<String> command = new ArrayList<String>();
if(language.equals(JAVA)){
command.add("./bin/runjava.sh");
command.add("com.wordnik.test.TestCaseExecutor");
}else if (language.equals(PYTHON)){
command.add("../python/runtest.py ");
}else if (language.equals(ANDROID)){
command.add("../android/driver-test/bin/runandroid.sh");
command.add("com.wordnik.test.TestCaseExecutor");
}
command.addAll(getCommandInputs(apiKey, authToken, resource, httpMethod,
suggestedMethodName, queryAndPathParams, postData,
language));
String[] commandArray = new String[command.size()];
command.toArray(commandArray);
return commandArray;
}
private List<String> getCommandInputs(String apiKey, String authToken, String resource, String httpMethod,
String suggestedMethodName, String queryAndPathParams, String postData,
String language) {
List<String> inputs = new ArrayList<String>();
inputs.add(apiKey);
inputs.add(authToken);
inputs.add(resource);
inputs.add(httpMethod);
inputs.add(suggestedMethodName);
inputs.add(queryAndPathParams);
if(postData.equals("\"\"")){
inputs.add(postData);
}else{
//inputs.add(JSONObject.quote(postData));
inputs.add(postData);
}
return inputs;
}
}

View File

@@ -0,0 +1,44 @@
package com.wordnik.test;
public class Assertion {
private String expectedOutput;
private String actualOutputWithOutputWrapper;
private String condition;
private String actualOutput;
public String getExpectedOutput() {
return expectedOutput;
}
public void setExpectedOutput(String expression) {
this.expectedOutput = expression;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public String getActualOutput() {
return actualOutput;
}
public void setActualOutput(String value) {
this.actualOutput = value;
}
public String getActualOutputWithOutputWrapper() {
return actualOutputWithOutputWrapper;
}
public void setActualOutputWithOutputWrapper(String actualOutputWithOutputWrapper) {
this.actualOutputWithOutputWrapper = actualOutputWithOutputWrapper;
}
}

View File

@@ -0,0 +1,77 @@
package com.wordnik.test;
import com.wordnik.model.WordList;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 4/21/11
* Time: 8:35 AM
* To change this template use File | Settings | File Templates.
*/
public class TestAPITestRunner {
public List<String> primitiveStringListType = null;
public List<WordList> objectStringListType = null;
@Test
public void testConversionToArrayOfPrimitive() throws Exception {
String input = "[\"one\", \"two\"]";
String[] returnType = new String[5];
String[] inputArray = (String[])APITestRunner.convertJSONStringToObject(input, returnType.getClass());
assert(inputArray[0].equals("one"));
}
@Test
public void testConversionToArrayOfWordnikObjects() throws Exception {
String input = "[{\"name\":\"one\", \"id\":1},{\"name\":\"two\", \"id\":2}]";
WordList[] returnType = new WordList[5];
WordList[] inputArray = (WordList[])APITestRunner.convertJSONStringToObject(input, returnType.getClass());
assert(inputArray[0].getName().equals("one1"));
}
@Test
public void testConversionToListOfPrimitive() throws Exception {
String input = "[\"one\", \"two\"]";
Class argClass = null;
for(Method method :this.getClass().getMethods()){
if(method.getName().equals("methodWithArrayObjectInput")){
argClass = method.getParameterTypes()[0];
}
}
List<String> inputArray = (List<String>)APITestRunner.convertJSONStringToObject(input, argClass);
assert(inputArray.get(0).equals("one"));
}
@Test
public void testConversionToListOfWordnikObjects() throws Exception {
String input = "[{\"name\":\"one\", \"id\":1},{\"name\":\"two\", \"id\":2}]";
Class argClass = null;
for(Method method :this.getClass().getMethods()){
if(method.getName().equals("methodWithListObjectInput")){
argClass = method.getParameterTypes()[0];
}
}
List<WordList> inputArray = (List<WordList>)APITestRunner.convertJSONStringToObject(input, argClass);
assert(inputArray.get(0).getName().equals("one"));
}
/**
* Tets method to read argument types
*/
public void methodWithListObjectInput(List<WordList> list){
}
/**
* Tets method to read argument types
*/
public void methodWithArrayObjectInput(WordList[] list){
}
}

View File

@@ -0,0 +1,77 @@
package com.wordnik.test;
import java.util.List;
import java.util.Map;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
/**
* Test case executes individual test case. A given test suite has one or many test cases.
* @author ramesh
*
*/
public class TestCase {
private String name;
private int id;
private int resourceId;
private Map<String, String> input;
private String referenceInput;
private List<Assertion> assertions;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public Map<String, String> getInput() {
return input;
}
public void setInput(Map<String, String> input) {
this.input = input;
}
public String getReferenceInput() {
return referenceInput;
}
public void setReferenceInput(String referenceInput) {
this.referenceInput = referenceInput;
}
public List<Assertion> getAssertions() {
return assertions;
}
public void setAssertions(List<Assertion> assertions) {
this.assertions = assertions;
}
}

View File

@@ -0,0 +1,206 @@
package com.wordnik.test;
import com.wordnik.annotations.MethodArgumentNames;
import com.wordnik.api.WordAPI;
import com.wordnik.codegen.DriverCodeGenerator;
import com.wordnik.codegen.config.CodeGenConfig;
import com.wordnik.codegen.java.JavaCodeGenConfig;
import com.wordnik.codegen.resource.Resource;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.exception.WordnikExceptionCodes;
import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jettison.json.JSONObject;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* Instance of this class runs single test case
* User: ramesh
* Date: 4/22/11
* Time: 7:32 AM
*/
public class TestCaseExecutor {
private CodeGenConfig config = new JavaCodeGenConfig();
/**
* Follow the following argument pattern
* First argument is api <apiKey>
* Second argument is auth token <auth token>
* Third argument will be name of resource
* Fourth argument will be HTTP method name
* Fifth argument will be suggested methdo name
* 6th argument is for query and path parameters, if not available then gets empty string
* 7th argument is for post data, if not available get empty string
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
WordAPI.initialize("c23b746d074135dc9500c0a61300a3cb7647e53ec2b9b658e", "http://beta.wordnik.com/v4/", false);
TestCaseExecutor runner = new TestCaseExecutor();
String apiKey = args[0];
String authToken = args[1];
String resource = args[2];
String method = args[3];
String suggestedMethodName = args[4];
Map<String, String> queryAndPathParameters = new HashMap<String, String>();
String postData = null;
if(args.length > 5 && args[5].length() > 0){
String[] qpTuple = args[5].split("~");
for(String tuple: qpTuple){
String[] nameValue = tuple.split("=");
queryAndPathParameters.put(nameValue[0], nameValue[1]);
}
}
if(args.length > 6 ){
postData = args[6];
}
queryAndPathParameters.put("authToken", authToken);
runner.executeTestCase(resource, method, suggestedMethodName, apiKey, authToken, queryAndPathParameters,
postData);
}
private void executeTestCase(String resourceName, String httpMethod, String suggestedName, String apiKey,
String authToken, Map<String, String> queryAndPathParameters, String postData) {
String className = config.getNameGenerator().getServiceName(resourceName);
String methodName = suggestedName;
//3
try {
Class apiClass = Class.forName("com.wordnik.api." + className);
Method[] methods = apiClass.getMethods();
Method methodToExecute = null;
for(Method method : methods){
if(method.getName().equals(methodName)){
methodToExecute = method;
break;
}
}
if(methodToExecute != null) {
//4
Object[] arguments = populateArgumentsForTestCaseExecution(methodToExecute, queryAndPathParameters,
postData);
Object output = null;
if(arguments != null && arguments.length > 0){
//5
output = methodToExecute.invoke(null, arguments);
}else{
//5
output = methodToExecute.invoke(null);
}
//6
System.out.println("SUCCESS");
System.out.println(APITestRunner.convertObjectToJSONString(output));
}
}catch(WordnikAPIException e){
StringWriter sWriter = new StringWriter();
PrintWriter writer = new PrintWriter(sWriter);
e.printStackTrace(writer);
System.out.println(sWriter.getBuffer().toString());
System.out.println(e.getMessage());
System.out.println("ERROR");
try{
System.out.println(APITestRunner.convertObjectToJSONString(e));
}catch(Exception ex){
ex.printStackTrace();
}
} catch(Exception e){
StringWriter sWriter = new StringWriter();
PrintWriter writer = new PrintWriter(sWriter);
e.printStackTrace(writer);
System.out.println(sWriter.getBuffer().toString());
e.printStackTrace();
System.out.println("ERROR");
try{
WordnikAPIException apiException = new WordnikAPIException(WordnikExceptionCodes.SYSTEM_EXCEPTION,
e.getMessage());
System.out.println(APITestRunner.convertObjectToJSONString(apiException));
}catch(Exception ex){
ex.printStackTrace();
}
}
}
/**
* Gets the list of input query and path parameters and post data vlues and covenrt them to arguments that
* can be used for calling the method. This logic will be different in each driver language depends on how method
* input arguments are created.
*/
private Object[] populateArgumentsForTestCaseExecution(Method methodToExecute, Map<String, String> queryAndPathParameters,
String postData) throws Exception {
MethodArgumentNames argNames = methodToExecute.getAnnotation(MethodArgumentNames.class);
String[] argNamesArray = null;
if(argNames != null && argNames.value().length() > 0) {
argNamesArray = argNames.value().split(",");
}
Class[] argTypesArray = methodToExecute.getParameterTypes();
Object output = null;
if(argNamesArray != null && argNamesArray.length > 0){
Object[] arguments = new Object[argNamesArray.length];
for(int i=0; i < argNamesArray.length; i++){
Object argument = null;
String canonicalName = argTypesArray[i].getCanonicalName();
Class superclass = (Class)argTypesArray[i].getGenericSuperclass();
//if the input argument is of type wordnik object then it is posisble that the object could be either
// post data or input wrapper object created by code generator. If it is wrpper object then use the
// individual query and path parameters to create the wrapper object. If it is post data directly
// convert input JSON string to post data object
if(superclass != null && superclass.getSimpleName().equalsIgnoreCase("WordnikObject")){
if(argNamesArray[i].trim().equals("postObject")){
argument = APITestRunner.convertJSONStringToObject(postData, argTypesArray[i]);
}else{
argument = populateWordnikInputModelObject(argTypesArray[i], queryAndPathParameters);
}
}else{
//the aruments can be primitive types for query and path data and for post data it could be either
//a object or collection of objects. Hence we need to identify the input is single or colection
//based on that un-marshal the string
if(argNamesArray[i].trim().equals("postObject")){
argument = APITestRunner.convertJSONStringToObject(postData, argTypesArray[i]);
}else{
argument = queryAndPathParameters.get(argNamesArray[i].trim());
}
}
arguments[i] = argument;
}
return arguments;
}
return null;
}
/**
* Populates the wordnik inout object.
* The definitions for the input will refer the attribute name directly as the input object is more of java driver concept
* hence the test script can not create the input with reference to input object. Test scirpt will only use attribute name.
* Example: If we are looking for a attribute called limit inside an WordExampleInput the input definitions in test script
* will have an entry as "input":10 (please note that there is no reference to input object)
* @param inputDefinitions
* @return
*/
private Object populateWordnikInputModelObject(Class wordnikClass, Map<String, String> inputDefinitions) throws Exception {
Object object = wordnikClass.getConstructor().newInstance();
Method[] methods = wordnikClass.getMethods();
for(Method method : methods){
if(method.getName().startsWith("get")){
String methodName = method.getName();
String fieldName = methodName.substring(3);
fieldName = config.getNameGenerator().convertToMethodNameFormat(fieldName);
Object value = inputDefinitions.get(fieldName);
BeanUtils.setProperty(object, fieldName, value);
}
}
return object;
}
}

View File

@@ -0,0 +1,61 @@
package com.wordnik.test;
import com.wordnik.api.WordAPI;
import com.wordnik.api.WordListAPI;
import com.wordnik.exception.WordnikAPIException;
import com.wordnik.model.WordList;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.AnnotationIntrospector;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
import org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector;
import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
import org.junit.Test;
import java.lang.reflect.Method;
/**
* Created by IntelliJ IDEA.
* User: ramesh
* Date: 4/15/11
* Time: 7:02 AM
* To change this template use File | Settings | File Templates.
*/
public class TestMethodInputs {
public static void main(String[] args) {
try {
TestMethodInputs atest = new TestMethodInputs();
atest.testConversionToArrayOfPrimitive();
}catch(Exception e){
e.printStackTrace();
}
}
@Test
public void testExceptionDeserialize() throws Exception {
String input = "{\"message\":\"No value specified for 'Date'\",\"code\":0}";
WordnikAPIException exception = (WordnikAPIException)APITestRunner.convertJSONStringToObject(input, WordnikAPIException.class);
assert (exception != null);
}
@Test
public void testConversionToArrayOfPrimitive() throws Exception {
String input = "[\"one\", \"two\"]";
String[] returnType = new String[5];
String[] inputArray = (String[])APITestRunner.convertJSONStringToObject(input, returnType.getClass());
assert(inputArray[0].equals("one"));
}
@Test
public void testConversionToArrayOfWordnikObjects() throws Exception {
String input = "[{\"name\":\"one\", \"id\":1},{\"name\":\"two\", \"id\":2}]";
WordList[] returnType = new WordList[5];
WordList[] inputArray = (WordList[])APITestRunner.convertJSONStringToObject(input, returnType.getClass());
assert(inputArray[3].getName().equals("one1"));
}
}

View File

@@ -0,0 +1,18 @@
package com.wordnik.test;
import java.util.HashMap;
import java.util.Map;
public class TestOutput {
Map<String, Object> data = new HashMap<String, Object>();
public Map<String, Object> getData() {
return data;
}
public void setData(Map<String, Object> data) {
this.data = data;
}
}

View File

@@ -0,0 +1,59 @@
package com.wordnik.test;
import java.util.List;
public class TestPackage {
private int id;
private List<TestResource> resources;
private List<TestSuite> testSuites;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<TestResource> getResources() {
return resources;
}
public void setResources(List<TestResource> resources) {
this.resources = resources;
}
public List<TestSuite> getTestSuites() {
return testSuites;
}
public void setTestSuites(List<TestSuite> testSuites) {
this.testSuites = testSuites;
}
public TestCase getTestCaseById(int suiteId, int caseId) {
TestSuite aSuite = null;
TestCase aTestCase = null;
if(this.getTestSuites() != null){
for(TestSuite suite : getTestSuites()){
if(suite.getId() == suiteId){
aSuite = suite;
break;
}
}
}
if(aSuite != null){
for(TestCase testCase : aSuite.getTestCases()){
if(testCase.getId() == caseId){
aTestCase = testCase;
break;
}
}
}
return aTestCase;
}
}

View File

@@ -0,0 +1,55 @@
package com.wordnik.test;
public class TestResource {
private int id;
private String name;
private String httpMethod;
private String path;
private String suggestedMethodName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(String method) {
this.httpMethod = method;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getSuggestedMethodName() {
return suggestedMethodName;
}
public void setSuggestedMethodName(String suggestedMethodName) {
this.suggestedMethodName = suggestedMethodName;
}
}

View File

@@ -0,0 +1,167 @@
package com.wordnik.test;
import java.io.BufferedOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Stores the status of the tests executed.
* @author ramesh
*
*/
public class TestStatus {
private int totalTestCaseCount;
private int failedTestCaseCount;
private List<TestCaseStatus> testCaseStatuses = new ArrayList<TestCaseStatus>();
private Map<String, TestCaseStatus> testCaseStatusMap = new HashMap<String, TestCaseStatus>();
public void logStatus(TestCase testCase, String testCasePath, boolean passed){
logStatus(testCase, testCasePath, passed, null, null);
}
public void logStatus(TestCase testCase, String testCasePath, boolean passed, String failureDescription){
logStatus(testCase, testCasePath, passed, failureDescription, null);
}
public void logStatus(TestCase testCase, String testCasePath, boolean passed, String failureDescription, Throwable exception){
TestCaseStatus status = new TestCaseStatus(testCase, testCasePath, passed, failureDescription, exception);
testCaseStatuses.add(status);
testCaseStatusMap.put(testCasePath, status);
totalTestCaseCount++;
if(!passed){
failedTestCaseCount++;
}
}
public void logAssertionStatus(String path, boolean passed, String expectedValue, String actualValue, String condition) {
logAssertionStatus(path, passed, expectedValue, actualValue, condition, null);
}
public void logAssertionStatus(String path, boolean passed, String expectedValue, String actualValue, String condition, Throwable stack) {
TestCaseStatus status = testCaseStatusMap.get(path);
if(!passed && status.passed) {
status.passed = false;
failedTestCaseCount++;
}
status.addAssertionStatus(passed, expectedValue, actualValue, condition, stack);
}
public String printTestStatus() {
StringBuilder output = new StringBuilder();
output.append("Summary --> Total Test Cases: " + totalTestCaseCount + " Failed Test Cases: " + failedTestCaseCount);
output.append("\nDetails: \n");
for(TestCaseStatus status : testCaseStatuses) {
output.append(status.getStatusDescription() + "\n");
}
return output.toString();
}
/**
* Indicates if there are any failured in executing the test cases.
* @return
*/
public boolean hasFailures() {
return (failedTestCaseCount > 0);
}
/**
* Inner class Stores the details on individual test cases.
* @author ramesh
*
*/
private class TestCaseStatus {
String testCasePath;
boolean passed;
String failureDescription;
Throwable exceptionStack;
TestCase testCase;
List<AssertionStatus> assertionStatuses = new ArrayList<TestStatus.AssertionStatus>();
public TestCaseStatus(TestCase testCase, String testCasePath, boolean passed, String failureDescription,
Throwable exceptionStack) {
this.exceptionStack = exceptionStack;
this.testCase = testCase;
this.passed = passed;
this.failureDescription = failureDescription;
this.testCasePath = testCasePath;
}
public void addAssertionStatus(boolean passed, String expectedValue, String actualValue, String condition, Throwable stack) {
String assertionDesc = expectedValue + " " + condition + " " + actualValue;
AssertionStatus status = new AssertionStatus(assertionDesc, passed, stack);
assertionStatuses.add(status);
if(!passed){
this.passed = false;
}
}
public String getStatusDescription(){
StringBuilder output = new StringBuilder();
if(passed){
output.append(testCasePath);
output.append(" : ");
output.append(testCase.getName());
output.append(" : ");
output.append(" passed ");
output.append(" \n ");
}else{
output.append(testCasePath);
output.append(" : ");
output.append(testCase.getName());
output.append(" : ");
output.append(" failed ");
output.append(" \n ");
if ( failureDescription != null) {
output.append(" failure message : ");
output.append(failureDescription + "\n");
}
if(exceptionStack != null){
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out);
exceptionStack.printStackTrace(writer);
output.append(out.toString());
}
for(AssertionStatus status:assertionStatuses){
if(!status.passed) {
output.append(status.getAssertionDescription()+"\n");
}
}
}
return output.toString();
}
}
private class AssertionStatus {
String assertionDescription;
boolean passed;
Throwable exceptionStack;
public AssertionStatus(String description, boolean passed, Throwable stack){
this.assertionDescription = description;
this.passed = passed;
this.exceptionStack = stack;
}
public String getAssertionDescription() {
return assertionDescription + " : " + (passed ? "Passed " : " Failed ") + ((exceptionStack !=null) ? exceptionStack.getMessage() : "" );
}
}
}

View File

@@ -0,0 +1,45 @@
package com.wordnik.test;
import java.util.List;
/**
* Test suite contains collection of test cases.
*
* As a best practice write one test suite for each resource
* @author ramesh
*
*/
public class TestSuite {
private String name ;
private int id;
private List<TestCase> testCases;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<TestCase> getTestCases() {
return testCases;
}
public void setTestCases(List<TestCase> testCases) {
this.testCases = testCases;
}
}