Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I get a stgdefect universal ID(com.ibm.stg.attribute.universalId) from its id?

Now I can get a stgdefect id from its universal id.  Conversely, does anyone know how to get its universal id from id?
Here is my code to get id from universal id:
public static int getIdFromUniID(ITeamRepository teamRepository, String uProject, String type, String uniID) throws TeamRepositoryException {
            IProcessClientService pcs = (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
            IAuditableClient adc = (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
            IProjectArea upa = (IProjectArea) pcs.findProcessArea(URI.create(uProject.replaceAll(" ", "%20")), null, null);

            IQueryableAttributeFactory uFactory = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE);
            IQueryableAttribute uniAttr = uFactory.findAttribute(upa, "com.ibm.stg.attribute.universalId", adc, null);
            IQueryableAttribute typeAttr = uFactory.findAttribute(upa, IWorkItem.TYPE_PROPERTY, adc, null);

            AttributeExpression uExpression = new AttributeExpression(typeAttr, AttributeOperation.EQUALS, type);
            AttributeExpression uTypeExpression = new AttributeExpression(uniAttr, AttributeOperation.EQUALS, uniID);

            Term uTerm = new Term(Operator.AND);
            uTerm.add(uExpression);
            uTerm.add(uTypeExpression);

            IQueryClient uQueryClient = (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
            IQueryResult<IResolvedResult<IWorkItem>> uResult = uQueryClient.getResolvedExpressionResults(upa, (Expression) uTerm, IWorkItem.FULL_PROFILE);   

            int ret = -1;
            while (uResult.hasNext(null)) {
                IResolvedResult<IWorkItem> resolve = uResult.next(null);
                IWorkItem uWI = resolve.getItem();
                System.out.println(uWI.getId());
                ret = uWI.getId();
            }
            return ret;
        }

0 votes

Comments

I fail to understand your question. Maybe you want to explain what you are trying to achieve? The other thing here, I have to assume the work item attribute com.ibm.stg.attribute.universalId is custom. You will have to check what type it is.



One answer

Permanent link
This question is about a custom attribute in a custom process template with custom extensions. Please refer to your process people to understand the details about your custom attributes and their values.

Alternatively, provide more information what you try to achieve and the details of your process customization. At least enough example data and context that users can understand what your question is all about.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,125

Question asked: Aug 12 '14, 11:24 p.m.

Question was seen: 2,755 times

Last updated: Aug 15 '14, 6:27 a.m.

Confirmation Cancel Confirm