Getting custom attributes names via Java API

Accepted answer

IAttributeHandle handle = ...
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IAttribute attribute = (IAttribute) itemService.fetchItem(handle, IRepositoryItemService.COMPLETE);
3 other answers

The following code snippet should get you started:
com.ibm.team.workitem.common.model.IAttributeHandle handle = workItem.getCustomAttributes().get(0); com.ibm.team.workitem.common.model.IAttribute attribute = (IAttribute) teamRepository.itemManager().fetchCompleteItem(handle, IItemManager.DEFAULT, new NullProgressMonitor());
System.out.println("The attribute id: " + attribute.getIdentifier());
System.out.println("The attribute name: " + attribute.getDisplayName());
System.out.println("The value of the custom attribute: " + workItem.getValue(attribute));

Problem
The Java code: String str_date = "11-June-13"; DateFormat formatter; Date date =
new Date(); formatter =
new SimpleDateFormat("dd-MMM-yy"); try { date = (Date) formatter.parse(str_date); }
catch (ParseException e) { } java.sql.Timestamp timeStampDate =
new Timestamp(date.getTime()); newWorkItem.setValue(attribute, timeStampDate);
|