Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,157
Community Members
 
Community Events
184
Community Groups

Insight objectAttributeBeanFactory.createObjectAttributeBeanForObject cannot get ObjectBean

Hello there.

I am just reusing my working script, with the difference then before I used in Jira based of CF.

Now I want to search for a object via IQL facade a iterate over the results.

Here is the code:

import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeBean

import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeValueBean

import com.riadalabs.jira.plugins.insight.services.model.MutableObjectAttributeBean

import com.riadalabs.jira.plugins.insight.services.model.MutableObjectBean

import com.atlassian.jira.component.ComponentAccessor

Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade") 

def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass)

def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade"));

def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade"));

def objectAttributeBeanFactory = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory"));

int person_uuid = 515

def uuid_att = objectTypeAttributeFacade.loadObjectTypeAttributeBean(person_uuid)

def mutableUuidAtt = uuid_att.createMutable()

def persons = iqlFacade.findObjectsByIQLAndSchema(3,"objectType = \"Kontaktní osoby\" AND UUID IS empty")

if (persons != [])

{

for (person in persons)

  { 

 def uuid = UUID.randomUUID()      

/* Create the new attribute bean based on the value */     

      def uuidBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(person, mutableUuidAtt, uuid)

      /* Load the attribute bean */

      def objectAttributeBean = objectFacade.loadObjectAttributeBean(uuid_att.getId())

      if (objectAttributeBean != null) {

        /* If attribute exist reuse the old id for the new attribute */

        uuidBean.setId(objectAttributeBean.getId())

      }

/* Store the object attribute into Insight. */

        try {

            uuid_att = objectFacade.storeObjectAttributeBean(uuidBean);

        } catch (Exception vie) {

            log.warn("Could not update object attribute due to validation exception:" + vie.getMessage());

        }

}

}

and here is the error I cannot go thru.

groovy.lang.MissingMethodException: No signature of method: com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactoryImpl.createObjectAttributeBeanForObject() is applicable for argument types: (com.riadalabs.jira.plugins.insight.services.model.ObjectBean, com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeAttributeBean...) values: [surname1, Josef (UATD-7998), ObjectTypeAttributeBean [id=515, name=UUID, type=DEFAULT, defaultType=TEXT], ...]
Possible solutions: createObjectAttributeBeanForObject(com.riadalabs.jira.plugins.insight.services.model.ObjectBean, com.riadalabs.jira.plugins.insight.services.model.ObjectTypeAttributeBean, [Ljava.lang.String;), createObjectAttributeBeanForObject(com.riadalabs.jira.plugins.insight.services.model.ObjectBean, com.riadalabs.jira.plugins.insight.services.model.ObjectTypeAttributeBean, java.text.DateFormat, java.text.DateFormat, [Ljava.lang.String;)
I tried numerous of changes in both object and object attribute with no success. This script is 100% working while hooked up to custom field, but now ... this :-/ any help? Thanks

1 answer

1 accepted

3 votes
Answer accepted

Type error for UUID, createObjectAttributeBeanForObject expects last argument to be string or date format, not java.uuid.

Thanks Máro, that was the issue. Was bllind. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events