View Javadoc

1   /**
2    * Copyright (C) 2008 Atlassian
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.connector.commons.jira.beans;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  public class JIRASavedFilterBean implements JIRASavedFilter {
23      private String name;
24      private String author;
25      private String project;
26      private long id;
27  
28      public JIRASavedFilterBean(Map projMap) {
29          name = (String) projMap.get("name");
30          author = (String) projMap.get("author");
31          project = (String) projMap.get("project");
32          id = Long.valueOf((String) projMap.get("id"));
33      }
34  
35  	public JIRASavedFilterBean(String n, long id) {
36  		name = n;
37  		this.id = id;
38  	}
39  
40  	public JIRASavedFilterBean(JIRASavedFilterBean other) {
41  		this(other.getMap());
42  	}
43  
44  	public String getName() {
45          return name;
46      }
47  
48  	public HashMap<String, String> getMap() {
49  		HashMap<String, String> map = new HashMap<String, String>();
50  		map.put("name", getName());
51  		map.put("id", Long.toString(id));
52  		map.put("author", getAuthor());
53  		map.put("project", getProject());
54  		map.put("filterTypeClass", this.getClass().getName());
55  		return map;
56  	}
57  
58  	public JIRASavedFilterBean getClone() {
59  		return new JIRASavedFilterBean(this);
60  	}
61  
62  	public long getId() {
63          return id;
64      }
65  
66  	public String getAuthor() {
67  		return author;
68  	}
69  
70  	public String getProject() {
71  		return project;
72  	}
73  
74  	public String getQueryStringFragment() {
75          return Long.toString(id);
76      }
77  }