cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a report in java?

SKumar
Super Contributor

All

 

I need help 🙂

 

I am running Mega 2009 Sp5 Patch 5 Rls 6. I would like to create a report similar to Application Communication, but .

 

I am very well versed with java. What I dont know is where to start. I have no clue as to where to begin, I looked around in the Knowledge base, but couldnt find an article that explains this.

 

1. How do I develop a report from a Java IDE like Eclipse?

2. How do I run the Java code from within the tool?

3. Could someone post a sample java report?

4. What additional licenses would I need inorder to create a report

5. If i cannot create this in an IDE, how do I create one in mega and debug?

 

I would be very thankful if someone points me in the right direction!

 

-S

 

11 Replies

SKumar
Super Contributor

You guys rock! A lot of great feedback! Thanks again!

Hello again

 

Am I forced to refer to these numbers every time I start exploring ?

--> It is highly recommended to use such ID instead of a reference to the name of a MEGA metamodel element when coding  (ex: reference to a MetaAttribute, reference to a MetaClass, reference to a MetaAssociationEnd

 

Why?

 Because in time, a MEGA metamodel element can be renamed but of course the ID of this element does not change.

It the code refers to the ID it is not impacted by the change of names

See also this article  http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqR5AAI 

Jerome

The number are the identifier used by in the API to know which Object you're referencing.

 

So, if you want to use, for example, the property Short Name, in your Java plugin, you'll have to use the method getProp(java.lang.Object propID) and put the property identifier ( ~Z20000000D60[Short Name] ) as the propID parameter. 

 

By the way, if you go into MEGA and enter this identifier in the field "Explore an object by its Absolute Identifier" in the Meta Studio Console, you will obtain the Object you looking for. 

 

Therefore, if you are trying to make a specific plugin, you can add this number directly in your code, and use them when you need it. The easier way is to put them as global variable in your code, so you can use them as much as you want and obtain what you are looking for. 

 

I hope my answer will help you to understand better the purpose of this identifiers and the way to use them. However, I think that there are some MEGA employee who would be better than me to explain it with details. 



Patrick Bobo

SKumar
Super Contributor

Patrick

 

Thanks for the response.

 

I am still not clear about the numbers: Am I forced to refer tot hese numbers every time I start exploring ? I was surprised to see them because in the coding phase, how are you supposed to have these numbers? Dont they come later at a runtime?

 

Pardon me for my ignorance, but I am thinking that I am missing something.....

Hi, 

 

I will try to answer your questions, even if I'm just an intern so I might not have all the answers, but I'm sure someone with more knowledge will correct me if what I say isn't right. 

 

  1. The getSelection method is indeed the here to run the queries, as you can do it in VB Script in MEGA Script Editor. Hence, you just need to put a query as you would do in a VB Script or in the Registered Queries tab in MEGA as the "String request" argument.
    Here is an exemple : 
    MegaCollection metaAssociationsInitiative = root.getCollection("Select [MetaAssociationEnd] Where [MetaClass]='Initiative'"); 
    You can probably register to a Registered Query, but I don't know how to do that.

  2. This kind of numbers ( ~Jq(Ipv4W4P50[Analysis - Set of Parameters] ) is a identifier for the Objects ( in general ) in MEGA API. It's composed by : 
    - a "~ " at the beginning
    - the Absolute Identifier
    - the Name of the Object
     You can obtain it by using the method megaUnnamedField() on a MegaObject.
  3. I don't think there's another article than the Javadoc for the package com.mega.modeling.api, so you probably should refer to the persons on the forum if you have some difficulties to do something.
    You can use all the classes for every .jar files in the folder java/lib while you have added them to your project in Eclipse as Referenced Library

 

I hope my answers will help you ! 

 

Have a good day, 

 



Patrick Bobo

SKumar
Super Contributor

Thanks a lot!Thats a lotof help to start with!

 

I was able to download the articles from mega.com/support. Thanks a lot! Some things that are not clear from the examples are these:

 

1. When creating the dataset, how do we run the queries from the underlying repository? I mean say, I pass an application A as a parameter,  and I would like to query all sub-applications, how do we do this? I have looked at the root object, it has a getSelection(String request, criteria). How do we build this query String? Just append like a SQL JDBC Query?

 

1b. Can I refer to a registered query from java API? How do I do that?

 

2. Some of the example code has the following: paramDataset.setCallback("~Jq(Ipv4W4P50[Analysis - Set of
Parameters]"); These numbers are something that we need to insert or they are just the result of cut and paste?

 

3. Is there an article on com.mega.modeling.api other than javadoc? Am I free to use classes from com.mega.modeling.api in my code? My guess is that I should be able to as I have access to Mega Root in the input to getReportContent method. 

 

Thanks a lot again! These document are really helpful!

MEGA EA software provides API script functions to browse the MEGA repository data

 

They can be used with various languages and development environment

See this article http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqR7AAI

 

Apart from Java language, programming, and report template development steps, you will have to learn such APIs to  develop report generators in java.

Jerome

It depends on the document

 

MEGA Publisher EN.pdf, section 'Report Templates'
This is a user manual
See the subfolder 'Documentation' of the MEGA Desktop installation

 

Article Writing Java Report Chapters EN.pdf + Article Writing Java Report Renderers EN.pdf
These are tehcnical articles
See section 'Technical article' of MEGA web site
http://www.mega.com/support/?mega_72&documentation&service_pack_5&_en&technical_articles
Use the same login as for the community
 
Java Report Documentation (mj_anls.doc.zip)
See the subfolder '\java\doc' of the MEGA Desktop installation

Jerome

SKumar
Super Contributor

You also said that I need to know API Script programming in any case, what do you mean by that? are you  referring to programming skills in general or any particulr scripting language like VBScript?

 

SKumar
Super Contributor

Jerome

 

I am new to this site - where do I find these articles? I searched for them using the search provvided in Community as well as KB, but couldnt find them.

 

Could you please post the links?

 

Regards

S