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.fileservice.reference;
017
018import service.tut.pori.fileservice.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.fileservice.reference.Definitions.SERVICE_FS_REFERENCE_EXAMPLE)
030public class ExampleService {
031  /**
032   * Generates example file list
033   * 
034   * @param limits paging limits
035   * @return FileList
036   * @see service.tut.pori.fileservice.FileList
037   */
038  @HTTPServiceMethod(name = Definitions.ELEMENT_FILELIST)
039  public Response fileList(
040      @HTTPMethodParameter(name = Limits.PARAMETER_DEFAULT_NAME, required=false, defaultValue="0-0") Limits limits
041      ) 
042  {
043    Example example = new Example();
044    example.setFileList(FileReferenceCore.generateFileList(limits));
045    return new Response(example);
046  }
047  
048  /**
049   * Generates example file
050   * 
051   * @return File
052   * @see service.tut.pori.fileservice.File
053   */
054  @HTTPServiceMethod(name = Definitions.ELEMENT_FILE)
055  public Response fileList() {
056    Example example = new Example();
057    example.setFile(FileReferenceCore.generateFile());
058    return new Response(example);
059  }
060}