Hi ,
Is it possible to access a Active Object Entity in my groovy script ? in my groovy class i need to check values which i have stored in an active object table . i will be using my groovy class with behaviours plugin .
If yes how ? can someone please guide me on how to acheive this .
Thanx in advance :)
Community moderators have prevented the ability to post new answers.
You should be able to access Active Objects in your groovy script.
However you'd need to get it injected, the Active Objects component cannot be accessed through the ComponentManager.
If you provide some example of how you work with Groovy in your plugin, I might be able to better help with getting things working. Care to share some source code?
Hi Sam ,
I have created a plugin which stores data in it using Active objects entity , i want to access this entity in a groovy class which i will use to add behaviours to a customfield. I have not started any coding with this groovy class .
pseudo code
-> ActiveObjects ao;
->final class_name =ao.find(myEntity.class);
->if(class_name contains ("something"))
->display values corressponding to "something"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm so its not possible to access the entity from an external groovy class , its private to the plugin . am i right ? I thought i can access it like how we access the database , because i can see a AO table in the database .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What I'd like to know is how you're going to instantiate your Groovy class in the context of the plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Indeed each plugin's Active Objects component is unique and not accessible from outside the scope of that plugin. The fact that you can see the tables in the database is purely a fact that we can't hide them as Active Objects simply uses the same database as the application itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So can i access this entity via database ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is nothing preventing you from doing it, if you can get hold of a connection. But I strongly advice against doing so. This is not how Active Objects is meant to be used, and therefore it might have some unwanted side effects.
I you need access to some data, you might want to get that data exposed from by the plugin itself in a consumable form for you. For example as a REST service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The answer should be yes... personally I have not used AO yet. Can you get your an instance of ao using:
ComponentManager.getOSGiComponentInstanceOfType("com.atlassian.activeobjects.external.ActiveObjects")
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get an error "unable to resolve class" when i try to update my class in behaviours , i used
ActiveObjects ao =ComponentManager.getOSGiComponentInstanceOfType("com.atlassian.activeobjects.external.ActiveObjects");
I am not sure whether this is possible , i need to use something like
Example[] varx=ao.find(Example.class,"example_id=1");
in my groovy class .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will likely need to rebuild behaviours plugin component-import AO I think... I will have a play later and get back to you. But actually it should be without the quotes..
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.