I was wondering if there is any way to get an attribute label name of an object in Insight?
Getting the attribute values is somewhat straight forward, but I can't seem to find a way to get the attribute label name?
The code below show how to get an array of all the attribute values of an objectBean, but if I wanted to create a map instead how would I do this?
Ex: [key: "NKDB-34", name: "Something", created: "Date"...]
import com.atlassian.jira.component.ComponentAccessor;
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
//Get insight object.
def objectKey = "NKDB-34";
def insightObject = objectFacade.loadObjectBean(objectKey);
//Get attributes of insight object as a list.
def attributeList = insightObject.getObjectAttributeBeans();
//Get an array with all the values from a insight object.
def attributeValues = [];
attributeList.each { attribute ->
def value = attribute.getObjectAttributeValueBeans()[0];
if (value) {
attributeValues.push(value.getValue());
} else {
attributeValues.push(value);
}
}
return attributeValues;
I'm on Server (8.3.1) btw...
I would also like to know :)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.