Enum of a Custom Field

Description
genesis
Posts: 2
Joined: Tue Aug 03, 2010 2:44 pm

Enum of a Custom Field

Postby genesis » Tue Aug 03, 2010 2:58 pm

Hello everybody,

Actually I am working on a Servlet and I am trying to get all possible Values for a Custom Field.

I guess it should work with "trackerService.getDataService().getEnumerationForEnumId(IEnumType, IContextId)".

But how do I get the IEnumType and the IContextId for the Custom Field in a certain project or an certain WorkItem Type?

Thanks a lot for any advise!

ChernikovaEkaterina
Posts: 15
Joined: Mon Dec 07, 2009 9:08 pm

Re: Enum of a Custom Field

Postby ChernikovaEkaterina » Fri Aug 06, 2010 9:22 am

Hello,

contextId can be find by : project.getContextId()
IEnumType is ICustomField.getType(), this ICustomField find the same:
IDataService.getCustomFieldsService().getCustomField("myfield", IWorkItem.PROTO, contextId, null) for not type-specific field
IDataService.getCustomFieldsService().getCustomField("myfield", IWorkItem.PROTO, contextId, "mytype") for "mytype"-specific field

Best Regards,
Ekaterina Chernikova
Polarion Support

genesis
Posts: 2
Joined: Tue Aug 03, 2010 2:44 pm

Re: Enum of a Custom Field

Postby genesis » Thu Aug 12, 2010 12:08 pm

Thank you very much, exactly what I`m looking for... ;)

lgrossmann
Posts: 3
Joined: Wed Oct 21, 2009 11:57 am

Re: Enum of a Custom Field

Postby lgrossmann » Mon Feb 27, 2012 12:25 pm

Hello,

I am trying to get the same in a wiki-content. Can you tell me how I should call this function:

$trackerService.dataService.getEnumerationForEnumId(IEnumType, IContextId)

I have tried:
#set($repoContextId = $projectService.rootProjectGroup.containedGroups.get(0).contextId)
$trackerService.dataService.getCustomFieldsService().getCustomField("myfield", "Worktiem", $repoContextId, null)

But it isn't working...

Thank you!!

vinicius.zavam
Posts: 20
Joined: Thu Feb 09, 2012 7:46 am
Location: Aachen, Deutschland
Contact:

Re: Enum of a Custom Field

Postby vinicius.zavam » Tue Feb 28, 2012 8:55 am

getting everything;

Code: Select all

 #set ($ds = $trackerService.getDataService())
 #set ($contextID = $trackerService.getTrackerProject(${MYPROJECT_POBJ}).contextId)
 #set ($nwi = $trackerService.getTrackerProject(${MYPROJECT_POBJ}).createWorkItem("${MYWORKITEMTYPE_ID}"))
 #set ($enumtype = $polarionTool.typeFactory.getEnumType("${MYCUSTOMENUM_ID}"))
 #set ($myenum = $ds.getEnumerationForEnumId(${enumtype}, ${contextID}))


quering for all possible values;

Code: Select all

#set ($myoptions = $myenum.getAllOptions())


setting data;

Code: Select all

 #set ($myenum = $myenum.wrapOption("${MYCUSTOMENUM_ID_VALUE}"))
 $nwi.setValue(${MYCUSTOMFIELD_ID}, ${myenum})
Vinícius Zavam
profiles.google.com/egypcio


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 10 guests