AssertionFailedException problem with getting the values of attributes
I have a problem with getting the values of attributes (built in and custom).
I use this code to get the built-in attributes and their values.
But i always get AssertionFailedException ( i know that i need use different method for enumeration but even for other atributtes i get this exception)
This code I use for enumeration (borrowed from this forum)
edit:
Also i have problem with format code in this post, I do not know that anyone will want to read it :/
I use this code to get the built-in attributes and their values.
List<IAttributeHandle> builtInAttributeHandles = service.findBuiltInAttributes(projectArea, monitor); IFetchResult builtIn = repository.itemManager().fetchCompleteItemsPermissionAware(builtInAttributeHandles,IItemManager.REFRESH, monitor); for (Iterator it = builtIn.getRetrievedItems().iterator(); it.hasNext();) { com.ibm.team.workitem.common.model.IAttributeHandle handle = (IAttributeHandle) it.next(); com.ibm.team.workitem.common.model.IAttribute attribute = (IAttribute) repository.itemManager().fetchCompleteItem(handle, IItemManager.DEFAULT,new NullProgressMonitor()); System.out.println(" Built In Attribute: "+ attribute.getDisplayName()); System.out.println(" Type: " + attribute.getAttributeType()); try { System.out.println(" Value "+ resolved.getItem().getValue(attribute)); } catch (AssertionFailedException e) { System.out.println(e.toString()); } }
But i always get AssertionFailedException ( i know that i need use different method for enumeration but even for other atributtes i get this exception)
This code I use for enumeration (borrowed from this forum)
System.out.println(" type"+"="+attribute.getAttributeType()); System.out.println(" value"+"="+item.getValue(attribute)); IEnumeration<ILiteral> enumeration = (IEnumeration<ILiteral>)workItemClient.resolveEnumeration(attribute, null); IAuditableClient iac = (IAuditableClient) repository.getClientLibrary(IAuditableClient.class); if(enumeration!=null){ IAuditableClient auditableClient = (IAuditableClient )repository.getClientLibrary(IAuditableClient.class); String[] iaval = attribute.getValue(auditableClient, item, null).toString().split(":"); if(iaval.length>1 && iaval[1]!=null){ List<ILiteral> enumerationLiterals = enumeration.getEnumerationLiterals(); for (ILiteral literal : enumerationLiterals){ if(literal.getIdentifier2().getStringIdentifier().equalsIgnoreCase(iaval[1])){ System.out.println("attribute name="+attribute.getIdentifier() +", type"+"="+attribute.getAttributeType()+" literal="+literal.getIdentifier2().getStringIdentifier()+" literal name="+literal.getName()); break; } } } }I will be very grateful for help
edit:
Also i have problem with format code in this post, I do not know that anyone will want to read it :/
Accepted answer
14 other answers
What are the jars and libraries required to be included into the build path (in eclipse) to execute this code?
Comments
i execute this from Eclipse and have set up user 'libraries' for the PlainJava jar files
if you then build an executable jar, you can include the needed jars inside, or you can point to the folder where all the plainjava jars reside
there are so many, I don't know exactly which ones you can leave out.
page 2of 1 pagesof 2 pages