Good afternoon,
I am stuck with groovy automation script, which will create new object type with given name string in object schema.
I tested a lot with insight classes. ObjectTypeFacade class has a method createObjectTypeBean(com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBean objectTypeBean), but it is used as i understood to convert MutableObjectTypeBean to ObjectTypeBean.
I have no clue whether it is possible to create new object type with groovy script at all.
I also tried with ImmutableFactory https://insight-javadoc.riada.io/insight-javadoc-5.4.2/index.html?com/riadalabs/jira/plugins/insight/services/model/ImmutableFactory.html
def immutableFactory = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.ImmutableFactory"));
def newObjectType = immutableFactory.createObjectType(name=someString);
but it gives me an error:
MissingMethodException: No signature of method: com.riadalabs.jira.plugins.insight.channel.external.api.facade.impl.ObjectFacadeImpl.createObjectType() is applicable for argument types: (java.lang.String)
Does anyone has a solution to create this MutableObjectTypeBean which is used to set the data? The following doesn't work either.
def mutableObjectTypeBean = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBean"));
MutableObjectTypeBean newObjectType = new MutableObjectTypeBean();
And is it possible just to parse Name and ParentObjectTypeId properties, because if i give it a random Id also, this might make a conflict as the id could be already in use.
The code in the above answer no longer works. The below function causes compilation error.
import com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBean;
MutableObjectTypeBean newObjectType = new MutableObjectTypeBean();
I believe the right way to use insight objects in groovy console is as below.
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.riadalabs.jira.plugins.insight")
import com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBean;
def newObjectType = new MutableObjectTypeBean();
Enjoy coding...
Found the solution. Had to import the class through import (not through
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.