001/**
002 * Copyright 2015 Tampere University of Technology, Pori Department
003 * 
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 *   http://www.apache.org/licenses/LICENSE-2.0
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package service.tut.pori.twitterjazz.reference;
017
018import service.tut.pori.twitterjazz.Definitions;
019import core.tut.pori.http.Response;
020import core.tut.pori.http.annotations.HTTPMethodParameter;
021import core.tut.pori.http.annotations.HTTPService;
022import core.tut.pori.http.annotations.HTTPServiceMethod;
023import core.tut.pori.http.parameters.Limits;
024
025/**
026 * Generates example XML output
027 * 
028 */
029@HTTPService(name = service.tut.pori.twitterjazz.reference.Definitions.SERVICE_TJ_REFERENCE_EXAMPLE)
030public class ExampleService {
031  /**
032   * Generates example task response
033   * 
034   * @param limits paging limits
035   * @return TwitterTaskResponse
036   * @see service.tut.pori.twitterjazz.TwitterTaskResponse
037   */
038  @HTTPServiceMethod(name = service.tut.pori.contentanalysis.Definitions.ELEMENT_TASK_RESULTS)
039  public Response taskResults(
040      @HTTPMethodParameter(name = Limits.PARAMETER_DEFAULT_NAME, required=false, defaultValue="0-0") Limits limits
041      ) 
042  {
043    Example example = new Example();
044    example.setTaskResponse(TJReferenceCore.generateTaskResponse(limits));
045    return new Response(example);
046  }
047  
048  /**
049   * Generates example task details
050   * 
051   * @param limits paging limits
052   * @return TwitterSummarizationTaskDetails
053   * @see service.tut.pori.twitterjazz.TwitterSummarizationTaskDetails
054   */
055  @HTTPServiceMethod(name = service.tut.pori.contentanalysis.Definitions.ELEMENT_TASK_DETAILS)
056  public Response taskDetails(
057      @HTTPMethodParameter(name = Limits.PARAMETER_DEFAULT_NAME, required=false, defaultValue="0-0") Limits limits
058      ) 
059  {
060    Example example = new Example();
061    example.setTaskDetails(TJReferenceCore.generateTwitterSummarizationTaskDetails(limits));
062    return new Response(example);
063  }
064  
065  /**
066   * Generates example TwitterLocation
067   * 
068   * @return TwitterLocation
069   * @see service.tut.pori.twitterjazz.TwitterLocation
070   */
071  @HTTPServiceMethod(name = Definitions.ELEMENT_LOCATION)
072  public Response twitterLocation() {
073    Example example = new Example();
074    example.setTwitterLocation(TJReferenceCore.generateTwitterLocation());
075    return new Response(example);
076  }
077  
078  /**
079   * Generates example TwitterPhotoDescription
080   * 
081   * @return TwitterPhotoDescription
082   * @see service.tut.pori.twitterjazz.TwitterPhotoDescription
083   */
084  @HTTPServiceMethod(name = Definitions.ELEMENT_PHOTO_DESCRIPTION)
085  public Response twitterPhotoDescription() {
086    Example example = new Example();
087    example.setTwitterPhotoDescription(TJReferenceCore.generateTwitterPhotoDescription());
088    return new Response(example);
089  }
090  
091  /**
092   * Generates example TwitterPhotoTag
093   * 
094   * @return TwitterPhotoTag
095   * @see service.tut.pori.twitterjazz.TwitterPhotoTag
096   */
097  @HTTPServiceMethod(name = Definitions.ELEMENT_PHOTO_TAG)
098  public Response twitterPhotoTag() {
099    Example example = new Example();
100    example.setTwitterPhotoTag(TJReferenceCore.generateTwitterPhotoTag());
101    return new Response(example);
102  }
103  
104  /**
105   * Generates example TwitterProfile
106   * 
107   * @return TwitterProfile
108   * @see service.tut.pori.twitterjazz.TwitterProfile
109   */
110  @HTTPServiceMethod(name = Definitions.ELEMENT_TWITTER_PROFILE)
111  public Response twitterProfile() {
112    Example example = new Example();
113    example.setTwitterProfile(TJReferenceCore.generateTwitterProfile());
114    return new Response(example);
115  }
116  
117  /**
118   * Generates example TwitterStatusMessage
119   * 
120   * @return TwitterStatusMessage
121   * @see service.tut.pori.twitterjazz.TwitterStatusMessage
122   */
123  @HTTPServiceMethod(name = Definitions.ELEMENT_STATUS_MESSAGE)
124  public Response twitterStatusMessage() {
125    Example example = new Example();
126    example.setTwitterStatusMessage(TJReferenceCore.generateTwitterStatusMessage());
127    return new Response(example);
128  }
129  
130  /**
131   * Generates example TwitterUserDetails
132   * 
133   * @return TwitterUserDetails
134   * @see service.tut.pori.twitterjazz.TwitterUserDetails
135   */
136  @HTTPServiceMethod(name = Definitions.ELEMENT_USER_DETAILS)
137  public Response twitterUserDetails() {
138    Example example = new Example();
139    example.setTwitterUserDetails(TJReferenceCore.generateTwitterUserDetails());
140    return new Response(example);
141  }
142  
143  /**
144   * Generates example TwitterVideoDescription
145   * 
146   * @return TwitterVideoDescription
147   * @see service.tut.pori.twitterjazz.TwitterVideoDescription
148   */
149  @HTTPServiceMethod(name = Definitions.ELEMENT_VIDEO_DESCRIPTION)
150  public Response twitterVideoDescription() {
151    Example example = new Example();
152    example.setTwitterVideoDescription(TJReferenceCore.generateTwitterVideoDescription());
153    return new Response(example);
154  }
155}