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

Trouble creating a custom profile (Work Item Profile)

Goal is a custom profile, based on an existing profile as found in IWorkItem, so that the custom profile has an extra attribute - a custom attribute.

I've tried this - but it fails:
String ATTR_INTERNAL2EXTERNAL = "ATTR_AI1f";


if (!IWorkItem.SMALL_PROFILE.contains(ATTR_INTERNAL2EXTERNAL))
System.out.println("expected that");

ItemProfile<IWorkItem> custom = null;

ArrayList<String> attrs = new ArrayList<String>();
attrs.add(ATTR_INTERNAL2EXTERNAL);

custom = IWorkItem.SMALL_PROFILE.createExtension((String[]) attrs.toArray(new String[attrs.size()]));

if (custom.contains(ATTR_INTERNAL2EXTERNAL))
System.out.println("expected that");

The attribute id hardcoded in the logic is known to the project area, but that does not seem to be the issue.

The createExtension fails an assertion deep in the ItemProfile code:

private ItemProfile(IItemType itemType, Collection<String> properties, boolean containsReferences) {
Assert.isTrue(AuditablesHelper.allProperties(itemType).containsAll(properties));
fItemType= itemType;
if (AuditablesHelper.USE_CUSTOM_ACCESS_PROFILES)
fProperties= Collections.unmodifiableCollection(properties);
else
fProperties= AuditablesHelper.allProperties(itemType);
fContainsReferences= containsReferences;
}


The properties at this point are:

That seems to be IWorkItem.SMALL_PROFILE and my custom attribute id; why must all those known to the helper exist?

Given the goal - Is this the wrong approach or a bug?

Pat Mc.

0 votes



2 answers

Permanent link
That seems to be IWorkItem.SMALL_PROFILE and my custom attribute id;
why must all those known to the helper exist?

Given the goal - Is this the wrong approach or a bug?

When including custom attributes in an ItemProfile, you must also
include the attributes from IWorkItem.CUSTOM_ATTRIBUTE_PROPERTIES.

HTH,
Patrick
Jazz Work Item Team

0 votes


Permanent link
Hi,

ItemProfile is not aware of custom attributes, but only of the lower-level hard-coded properties of an item type. If you want to retrieve custom attributes you can extend an existing profile like:

ItemProfile<IWorkItem> customProfile= IWorkItem.SMALL_PROFILE.createExtension(IWorkItem.CUSTOM_ATTRIBUTE_PROPERTIES);

That will retrieve all custom attributes, but there is currently no finer grained way of doing this.

Christof
Jazz Work Item team

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
× 10,927

Question asked: Sep 05 '08, 2:38 p.m.

Question was seen: 6,766 times

Last updated: Sep 05 '08, 2:38 p.m.

Confirmation Cancel Confirm