Skip to main content
summaryrefslogtreecommitdiffstats
blob: f618f4b26920bccf855ae1af0abfc1e7c97aac26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*******************************************************************************
 * Copyright (c) 2004, 2008 Frank Becker and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Frank Becker - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.bugzilla.core;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Class describing a custom Fields for a given Bugzilla installation.
 * 
 * @author Frank Becker
 * @since 2.3
 */
public class BugzillaCustomField implements Serializable {

	// old version	private static final long serialVersionUID = 5703683576871326128L;
	private static final long serialVersionUID = 7273310489883205486L;

	public static final String CUSTOM_FIELD_PREFIX = "cf_";

	private final String name;

	private final String description;

	private List<String> options = new ArrayList<String>();

	final private int type;

	final private String typeDesc;

	final private boolean enterBug;

	public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) {
		this.description = description;
		this.name = name;

		this.type = parseInt(type);
		this.typeDesc = typeDesc;
		this.enterBug = "1".equals(enterBug);
	}

	private int parseInt(String type) {
		try {
			return Integer.parseInt(type);
		} catch (NumberFormatException e) {
			return -1;
		}
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public List<String> getOptions() {
		return options;
	}

	public void setOptions(List<String> options) {
		this.options = options;
	}

	public void addOption(String option) {
		this.options.add(option);
	}

	/*
	* @since 3.0.2
	*/
	public int getType() {
		return type;
	}

	/*
	* @since 3.0.2
	*/
	public String getTypeDesc() {
		return typeDesc;
	}

	/*
	* @since 3.0.2
	*/
	public boolean isEnterBug() {
		return enterBug;
	}

}

Back to the top