View Javadoc

1   /*
2    * Copyright (c) 2010 Commsen International. All rights reserved.
3    * 
4    * This file is part of JWebThumb library.
5    *	
6    * JWebThumb library is free software: you can redistribute it and/or modify 
7    * it under the terms of the GNU Lesser General Public License as published by
8    * the Free Software Foundation, either version 2 of the License, or
9    * (at your option) any later version.
10   * 
11   * JWebThumb library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Lesser General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Lesser General Public License
17   * along with JWebThumb library.  If not, see <http://www.gnu.org/licenses/lgpl.html>.
18   */
19  
20  package com.commsen.jwebthumb;
21  
22  import java.util.LinkedList;
23  import java.util.List;
24  
25  import org.simpleframework.xml.ElementList;
26  
27  /***
28   * This class represents the payload of webthumb's 'status' API call. See <a
29   * href="http://webthumb.bluga.net/apidoc#status">http://webthumb.bluga.net/apidoc#status</a> for
30   * details
31   * 
32   * @author <a href="mailto:MilenDyankov@gmail.com">Milen Dyankov</a>
33   * @since 0.3
34   */
35  public class WebThumbStatusRequest {
36  
37  	@ElementList(required = false, inline = true, entry = "url")
38  	private List<String> urls = null;
39  
40  	@ElementList(required = false, inline = true, entry = "job")
41  	private List<String> jobs = null;
42  
43  
44  	/***
45  	 * Adds new URL to the request list
46  	 * 
47  	 * @param url the URL to add
48  	 */
49  	public void addUrl(String url) {
50  		if (url == null) throw new IllegalArgumentException("url can not be null");
51  		if (urls == null) urls = new LinkedList<String>();
52  		urls.add(url);
53  	}
54  
55  
56  	/***
57  	 * Adds new job id to the request list
58  	 * 
59  	 * @param url the job id to add
60  	 */
61  	public void addJob(String job) {
62  		if (job == null) throw new IllegalArgumentException("job can not be null");
63  		if (jobs == null) jobs = new LinkedList<String>();
64  		jobs.add(job);
65  	}
66  }