Line 17... |
Line 17... |
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;
|
Line -... |
Line 21... |
- |
|
21 |
|
21 |
|
22 |
import java.util.List;
|
Line 22... |
Line 23... |
22 |
import java.util.Set;
|
23 |
import java.util.Set;
|
- |
|
24 |
|
- |
|
25 |
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
|
- |
|
26 |
import net.brutex.mylyn.sbmconnector.core.model.SBMField;
|
- |
|
27 |
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldAttributes;
|
23 |
|
28 |
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
|
24 |
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
|
29 |
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldValue;
|
25 |
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
|
30 |
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
|
Line 26... |
Line 31... |
26 |
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
|
31 |
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
|
Line 119... |
Line 124... |
119 |
* @return the task data
|
124 |
* @return the task data
|
120 |
* @throws CoreException the core exception
|
125 |
* @throws CoreException the core exception
|
121 |
*/
|
126 |
*/
|
122 |
public TaskData convert(TaskRepository repository, TTItem ttitem, IProgressMonitor monitor)
|
127 |
public TaskData convert(TaskRepository repository, TTItem ttitem, IProgressMonitor monitor)
|
123 |
throws CoreException {
|
128 |
throws CoreException {
|
- |
|
129 |
SBMClient client = SBMRepositoryConnector.getClient(repository);
|
124 |
TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
|
130 |
TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
|
125 |
SBMConnectorPlugin.CONNECTOR_KIND,
|
131 |
SBMConnectorPlugin.CONNECTOR_KIND,
|
126 |
repository.getRepositoryUrl(),
|
132 |
repository.getRepositoryUrl(),
|
127 |
ttitem.getGenericItem().getValue().getItemID().getValue());
|
133 |
ttitem.getGenericItem().getValue().getItemID().getValue());
|
128 |
initializeTaskData(repository, data, null, monitor);
|
134 |
initializeTaskData(repository, data, null, monitor);
|
Line 139... |
Line 145... |
139 |
attr.getMetaData().setReadOnly(true);
|
145 |
attr.getMetaData().setReadOnly(true);
|
140 |
} catch (IllegalArgumentException e) {
|
146 |
} catch (IllegalArgumentException e) {
|
141 |
attr.getMetaData().setReadOnly(false);
|
147 |
attr.getMetaData().setReadOnly(false);
|
142 |
}
|
148 |
}
|
143 |
attr.getMetaData().setType(f.getTaskType());
|
149 |
attr.getMetaData().setType(f.getTaskType());
|
144 |
attr.getMetaData().setLabel(SBMRepositoryConnector.getClient(repository).getFieldLabel(ttitem, f.getSBMName()));
|
150 |
attr.getMetaData().setLabel(client.getFieldLabel(ttitem, f.getSBMName()));
|
145 |
if(f.isVisible()) {
|
151 |
if(f.isVisible()) {
|
146 |
attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
|
152 |
attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
|
147 |
} else {
|
153 |
} else {
|
148 |
attr.getMetaData().setKind(null);
|
154 |
attr.getMetaData().setKind(null);
|
149 |
}
|
155 |
}
|
150 |
attr.setValue(SBMRepositoryConnector.getClient(repository).getFieldValue(ttitem, f.getSBMName()));
|
156 |
attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName()));
|
151 |
}
|
157 |
}
|
Line 152... |
Line 158... |
152 |
|
158 |
|
- |
|
159 |
//Custom fields
|
- |
|
160 |
List<SBMField> customfields = client.getFields(client.getTableName(ttitem));
|
- |
|
161 |
for(SBMField f : customfields) {
|
- |
|
162 |
if(SBMTicketAttribute.getSBMAttributeBySBMName(f.getName())!=null) {
|
- |
|
163 |
continue;
|
153 |
//Custom fields
|
164 |
}
|
154 |
TaskAttribute custom = data.getRoot().createAttribute("BLIBLABLUB");
|
165 |
TaskAttribute custom = data.getRoot().createAttribute(f.getName());
|
- |
|
166 |
custom.getMetaData().setType(
|
155 |
custom.getMetaData().setType(TaskAttribute.TYPE_BOOLEAN);
|
167 |
new SBMTicketAttributeMapper(repository).mapToTaskKey(f.getType()));
|
156 |
custom.getMetaData().setLabel("BIILLALLLLLLLL");
|
168 |
custom.getMetaData().setLabel(f.getLabel());
|
- |
|
169 |
custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
|
- |
|
170 |
custom.getMetaData().setReadOnly(true);
|
- |
|
171 |
if(f.getType()==SBMFieldTypes.SELECTION &&
|
- |
|
172 |
client.getFieldValue(ttitem, f.getName())!=null) {
|
- |
|
173 |
String val = client.getFieldValue(ttitem, f.getName()).getValue();
|
157 |
custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
|
174 |
custom.putOption(val, val);
|
- |
|
175 |
custom.setValue(val);
|
- |
|
176 |
} else if(f.getType()==SBMFieldTypes.MULTIPLE_SELECTION
|
- |
|
177 |
|| f.getType()==SBMFieldTypes.MULTIPLE_RELATIONAL
|
- |
|
178 |
|| f.getType()==SBMFieldTypes.MULTIPLE_GROUP
|
- |
|
179 |
|| f.getType()==SBMFieldTypes.MULTIPLE_USERGROUP) {
|
- |
|
180 |
List<SBMFieldValue> values = client.getFieldValues(ttitem, f.getName());
|
- |
|
181 |
for(SBMFieldValue val : values) {
|
- |
|
182 |
custom.putOption(val.getInternalValue(), val.getValue());
|
- |
|
183 |
custom.addValue(val.getValue());
|
- |
|
184 |
}
|
- |
|
185 |
} else if(client.getFieldValue(ttitem, f.getName())!=null) {
|
- |
|
186 |
custom.setValue(client.getFieldValue(ttitem, f.getName()).getValue());
|
- |
|
187 |
}
|
Line 158... |
Line 188... |
158 |
custom.setValue("roger");
|
188 |
}
|
159 |
|
189 |
|
160 |
//Notes
|
190 |
//Notes
|
161 |
for(SBMNote n : SBMRepositoryConnector.getClient(repository).getNotes(ttitem)) {
|
191 |
for(SBMNote n : client.getNotes(ttitem)) {
|
162 |
TaskCommentMapper mapper = new TaskCommentMapper();
|
192 |
TaskCommentMapper mapper = new TaskCommentMapper();
|
163 |
mapper.setCommentId(n.getId());
|
193 |
mapper.setCommentId(n.getId());
|
164 |
mapper.setNumber(Integer.valueOf(n.getId()));
|
194 |
mapper.setNumber(Integer.valueOf(n.getId()));
|