Setting priority within a participant
I'm sure this is really easy, but for the life of me, I can't get it to work.
I am in a Server-side participant for a WorkItemSave and I just need to set the value of the Priority built-in attribute.
I have the workingCOpy, and I can do workingCopy.setPriority(iPriorityIdentifier); and then _service.saveWorkItem3();
but the setPriority takes an Identifier<IPriority> which I am struggling to get.
Anybody have a snippet they can help me with?
Susan
I am in a Server-side participant for a WorkItemSave and I just need to set the value of the Priority built-in attribute.
I have the workingCOpy, and I can do workingCopy.setPriority(iPriorityIdentifier); and then _service.saveWorkItem3();
but the setPriority takes an Identifier<IPriority> which I am struggling to get.
Anybody have a snippet they can help me with?
Susan
Accepted answer
well, the priority is an enum, enums have ILiterals and these have identifiers.
from my dump workitem utility
// this will throw exception if not enumeration
IEnumeration<ILiteral> enumeration = (IEnumeration<ILiteral>) workItemCommon
.resolveEnumeration(ia, monitor);
if (enumeration != null)
{
String[] iaval = ia
.getValue(auditableClient, workItem,
monitor).toString().split(":");
if (iaval.length > 1 && iaval[1] != null)
{
List<ILiteral> enumerationLiterals = enumeration
.getEnumerationLiterals();
for (ILiteral literal : enumerationLiterals)
{
Identifier i=literal.getIdentifier2(); <------
if (literal.getIdentifier2()
.getStringIdentifier()
.equalsIgnoreCase(iaval[1]))
{
from my dump workitem utility
// this will throw exception if not enumeration
IEnumeration<ILiteral> enumeration = (IEnumeration<ILiteral>) workItemCommon
.resolveEnumeration(ia, monitor);
if (enumeration != null)
{
String[] iaval = ia
.getValue(auditableClient, workItem,
monitor).toString().split(":");
if (iaval.length > 1 && iaval[1] != null)
{
List<ILiteral> enumerationLiterals = enumeration
.getEnumerationLiterals();
for (ILiteral literal : enumerationLiterals)
{
Identifier i=literal.getIdentifier2(); <------
if (literal.getIdentifier2()
.getStringIdentifier()
.equalsIgnoreCase(iaval[1]))
{