how to set the value of the Constraint Type of a workitem creating programatically using Plain Java API RTC
Hi Everyone,
We have a requirement to create a work item using plain java api programmatically. I tried to set the values of the attribute Constraint Type as similar way of setting the values of Priority and severity.But it didnt work for me.
please help me .
IWorkItemClient workItemCommon = (IWorkItemClient)rtcRepository.getClientLibrary(IWorkItemClient.class);
IEnumeration enumeration= workItemCommon.resolveEnumeration(attribute, nullProgressMonitor);
List<ILiteral> enumList = enumeration.getEnumerationLiterals();
for(ILiteral lit: enumList) {
System.out.println("litername>>>"+lit.getName());
if(lit.getName().equalsIgnoreCase(literalName)) {
return lit.getIdentifier2();
IEnumeration enumeration= workItemCommon.resolveEnumeration(attribute, nullProgressMonitor);
List<ILiteral> enumList = enumeration.getEnumerationLiterals();
for(ILiteral lit: enumList) {
System.out.println("litername>>>"+lit.getName());
if(lit.getName().equalsIgnoreCase(literalName)) {
return lit.getIdentifier2();
finally i set the returned identifier to the workitem Constraint Type Attribute
Thanks in advance!!!
Accepted answer
The Constraint Type is an enumeration and can be set as such. I tried with the Work Item command Line ad it works just fine. Note that for any value other than asap, you have to also set the timestamp for the constraint date.
Comments
Thanks alot Raplph.
Hi Ralph,
We didnt know this :
Note that for any value other than asap, you have to also set the timestamp for the constraint date.
its very useful to me
Why would you not know this? Certainly you would have looked into how the UI works with the data, before you looked at the API, wouldn't you?
Try to set a no later than and not provide a data and save. Error. I would imagine that the error in the API during save would also hint the missing date. Yes, the errors can sometimes be a bit mysterious, but all in all they usually make sense and hint what the issue is.