It's all about the answers!

Ask a question

Adding attributes to different Project Area in RTC


Sarthak Sharma (4711620) | asked Jul 20 '12, 3:11 a.m.
I have some plugins which I am deploying in RTC.
It uses custom attributes, which are added in specific project area.
So, If I deploy same plugins in different project area, It will fail because, The required custom attributes won't be available there.So, I can't add these attributes every time I deploy the plugin.
Is there any other way for the same which allows smooth installation of plugins in all project areas ?

One answer



permanent link
Ralph Schoon (63.3k33646) | answered Jul 23 '12, 3:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Sarthak,

I would make sure to base projects on a common process template that has all the required attributes in the future. You could even use the process that is defined in one project area by other project areas. The downside of this is that there is only very limited support for process customization in the project areas that inherit the process. If you do, you will loose the ability to see changes in the project that you base upon.

It is also possible to create the attributes by the plugins. Please find an example code snippet below. What I am not sure of is, if it is possible to configure the attributes that are created in the UI e.g. to add the attribute presentations to the UI. I have no code and I am not sure if it is possible to create the attribute presentations. It should be possible- the client does it in the UI - but the code could be internal in the SDK.

            IWorkItemClient workItemClient= (IWorkItemClient) fTeamRepository.getClientLibrary(IWorkItemClient.class);

            IAttribute customString = workItemClient.findAttribute(fProjectArea,
                    fCustomStringAttributeID, null);

            if(null==customString&&fCreateAttributesIfMissing){
                customString=workItemClient.createNewAttribute(fProjectArea,fCustomStringAttributeID,AttributeTypes.SMALL_STRING,IAttribute.FULL_TEXT_KIND_DEFAULT, monitor);
                customString.setDisplayName("Created String ("+fCustomStringAttributeID+")");
                customString=workItemClient.saveAttribute(customString, monitor);
            }
           
            if(null!=customString){
                if(!workItem.hasCustomAttribute(customString)&&fCreateAttributesIfMissing){
                    // If not defined in the process template it has to be manually created
                    workItem.addCustomAttribute(customString);
                }
                if(workItem.hasCustomAttribute(customString))
                    workItem.setValue(customString, fCustomString);
            }



 

Comments
Sarthak Sharma commented Jul 24 '12, 3:16 a.m.

Thanks a lot for you help Ralph..


Ralph Schoon commented Jul 24 '12, 3:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi Sarthak, I should have mentioned the code above is client code. You can use it with the Plain Java Client library. It would be easiest to extend the code in https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation. An easy way to set up the Plain Java Client Libraries can be found in https://jazz.net/library/article/807 .

Your answer


Register or 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.