Subversion Repositories XServices

Rev

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

Rev 34 Rev 39
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
 
-
 
22
import java.util.Date;
21
 
23
import java.util.GregorianCalendar;
22
import java.util.List;
24
import java.util.List;
23
import java.util.Set;
25
import java.util.Set;
-
 
26
 
-
 
27
import javax.xml.datatype.DatatypeConfigurationException;
-
 
28
import javax.xml.datatype.DatatypeFactory;
-
 
29
import javax.xml.datatype.XMLGregorianCalendar;
24
 
30
 
25
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
31
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
26
import net.brutex.mylyn.sbmconnector.core.model.SBMField;
32
import net.brutex.mylyn.sbmconnector.core.model.SBMField;
27
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldAttributes;
33
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldAttributes;
28
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
34
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldTypes;
29
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldValue;
35
import net.brutex.mylyn.sbmconnector.core.model.SBMFieldValue;
30
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
36
import net.brutex.mylyn.sbmconnector.core.model.SBMNote;
31
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
37
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
-
 
38
import net.brutex.mylyn.sbmconnector.core.model.SBMSystemFields;
-
 
39
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage;
32
import net.brutex.sbm.wsclient.TTItem;
40
import net.brutex.sbm.wsclient.TTItem;
33
 
41
 
34
import org.eclipse.core.runtime.CoreException;
42
import org.eclipse.core.runtime.CoreException;
35
import org.eclipse.core.runtime.IProgressMonitor;
43
import org.eclipse.core.runtime.IProgressMonitor;
-
 
44
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
36
import org.eclipse.mylyn.tasks.core.ITaskMapping;
45
import org.eclipse.mylyn.tasks.core.ITaskMapping;
37
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
46
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
38
import org.eclipse.mylyn.tasks.core.TaskRepository;
47
import org.eclipse.mylyn.tasks.core.TaskRepository;
39
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
48
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
40
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
49
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
41
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
50
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
42
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
51
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
43
import org.eclipse.mylyn.tasks.core.data.TaskData;
52
import org.eclipse.mylyn.tasks.core.data.TaskData;
44
 
53
 
45
/**
54
/**
46
 * The Class SBMTicketDataHandler.
55
 * The Class SBMTicketDataHandler.
47
 */
56
 */
48
public class SBMTicketDataHandler extends AbstractTaskDataHandler {
57
public class SBMTicketDataHandler extends AbstractTaskDataHandler {
49
 
58
 
50
	/** The connector. */
59
	/** The connector. */
51
	private final SBMRepositoryConnector connector;
60
	private final SBMRepositoryConnector connector;
52
	
61
 
53
	/**
62
	/**
54
	 * Instantiates a new SBM ticket data handler.
63
	 * Instantiates a new SBM ticket data handler.
55
	 *
64
	 * 
-
 
65
	 * @param connector
56
	 * @param connector the connector
66
	 *            the connector
57
	 */
67
	 */
58
	public SBMTicketDataHandler(SBMRepositoryConnector connector) {
68
	public SBMTicketDataHandler(SBMRepositoryConnector connector) {
59
		this.connector = connector;
69
		this.connector = connector;
60
	}
70
	}
61
	
71
 
-
 
72
	/*
62
	/* (non-Javadoc)
73
	 * (non-Javadoc)
-
 
74
	 * 
-
 
75
	 * @see
63
	 * @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#getAttributeMapper(org.eclipse.mylyn.tasks.core.TaskRepository)
76
	 * org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#getAttributeMapper
-
 
77
	 * (org.eclipse.mylyn.tasks.core.TaskRepository)
64
	 */
78
	 */
65
	@Override
79
	@Override
66
	public TaskAttributeMapper getAttributeMapper(TaskRepository taskRepository) {
80
	public TaskAttributeMapper getAttributeMapper(TaskRepository taskRepository) {
67
		return new SBMTicketAttributeMapper(taskRepository);
81
		return new SBMTicketAttributeMapper(taskRepository);
68
	}
82
	}
-
 
83
 
69
 
84
	/*
-
 
85
	 * (non-Javadoc)
-
 
86
	 * 
-
 
87
	 * @see
-
 
88
	 * org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#initializeTaskData
70
	/* (non-Javadoc)
89
	 * (org.eclipse.mylyn.tasks.core.TaskRepository,
-
 
90
	 * org.eclipse.mylyn.tasks.core.data.TaskData,
-
 
91
	 * org.eclipse.mylyn.tasks.core.ITaskMapping,
71
	 * @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#initializeTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, org.eclipse.mylyn.tasks.core.data.TaskData, org.eclipse.mylyn.tasks.core.ITaskMapping, org.eclipse.core.runtime.IProgressMonitor)
92
	 * org.eclipse.core.runtime.IProgressMonitor)
72
	 */
93
	 */
73
	@Override
94
	@Override
74
	public boolean initializeTaskData(TaskRepository repository, TaskData taskData,
95
	public boolean initializeTaskData(TaskRepository repository,
75
			ITaskMapping initializationData, IProgressMonitor monitor)
96
			TaskData taskData, ITaskMapping initializationData,
76
			throws CoreException {
-
 
77
		
-
 
78
		/*TaskAttribute attribute = taskData.getRoot().createAttribute(SBMStaticFields.TITLE);
-
 
79
		attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_SHORT_TEXT).setLabel("Summary:");
-
 
80
 
-
 
81
		/*attribute = taskData.getRoot().createAttribute(SBMStaticFields.DESCRIPTION);
-
 
82
		attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_LONG_TEXT).setLabel("Description:");
-
 
83
 
-
 
84
		attribute = taskData.getRoot().createAttribute(SBMStaticFields.SUBMITDATE);
-
 
85
		attribute.getMetaData().setReadOnly(false).setType(TaskAttribute.TYPE_DATETIME).setLabel("Create Date:");
-
 
86
 
-
 
87
 
-
 
88
		  if (!taskData.isNew()) {
-
 
89
			attribute = taskData.getRoot().createAttribute(TaskAttribute.TASK_URL);
-
 
90
			attribute.getMetaData().setReadOnly(true).setKind(TaskAttribute.KIND_DEFAULT).setType(
97
			IProgressMonitor monitor) throws CoreException {
91
					TaskAttribute.TYPE_URL).setLabel("Location:");
-
 
92
			File file = client.getTask(taskData.getTaskId(), monitor);
-
 
93
			try {
-
 
94
				attribute.setValue(file.toURI().toURL().toString());
-
 
95
			} catch (MalformedURLException e) {
-
 
96
			}
-
 
97
		}
-
 
98
 
-
 
99
		attribute = taskData.getRoot().createAttribute(TaskAttribute.PRODUCT);
-
 
100
		attribute.getMetaData().setReadOnly(false).setKind(TaskAttribute.KIND_DEFAULT).setType(
-
 
101
				TaskAttribute.TYPE_SINGLE_SELECT).setLabel("Project");
-
 
102
				*/
98
		monitor.subTask("Initialising task ...");
103
		taskData.setPartial(true);
99
		taskData.setPartial(true);
104
		return true;
100
		return true;
105
	}
101
	}
-
 
102
 
106
 
103
	/*
-
 
104
	 * (non-Javadoc)
-
 
105
	 * 
107
	/* (non-Javadoc)
106
	 * @see
-
 
107
	 * org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#postTaskData
-
 
108
	 * (org.eclipse.mylyn.tasks.core.TaskRepository,
-
 
109
	 * org.eclipse.mylyn.tasks.core.data.TaskData, java.util.Set,
108
	 * @see org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler#postTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, org.eclipse.mylyn.tasks.core.data.TaskData, java.util.Set, org.eclipse.core.runtime.IProgressMonitor)
110
	 * org.eclipse.core.runtime.IProgressMonitor)
109
	 */
111
	 */
110
	@Override
112
	@Override
111
	public RepositoryResponse postTaskData(TaskRepository repository,
113
	public RepositoryResponse postTaskData(TaskRepository repository,
112
			TaskData taskData, Set<TaskAttribute> oldAttributes,
114
			TaskData taskData, Set<TaskAttribute> oldAttributes,
113
			IProgressMonitor monitor) throws CoreException {
115
			IProgressMonitor monitor) throws CoreException {
114
		// TODO Auto-generated method stub
116
		// TODO Auto-generated method stub
115
		return null;
117
		return null;
116
	}
118
	}
117
	
119
 
118
	/**
120
	/**
119
	 * Convert.
121
	 * Convert.
120
	 *
122
	 * 
-
 
123
	 * @param repository
121
	 * @param repository the repository
124
	 *            the repository
-
 
125
	 * @param ttitem
122
	 * @param ttitem the ttitem
126
	 *            the ttitem
-
 
127
	 * @param monitor
123
	 * @param monitor the monitor
128
	 *            the monitor
124
	 * @return the task data
129
	 * @return the task data
-
 
130
	 * @throws CoreException
125
	 * @throws CoreException the core exception
131
	 *             the core exception
126
	 */
132
	 */
127
	public TaskData convert(TaskRepository repository, TTItem ttitem, IProgressMonitor monitor) 
133
	public TaskData convert(TaskRepository repository, TTItem ttitem,
-
 
134
			IProgressMonitor monitor, IRepositoryQuery query)
128
		throws CoreException {
135
			throws CoreException {
129
		SBMClient client = SBMRepositoryConnector.getClient(repository);
136
		SBMClient client = SBMRepositoryConnector.getClient(repository);
130
		TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
137
		TaskData data = new TaskData(new SBMTicketAttributeMapper(repository),
131
				SBMConnectorPlugin.CONNECTOR_KIND, 
138
				SBMConnectorPlugin.CONNECTOR_KIND, repository
132
				repository.getRepositoryUrl(), 
139
						.getRepositoryUrl(), ttitem.getGenericItem().getValue()
133
				ttitem.getGenericItem().getValue().getItemName().getValue()+" ["+
140
						.getItemName().getValue()
-
 
141
						+ " ["
134
				ttitem.getGenericItem().getValue().getItemID().getValue()+"]");
142
						+ ttitem.getGenericItem().getValue().getItemID()
-
 
143
								.getValue() + "]");
135
		initializeTaskData(repository, data, null, monitor);
144
		initializeTaskData(repository, data, null, monitor);
-
 
145
		String fieldlist = "";
-
 
146
		if (repository
-
 
147
				.hasProperty(SBMRepositorySettingsPage.STRING_TABLEFIELDLIST)) {
-
 
148
			fieldlist = repository
-
 
149
					.getProperty(SBMRepositorySettingsPage.STRING_TABLEFIELDLIST);
-
 
150
		}
136
		// Create Fields for all the generic SBM (system) fields
151
		// Create Fields for all the generic SBM (system) fields
-
 
152
		monitor.subTask("Creating generic SBM fields...");
137
		for (SBMTicketAttribute f : SBMTicketAttribute.values()) {
153
		for (SBMSystemFields sysfield : SBMSystemFields.values()) {
138
			TaskAttribute attr;
154
			if(!sysfield.hasTaskAttribute()) {
-
 
155
				// skip the field here, because we do not have a
139
			if(f.getTaskName()!=null) {
156
				// matching task attribute to map. The field
140
				attr = data.getRoot().createMappedAttribute(f.getTaskName());
157
				// will be processed in the custom field section
141
			} else {
158
				continue;
142
				attr = data.getRoot().createAttribute(f.getSBMName());
-
 
143
			}
159
			}
-
 
160
			if (!fieldlist.contains("," + sysfield.getValue() + ",")) {
-
 
161
				// do not process custom field when it has not
-
 
162
				// been selected by user in repository settings page
-
 
163
				continue;
-
 
164
			}
-
 
165
			// try to initialize the SBM attribute
-
 
166
			SBMTicketAttribute f = null;
-
 
167
			TaskAttribute attr = null;
144
			try {
168
			try {
145
				SBMStaticFields.valueOf(f.getSBMName()); //check if in static field list
-
 
146
				attr.getMetaData().setReadOnly(true);
169
				f = SBMTicketAttribute.valueOf(sysfield.getValue());
147
			} catch (IllegalArgumentException e) {
170
			} catch (IllegalArgumentException e) {
-
 
171
				// the field is a valid sbm system field and is set up to
-
 
172
				// have an equivalent in the task attributes. It must have an
-
 
173
				// entry in the SBMTicketAttribute class !
-
 
174
				continue; // we just skip the field 
-
 
175
			}
-
 
176
			
-
 
177
			if (f.getTaskName() != null) {
148
				attr.getMetaData().setReadOnly(false);	
178
				attr = data.getRoot().createMappedAttribute(f.getTaskName());
-
 
179
			} else {
-
 
180
				// again the field is set up to have an task attribute
-
 
181
				// equivalent, but it is not set up in SBMAttributes correctly
-
 
182
				continue;
149
			}			
183
			}
-
 
184
			
-
 
185
			attr.getMetaData().setReadOnly(true); //we do not support writing yet 
150
			attr.getMetaData().setType(f.getTaskType());
186
			attr.getMetaData().setType(f.getTaskType()); // set the mapped field type
151
			attr.getMetaData().setLabel(client.getFieldLabel(ttitem, f.getSBMName()));
187
			attr.getMetaData().setLabel(client.getFieldLabel(ttitem, f.getSBMName())); // get and set the field label
152
			if(f.isVisible()) {
188
			if (f.isVisible()) {
-
 
189
				// field is not hidden, display it by setting KIND_DEFAULT
153
				attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
190
				attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
154
			} else {
191
			} else {
-
 
192
				// field is hidden
155
				attr.getMetaData().setKind(null);
193
				attr.getMetaData().setKind(null);
156
			}
194
			}
157
			/*
-
 
158
			if(f.getTaskType()==TaskAttribute.TYPE_SINGLE_SELECT) {
-
 
159
				List<SBMFieldValue> options = 
-
 
160
					client.getValidSet(client.getTableName(ttitem), f.getSBMName());
-
 
161
				for( SBMFieldValue optionvalue: options) {
-
 
162
					attr.putOption(optionvalue.getValue(), optionvalue.getValue());
-
 
163
				}
-
 
164
			}
-
 
165
			*/
-
 
166
			attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName()));
-
 
-
 
195
			
167
			
196
			attr.setValue(client.getStaticFieldValue(ttitem, f.getSBMName())); // get and set the field value
-
 
197
		}
-
 
198
		monitor.worked(1);
168
		}
199
		
-
 
200
		//--------------
169
		
201
		// Custom fields
-
 
202
		//--------------
170
		//Custom fields		
203
		List<SBMField> customfields = client.getFields(client
171
		List<SBMField> customfields = client.getFields(client.getTableName(ttitem));
204
				.getTableName(ttitem));
-
 
205
		for (SBMField f : customfields) {
-
 
206
			if (!fieldlist.contains("," + f.getName() + ",")) {
172
		for(SBMField f : customfields) {
207
				// do not process custom field when it has not
173
			if(SBMTicketAttribute.getSBMAttributeBySBMName(f.getName())!=null) {
208
				// been selected by user in repository settings page
-
 
209
				continue;
-
 
210
			}
-
 
211
			try {
-
 
212
				SBMSystemFields sysfield = SBMSystemFields.valueOf(f.getName());
-
 
213
				if( sysfield.hasTaskAttribute()) {
-
 
214
					// the field has an equivalent in the task attribute
-
 
215
					// mappings and therefore it can be skipped in the custom
-
 
216
					// fields section
-
 
217
					continue;
-
 
218
				}
-
 
219
			} catch (IllegalArgumentException e) {
-
 
220
				//field is not a system field, do nothing
174
				continue;
221
			}
175
			}
222
			monitor.subTask("Read custom field [" + f.getName() + "]");
176
			TaskAttribute custom = data.getRoot().createAttribute(f.getName());
223
			TaskAttribute custom = data.getRoot().createAttribute(f.getName());
-
 
224
			custom.getMetaData().setType(
177
			custom.getMetaData().setType(
225
					new SBMTicketAttributeMapper(repository).mapToTaskKey(f
178
					new SBMTicketAttributeMapper(repository).mapToTaskKey(f.getType()));
226
							.getType()));
179
			custom.getMetaData().setLabel(f.getLabel());
227
			custom.getMetaData().setLabel(f.getLabel());
-
 
228
			custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
-
 
229
			custom.getMetaData().setReadOnly(true);
-
 
230
			
180
			custom.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
231
			//set value/ values depending on field type
181
			custom.getMetaData().setReadOnly(false);
232
			// single selection
182
			if(f.getType()==SBMFieldTypes.SELECTION &&
233
			if (f.getType() == SBMFieldTypes.SELECTION
183
					client.getFieldValue(ttitem, f.getName())!=null) {
234
					&& client.getFieldValue(ttitem, f.getName()) != null) {
184
				List<SBMFieldValue> options = 
235
				List<SBMFieldValue> options = client.getValidSet(client
185
					client.getValidSet(client.getTableName(ttitem), f.getName());
236
						.getTableName(ttitem), f.getName());
-
 
237
				for (SBMFieldValue optionvalue : options) {
186
				for( SBMFieldValue optionvalue: options) {
238
					custom.putOption(optionvalue.getInternalValue(),
187
					custom.putOption(optionvalue.getInternalValue(), optionvalue.getValue());
239
							optionvalue.getValue());
-
 
240
				}
188
				}
241
				String val = client.getFieldValue(ttitem, f.getName())
-
 
242
						.getValue();
189
				String val = client.getFieldValue(ttitem, f.getName()).getValue();
243
				custom.setValue(val);
190
				custom.setValue(val);
244
			// Multi-Type fields
191
			} else if(f.getType()==SBMFieldTypes.MULTIPLE_SELECTION 
245
			} else if (f.getType() == SBMFieldTypes.MULTIPLE_SELECTION
192
					|| f.getType()==SBMFieldTypes.MULTIPLE_RELATIONAL
246
					|| f.getType() == SBMFieldTypes.MULTIPLE_RELATIONAL
193
					|| f.getType()==SBMFieldTypes.MULTIPLE_GROUP
247
					|| f.getType() == SBMFieldTypes.MULTIPLE_GROUP
-
 
248
					|| f.getType() == SBMFieldTypes.MULTIPLE_USERGROUP) {
194
					|| f.getType()==SBMFieldTypes.MULTIPLE_USERGROUP) {
249
				List<SBMFieldValue> values = client.getFieldValues(ttitem, f
195
				List<SBMFieldValue> values = client.getFieldValues(ttitem, f.getName());
250
						.getName());
196
				for(SBMFieldValue val : values) {
251
				for (SBMFieldValue val : values) {
197
					custom.putOption(val.getInternalValue(), val.getValue());
252
					custom.putOption(val.getInternalValue(), val.getValue());
-
 
253
					custom.addValue(val.getValue());
-
 
254
				}
-
 
255
			//Date fields
-
 
256
			} else if (f.getType() == SBMFieldTypes.DATETIME) {
-
 
257
				String datestring = client.getFieldValue(ttitem, f.getName()).getValue();
-
 
258
				long timestamp;
-
 
259
				try {
-
 
260
					timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(datestring).toGregorianCalendar().getTimeInMillis();
-
 
261
					custom.setValue(String.valueOf(timestamp));
-
 
262
				} catch (DatatypeConfigurationException e) {
-
 
263
					// TODO Auto-generated catch block
-
 
264
					e.printStackTrace();
-
 
265
				} catch (IllegalArgumentException e) {
-
 
266
					//date field is probably empty
-
 
267
					custom.setValue("");
-
 
268
				}
198
					custom.addValue(val.getValue());
269
				
199
				}				
270
			// any other field type
-
 
271
			} else if (client.getFieldValue(ttitem, f.getName()) != null) {
200
			} else if(client.getFieldValue(ttitem, f.getName())!=null) {
272
				custom.setValue(client.getFieldValue(ttitem, f.getName())
201
					custom.setValue(client.getFieldValue(ttitem, f.getName()).getValue());
273
						.getValue());
-
 
274
			}
202
			}
275
		}
-
 
276
		monitor.worked(1);
203
		}
277
 
-
 
278
		// ----------
-
 
279
		// Notes
204
		
280
		// ----------
205
		//Notes
281
		monitor.subTask("Read notes.");
206
		for(SBMNote n : client.getNotes(ttitem)) {
282
		for (SBMNote n : client.getNotes(ttitem)) {
207
			TaskCommentMapper mapper = new TaskCommentMapper();
283
			TaskCommentMapper mapper = new TaskCommentMapper();
208
			mapper.setCommentId(n.getId());
284
			mapper.setCommentId(n.getId());
209
			mapper.setNumber(Integer.valueOf(n.getId()));
285
			mapper.setNumber(Integer.valueOf(n.getId()));
210
			mapper.setText(n.getText());
286
			mapper.setText(n.getText());
211
			mapper.setCreationDate(n.getCreation());
287
			mapper.setCreationDate(n.getCreation());
212
			
288
 
-
 
289
			TaskAttribute a = data.getRoot()
213
			TaskAttribute a = data.getRoot().createAttribute("NOTE"+n.getId());
290
					.createAttribute("NOTE" + n.getId());
214
			mapper.applyTo(a);
291
			mapper.applyTo(a);
215
		}
292
		}
-
 
293
		monitor.worked(1);
216
				
294
 
217
		data.setPartial(false);
295
		data.setPartial(false);
218
		return data;
296
		return data;
219
	}
297
	}
220
}
298
}