In Serena Dimensions, is there a way to get user defined attributes via the JAVA API

JoelArys's picture
JoelArys asked on February 22, 2012 - 1:18pm | Replies (2).

You can query and get the value of systemattributes via the Java API:

Request.queryAttribute and passing the SystemAttributes.XXX

So, is there a way to query the user defined attributes of a request, i.e Target Release?

Kr
Joel

2 Answers

RJ47's picture
RJ47 replied on February 27, 2012 - 2:11pm.

I am having the same problem.
Does anyone know how to do it?

If I find the solution, I will post it here.

Best regards,
Ricardo Bernardino

Alex Shevchenko's picture

You can use the same method for user attributes. System attributes are predefined and negative constants. User attributes are positive. You can enumerate user attributes to find the number of attribute you need.

See example in .../CM/java_api/examples/DisplayWidth.java:

[code]List attrdefs = req.getAttributesForRoleSection((String) req
.getAttribute(SystemAttributes.STATUS), "$ALL");
// details of the request's attributes.
Iterator it = attrdefs.iterator();
while (it.hasNext()) {
AttributeDefinition ad = (AttributeDefinition) it.next();
System.out.println("attr#" + ad.getNumber() + ", name=\""
+ ad.getName() + "\", prompt=\"" + ad.getUserPrompt()
+ "\", display-width=" + ad.getDisplayWidth()
+ ", display-length=" + ad.getDisplayLength());[/code]

Did not try that myself, but should work (may be even something simplier).

Let me know if that does not work.

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.