automatic generated forms ,workflows - java

my question consists of 2 parts
if I have a bean could i automatically generate the form from it
if i have many beans , is it possible to automatically generate a workflow of the automatically generated forms from these beans
i need this to generate form from ontology

I have done something like this using the Play! framework and Empire, which is an implementation of JPA 1 using SPARQL & triple stores in place of SQL & RDBMS.
I created Java beans annotated by Empire, which I can use to persist into my triple store, and combined with Imperium, the Empire plugin for Play!, I can use the Play! framework's built in CRUD form generation to create entry forms for my beans.
I wrote both Empire and Imperium, fwiw. There are other frameworks for semantic web bean persistence, such as Alibaba, but none that I'm aware of that integrate nicely with JPA or a web framework such as Play! which will support the CRUD form generation automatically.

You could try looking at Appfuse. You can watch a video demo of CRUD with Struts2 at http://demo.appfuse.org/ to see if it is going to be of use to you.

Related

DB administration site for Spring + JPA project

I would like to know how if there is any way to automatically generate a database administration site for a Spring + JPA project. It should take the annotated JPA entities and dynamically generate the site to keep track of any change in the domain Java classes.
I am looking for something similar to the Django admin site (I think you can also do the same with Ruby on Rails), that allows the user:
to see and update the data in the different tables without developing any extra code
to handle relations between tables, different kind of data (numbers, dates, etc)
In the Java world I am only aware of Spring Roo, but it does not fit my needs because I want to integrate it into an already existing third-party project.
Try Play! Framework's CRUD Module

Spring Roo does not generate CRUD

In Spring Roo I used this tutorial with my custom xsd to generate objects.
After that I used command controller all ~.web, controller is generated but without CRUD functions.
If I make manual objects in Roo controller with CRUD functions is generated. Any idea what is the problem?
Schema file xsd is in my case important for REST data exchange.
The tutorial you're referring to indeed explains how you can create a Java (domain) model based on a provided xml Schema, but the controller all ~.web command currently (version 1.1.0) only creates controllers and corresponding CRUD functions for actual Roo (database) entities. As the generated Java classes are not marked as Roo entities, the controller command will not create the by you expected CRUD commands, which it, as you stated, will do for manually created entities as these are marked as Roo entities (see the #RooEntity annotation on these).
As the tutorial also states, you will need to manually update your controller and view (*.jspx) files to implement the CRUD functionality when you use the Spring Roo jaxb addon. I know, from checking the forum and Jira issues, that there are currently some ideas on also having Spring Roo create basic CRUD functionality for normal (none-entity) beans (see issue ROO-344 and it's related ROO-277 issue), but these are currently only ideas and most likely won't be implemented within the near future. So, when using a XML schema as base for your Spring Roo domain model, you'll still need to do quite a bit of manual coding to have a basic CRUD application, as opposed to using a database as your base for generating your domain model, as it then basically is executing a couple of commands in the Roo shell and you're done.
If your XML schema is but a definition of your domain model and you actually do want your data to be stored in and retrieved from the database by your application, as oposed to call a REST webservice for retrieving and storing changes, you might try to use the jaxb addon to generate the model and then annotate the generated classes, but as I haven't done that myself before, I'm not sure if that will work, but it might be worth trying.
Spring Roo generates AspectJ (.aj) files next to the .java source files. So, you won't see the methods in your source files. They are in the .aj files but are present after compile in the generated .class files.

Best view layer with simple URLs for an EJB3 application

I would like to get your input on what would be the most fitting view layer for EJB 3.0 [1] Java application for me.
JSF is no good because it is a mess when it comes to web URIs. I would like a view framework which would help with automating html form submission and validation while using clean URIs like example.com/story/1 or example.com/?story=1 (using GET method).
My first guess was to go with Spring MVC. Spring is great but it feels like an overkill since JPA plus EJB already does the heavy lifting. I only need couple of things, well, four of them actually:
JPA, EJB 3.0 for business layer
Clean URIs: example.com/story/1 preferably
HTML form helpers (validation, converters, etc)
Templating similar to Apache Tiles or JSF's ui:composition
So, which one would you pick?
Ad [1]: It's used mainly for JPA and stateless/stateful local session beans
My first guess was to go with Spring MVC. Spring is great but it feels like an overkill since JPA plus EJB already does the heavy lifting.
I disagree with this statement. Spring need not be an "all or none" proposition. I see nothing wrong with using Spring web MVC if that's all you need.
I'd put your EJBs and JPA behind Spring service interfaces and let the web tier deal with those, using the usual Spring idiom.
Apache Wicket supports RESTful URL:s out of the box using a combination of BookmarkablePageLinks and PageParameters constructor of the WebPage object. Wicket does also support Velocity templates and since it's entirely OO/POJO based it's easy to maintain in general.
Wicket fits into the Model and View parts of the MVC Model 2 and contains some samples of generic validators and specified form validators and as such it has sufficient mechanisms for supporting such features.

generate java domain objects from database table

may i know in eclipse, is there any feature that will auto generate domain objects with all table relationship properly mapped in class?
can provide me with some reference articles on this?
You can use something like Hibernate to accomplish this
This plugin set for Eclipse called Hibernate Tools for Eclipse and ANT will do most of the work for you.
In particular it will do Reverse Engineering: The most powerful feature of Hibernate Tools is a database reverse engineering tool that can generate domain model classes and Hibernate mapping files, annotated EJB3 entity beans, HTML documentation or even an entire JBoss Seam application in seconds!
Telosys code generator does this kind of job.
It's an Eclipse plugin, it uses the database schema to create a light model
that is used to generate the Java code.
There are some predefined templates available on GitHub (for JPA, POJO, Documentation, Spring MVC, etc )
See http://www.telosys.org
and http://marketplace.eclipse.org/content/telosys-tools
Templates : https://github.com/telosys-templates-v3
Articles about code generation with Telosys :
https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/
https://dzone.com/articles/telosys-a-code-generation-tool-by-laurent-guerin
You can use Hibernate Tools 3.0.0.GA either via Eclipse or ANT to auto-generate your hibernate domain entities directly from your database tables.
See tutorial here :
http://docs.jboss.org/tools/3.0.0.GA/en/hibernatetools/html_single/index.html
I have a solution for you i.e to create auto generate domain objects with all table relationship properly mapped in class ...Try Dal4j yes you can find it in sourceforge.net/p/dal4j/wiki/ DAL4j is a Command Line and Framework tool that can be used to reverse engineer a MySQL or SQLServer database schema into a set of JPA Entity Beans.
DAL4j can be useful for scenarios where there is an existing database schema but a technology other that JPA is used by applications to interact with the database. DAL4j can provide an easy way to migrate your code base from other technologies such as JDBC or Hibernate to JPA.
The beans generated can be 1 or two types: Simple or Framework. Simple beans are standard pojo classes managed by your application using JPA semantics. Framework generated pojos use the DAL4j framework DAO generic to simplify CRUD operations.
DAL4j provides optional hooks to allow you integrate encryption/decryption of data fields that must be encrypted in the database.
Last, DAL4j provides a set of Generic classes that can be used to simplify creation of Session Beans which perform CRUD operations using generated Entities.
I think you will find this article feasible....
You want an object relational mapping of which Hibernate is the most popular for Java. The hibernate tools are typically better for taking annotated classes and using them to generate a schema, as opposed to vice versa, which is what you sound like you're doing. I suspect you'll be doing a lot of hand-annotating if you're working with a legacy DB schema.
if you use grails, you can generate domain objects with GRAG http://sourceforge.net/projects/grag
I use eclipse for java development, but when it comes to generating domain entities I use Net beans.
Create an EJB module, and then right click and generate entities.
You need to set up the database also you can select the tables you want visually.
Regards
Lyju
It feels like another rather common question that people always run into.
The link below links to a blog detailed enough for me to learn how to generate entities from database schema the first time.
http://shengwangi.blogspot.com/2014/12/how-to-create-java-classes-from-tables.html
Just in case, the following link refers to eclipse help page. This link should never expire:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jpt.doc.user%2Ftasks021.htm
I downloaded JBoss and failed to understand how it works. I think the plugin that I used is Hibernate Tools but I am not sure as I did not install any new plugin for this purpose. I am using Eclipse Luna for EE.
Hope this helps.
I got so tired of manually coding this kind of stuff so I made a tool to generate models, dao, and dao implementation from a schema. It's oriented towards spring boot and only tested on MySQL, but for those that don't want to use Hibernate and just want to work with jdbc/sql and JdbcTemplate, or just want POJOs with getter/setters generated for tables, then this could perhaps be something to kick off the coding.
Called Jassd (Java Automated Spring Source-code for Databases generator), I'm "jazzed" to introduce this tool: https://github.com/aforslund/jassd

What are recommendable data modeling tools and techniques for a Flex / Java web app?

I'm looking for a comprehensive setup that you've successfully used already. I've already loads of hints as to what building bricks I might use, but I'm not sure how to put it all together. Tools that need to be bought are OK, too.
Details:
I'm developing a Flex front end client for a Java server application and I have a set of model classes that represent objects in my business logic and should have the same properties and exhibit the same behaviour throughout all layers. These objects
have form validation logic for user input
are displayed in various forms (lists, detail views ...) throughout the UI
are retrieved from and sent to the server using XML or AMF
are validated again on the server
are stored in a RDBM with tables and fields corresponding to the classes and fields
This is a very common application structure, I guess. I'm already using:
ORM for the Java backend (Eclipse persistency package)
automatic mapping from XML to Action Script, using XML schema and the classes in mx.rpc.xml, as described here.
Now, what I'd really like to do is define the objects once (I already have them in XSD) and have tools set up class stubs for the whole chain. What can I use?
I've already heard of (but not evaluated):
XMLBeans to generate Java classes from XML Schema
Granite DS to generate AS classes from Java classes
I don't think your Flex UI should know or care about Java objects.
Take a "contract first", XML schema-drive approach and come up with the messages that you need to exchange between the Flex client and your service tier. Once you have that in place, the two are completely decoupled. That's a good start.
I'd also recommend not buying into a generation scheme. You'll only have to pay that price once during development.
I'm a Spring user, so I'd recommend Spring's "contract first" web services, using the Spring OXM interfaces. That will keep your UI and service tiers nicely decoupled. Use the org.springframework.oxm interfaces to do your mappings.
You can use Spring/BlazeDS to integrate your Flex UI with the Spring back end.
You have the full power of Spring IoC and AOP to create the back end.
I think you'll find it's a good approach for this problem.

Categories