Subversion Repositories XServices

Rev

Rev 31 | Rev 39 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 33
1
/*
1
/*
2
 *   Mylyn Connector for Serena Business Mashups
2
 *   Mylyn Connector for Serena Business Mashups
3
 * 	 Copyright 2010 Brian Rosenberger (Brutex Network)
3
 * 	 Copyright 2010 Brian Rosenberger (Brutex Network)
4
 *
4
 *
5
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   Licensed under the Apache License, Version 2.0 (the "License");
6
 *   you may not use this file except in compliance with the License.
6
 *   you may not use this file except in compliance with the License.
7
 *   You may obtain a copy of the License at
7
 *   You may obtain a copy of the License at
8
 *
8
 *
9
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *       http://www.apache.org/licenses/LICENSE-2.0
10
 *
10
 *
11
 *   Unless required by applicable law or agreed to in writing, software
11
 *   Unless required by applicable law or agreed to in writing, software
12
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   distributed under the License is distributed on an "AS IS" BASIS,
13
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *   See the License for the specific language governing permissions and
14
 *   See the License for the specific language governing permissions and
15
 *   limitations under the License.
15
 *   limitations under the License.
16
 * 
16
 * 
17
 *   Serena, TeamTrack and Serena Business Mashup are 
17
 *   Serena, TeamTrack and Serena Business Mashup are 
18
 * 	 registered trademarks of SERENA Software Inc.
18
 * 	 registered trademarks of SERENA Software Inc.
19
 */
19
 */
20
package net.brutex.mylyn.sbmconnector.core;
20
package net.brutex.mylyn.sbmconnector.core;
21
 
21
 
22
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
22
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
23
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
23
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
24
 
24
 
25
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
25
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
26
 
26
 
27
 
27
 
28
/**
28
/**
29
 * Map the Mylyn TaskAttributes to SBMTicket Attributes and vice versa.
29
 * Map the Mylyn TaskAttributes to SBMTicket Attributes and vice versa.
30
 * @author Brian Rosenberger
30
 * @author Brian Rosenberger
31
 *
31
 *
32
 */
32
 */
33
public enum SBMTicketAttribute {
33
public enum SBMTicketAttribute {
34
	DESCRIPTION(
34
	DESCRIPTION(
35
			"DESCRIPTION", 
35
			"DESCRIPTION", 
36
			"label_description",
36
			"label_description",
37
			SBMFieldTypes.TEXT,
37
			SBMFieldTypes.TEXT,
38
			TaskAttribute.DESCRIPTION, 
38
			TaskAttribute.DESCRIPTION, 
39
			TaskAttribute.TYPE_LONG_RICH_TEXT,
39
			TaskAttribute.TYPE_LONG_RICH_TEXT,
40
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
40
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
41
	ID(
41
	ID(
42
			SBMStaticFields.ID.getValue(),
42
			SBMStaticFields.ID.getValue(),
43
			"ts_id",
43
			"ts_id",
44
			SBMFieldTypes.SYSTEM,
44
			SBMFieldTypes.SYSTEM,
45
			TaskAttribute.TASK_KEY, 
45
			TaskAttribute.TASK_KEY, 
46
			TaskAttribute.TYPE_SHORT_TEXT,
46
			TaskAttribute.TYPE_SHORT_TEXT,
47
			SBMTicketAttribute.HIDDEN),
47
			SBMTicketAttribute.HIDDEN),
48
	UUID(
48
	UUID(
49
			SBMStaticFields.UUID.getValue(),
49
			SBMStaticFields.UUID.getValue(),
50
			"ts_uuid",
50
			"ts_uuid",
51
			SBMFieldTypes.SYSTEM,
51
			SBMFieldTypes.SYSTEM,
52
			TaskAttribute.KIND_DEFAULT, 
52
			TaskAttribute.KIND_DEFAULT, 
53
			TaskAttribute.TYPE_SHORT_TEXT,
53
			TaskAttribute.TYPE_SHORT_TEXT,
54
			SBMTicketAttribute.HIDDEN),
54
			SBMTicketAttribute.HIDDEN),
55
	PROJECT(
55
	PROJECT(
56
			SBMStaticFields.PROJECTID.getValue(),
56
			SBMStaticFields.PROJECTID.getValue(),
57
			"label_project",
57
			"label_project",
58
			SBMFieldTypes.SYSTEM,
58
			SBMFieldTypes.SYSTEM,
59
			TaskAttribute.PRODUCT, 
59
			TaskAttribute.PRODUCT, 
60
			TaskAttribute.TYPE_SHORT_TEXT),
60
			TaskAttribute.TYPE_SHORT_TEXT),
61
	STATE(
61
	STATE(
62
			SBMStaticFields.STATE.getValue(),
62
			SBMStaticFields.STATE.getValue(),
63
			"label_state",
63
			"label_state",
64
			SBMFieldTypes.SYSTEM,
64
			SBMFieldTypes.SYSTEM,
65
			TaskAttribute.STATUS, 
65
			TaskAttribute.STATUS, 
66
			TaskAttribute.TYPE_SHORT_TEXT,
66
			TaskAttribute.TYPE_SHORT_TEXT,
67
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
67
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
68
	SUBMITTER(
68
	SUBMITTER(
69
			SBMStaticFields.SUBMITTER.getValue(),
69
			SBMStaticFields.SUBMITTER.getValue(),
70
			"label_submitter",
70
			"label_submitter",
71
			SBMFieldTypes.USER,
71
			SBMFieldTypes.USER,
72
			TaskAttribute.USER_REPORTER, 
72
			TaskAttribute.USER_REPORTER, 
73
			TaskAttribute.TYPE_PERSON),	
73
			TaskAttribute.TYPE_PERSON),	
74
	SUBMITDATE(
74
	SUBMITDATE(
75
			SBMStaticFields.SUBMITDATE.getValue(),
75
			SBMStaticFields.SUBMITDATE.getValue(),
76
			"label_submitdate",
76
			"label_submitdate",
77
			SBMFieldTypes.DATETIME,
77
			SBMFieldTypes.DATETIME,
78
			TaskAttribute.DATE_CREATION, 
78
			TaskAttribute.DATE_CREATION, 
79
			TaskAttribute.TYPE_DATETIME),
79
			TaskAttribute.TYPE_DATETIME),
80
	LASTMODIFIER(
80
	LASTMODIFIER(
81
			SBMStaticFields.LASTMODIFIER.getValue(),
81
			SBMStaticFields.LASTMODIFIER.getValue(),
82
			"label_last modifier",
82
			"label_last modifier",
83
			SBMFieldTypes.USER,
83
			SBMFieldTypes.USER,
84
			TaskAttribute.PERSON_NAME, 
84
			TaskAttribute.PERSON_NAME, 
85
			TaskAttribute.TYPE_PERSON),
85
			TaskAttribute.TYPE_PERSON),
86
	LASTMODIFIEDDATE(
86
	LASTMODIFIEDDATE(
87
			SBMStaticFields.LASTMODIFIEDDATE.getValue(),
87
			SBMStaticFields.LASTMODIFIEDDATE.getValue(),
88
			"label_modifieddate",
88
			"label_modifieddate",
89
			SBMFieldTypes.DATETIME,
89
			SBMFieldTypes.DATETIME,
90
			TaskAttribute.DATE_MODIFICATION, 
90
			TaskAttribute.DATE_MODIFICATION, 
91
			TaskAttribute.TYPE_DATETIME),
91
			TaskAttribute.TYPE_DATETIME),
-
 
92
	CLOSEDATE(
-
 
93
			SBMStaticFields.CLOSEDATE.getValue(),
-
 
94
			"label_closedate",
-
 
95
			SBMFieldTypes.DATETIME,
-
 
96
			TaskAttribute.DATE_DUE, 
-
 
97
			TaskAttribute.TYPE_DATETIME),
92
	ITEMURL(
98
	ITEMURL(
93
			SBMStaticFields.ITEMURL.getValue(),
99
			SBMStaticFields.ITEMURL.getValue(),
94
			"Item Link:",
100
			"Item Link:",
95
			SBMFieldTypes.SYSTEM,
101
			SBMFieldTypes.SYSTEM,
96
			TaskAttribute.TASK_URL, 
102
			TaskAttribute.TASK_URL, 
97
			TaskAttribute.TYPE_URL,
103
			TaskAttribute.TYPE_URL,
98
			SBMTicketAttribute.HIDDEN),
104
			SBMTicketAttribute.HIDDEN),
99
	TITLE(
105
	TITLE(
100
			"TITLE",
106
			"TITLE",
101
			"label_title",
107
			"label_title",
102
			SBMFieldTypes.TEXT,
108
			SBMFieldTypes.TEXT,
103
			TaskAttribute.SUMMARY,
109
			TaskAttribute.SUMMARY,
104
			TaskAttribute.TYPE_SHORT_TEXT,
110
			TaskAttribute.TYPE_SHORT_TEXT,
105
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
111
			SBMTicketAttribute.HIDDEN),	//hidden because has extra part
106
	ACTIVEINACTIVE(
112
	ACTIVEINACTIVE(
107
			SBMStaticFields.ACTIVEINACTIVE.getValue(),
113
			SBMStaticFields.ACTIVEINACTIVE.getValue(),
108
			"label_activeinactive",
114
			"label_activeinactive",
109
			SBMFieldTypes.BINARY,
115
			SBMFieldTypes.BINARY,
110
			null,
116
			null,
111
			TaskAttribute.TYPE_BOOLEAN),
117
			TaskAttribute.TYPE_BOOLEAN),
112
	ISSUETYPE(
118
	ISSUETYPE(
113
			"ISSUETYPE",
119
			"ISSUETYPE",
114
			"label_itemtype",
120
			"label_itemtype",
115
			SBMFieldTypes.SELECTION,
121
			SBMFieldTypes.SELECTION,
116
			TaskAttribute.TASK_KIND,
122
			TaskAttribute.TASK_KIND,
117
			TaskAttribute.TYPE_SHORT_TEXT); 
123
			TaskAttribute.TYPE_SHORT_TEXT); 
118
	
124
	
119
	private String sbm_name;
125
	private String sbm_name;
120
	private String task_name;
126
	private String task_name;
121
	private String sbm_type;
127
	private String sbm_type;
122
	private String sbm_label;
128
	private String sbm_label;
123
	private String task_type;
129
	private String task_type;
124
	private boolean visible;
130
	private boolean visible;
125
	
131
	
126
	public static final boolean VISIBLE = true;
132
	public static final boolean VISIBLE = true;
127
	public static final boolean HIDDEN = false;
133
	public static final boolean HIDDEN = false;
128
	
134
	
129
	private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type, String task_name, String task_type) {
135
	private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type, String task_name, String task_type) {
130
		this(sbm_name,sbm_label,sbm_type,task_name,task_type, SBMTicketAttribute.VISIBLE);
136
		this(sbm_name,sbm_label,sbm_type,task_name,task_type, SBMTicketAttribute.VISIBLE);
131
	}
137
	}
132
	
138
	
133
	private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type,
139
	private SBMTicketAttribute(String sbm_name, String sbm_label, SBMFieldTypes sbm_type,
134
			String task_name, String task_type, boolean visible) {
140
			String task_name, String task_type, boolean visible) {
135
		this.sbm_name = sbm_name;
141
		this.sbm_name = sbm_name;
136
		this.sbm_label = sbm_label;
142
		this.sbm_label = sbm_label;
137
		this.sbm_type = sbm_type.getValue();
143
		this.sbm_type = sbm_type.getValue();
138
		this.task_name = task_name;
144
		this.task_name = task_name;
139
		this.task_type = task_type;
145
		this.task_type = task_type;
140
		this.visible = visible;
146
		this.visible = visible;
141
	}
147
	}
142
	
148
	
143
	public String getSBMName() {
149
	public String getSBMName() {
144
		return this.sbm_name;
150
		return this.sbm_name;
145
	}
151
	}
146
	public String getSBMLabel() {
152
	public String getSBMLabel() {
147
		return this.sbm_label;
153
		return this.sbm_label;
148
	}
154
	}
149
	public String getTaskName() {
155
	public String getTaskName() {
150
		return this.task_name;
156
		return this.task_name;
151
	}
157
	}
152
	public String getTaskType() {
158
	public String getTaskType() {
153
		return this.task_type;
159
		return this.task_type;
154
	}
160
	}
155
	public String getSBMType() {
161
	public String getSBMType() {
156
		return this.sbm_type;
162
		return this.sbm_type;
157
	}
163
	}
158
	
164
	
159
	public boolean isVisible() {
165
	public boolean isVisible() {
160
		return this.visible;
166
		return this.visible;
161
	}
167
	}
162
	
168
	
163
	public static SBMTicketAttribute getSBMAttributeBySBMName(String sbm_fieldname) {
169
	public static SBMTicketAttribute getSBMAttributeBySBMName(String sbm_fieldname) {
164
		for (SBMTicketAttribute attribute : values()) {
170
		for (SBMTicketAttribute attribute : values()) {
165
			if (sbm_fieldname.equals(attribute.getSBMName())) {
171
			if (sbm_fieldname.equals(attribute.getSBMName())) {
166
				return attribute;
172
				return attribute;
167
			}
173
			}
168
		}
174
		}
169
		return null;
175
		return null;
170
	}
176
	}
171
	
177
	
172
	public static SBMTicketAttribute getSBMAttributeByTaskName(String task_fieldname) {
178
	public static SBMTicketAttribute getSBMAttributeByTaskName(String task_fieldname) {
173
		for (SBMTicketAttribute attribute : values()) {
179
		for (SBMTicketAttribute attribute : values()) {
174
			if (task_fieldname.equals(attribute.getTaskName())) {
180
			if (task_fieldname.equals(attribute.getTaskName())) {
175
				return attribute;
181
				return attribute;
176
			}
182
			}
177
		}
183
		}
178
		return null;
184
		return null;
179
	}
185
	}
180
}
186
}