Monday, February 18, 2008

Exadel Flamingo Released

Although this blog is a bit late on the news, nonetheless, we finally released Exadel Flamingo 1.6. This is a bog milestone for the project.
For those who does not know what Flamingo is, can refer to the following articles: Integrating Flex with Seam and Flamingo.
Even though this article describes integration with JBoss Seam, Flamingo supports combination of Spring/Hibernate pretty much the same.

The new release, besides the previous features, contains vast improvements. It moved made a few steps in the direction to become an agile development framework for Flex on Java. The features of interest are:
  • Code generation greatly improved with generation of ActionScript files from Java, added ability to create CRUD screens for entities with relations (e.g. one-to-many)
  • 'CallSet' and 'Binding' Flex components added for Spring
  • Added "search by relationship" and sorting for dynamic methods
  • Spring Security integration added

The nice thing about Flamingo is now, you can develop applications on Flex blazingly fast. There is a wealth of simple scripts to generate most artifacts in the project, including a fully working scaffolding for entities - completely wired up. This is a great way to prototype a relationship model.

Another advanced feature is Dynamic Persistent Methods. This allows Flex developers to simply call methods on the remote object even though these methods are not declared anywhere!
Here is an example:
Let's say you have a Hibernate entity class declared like this:

@Entity
public class Person implements Serializable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}


On the client side, you can just execute this:

<mx:RemoteObject id="person" destination="Person" result="resultHandler(event)"/>
...
private function resultHandler(event:ResultEvent):void
{
entities = event.result as ArrayCollection;
}
...
person.findAll();
person.findByNameLike("John%");
person.findByNameNotEqual("John Smith");



The simplicity and power are apparent. No need for extra configuration, no need to think about mapping of web services, the call just executes and returns what is expected.

Dynamic Persistent Methods also support relationships. If you have two entities in a relationship:


@Entity
public class Author implements Serializable {

private Set books;
@OneToMany(mappedBy = "author", fetch = FetchType.EAGER)
public Set getBooks() {
return books;
}
}
@Entity
public class Book implements Serializable {
private Author author;

@ManyToOne(fetch = FetchType.EAGER)
public Person getAuthor() {
return person;
}
}


On the Flex side, you can call dynamic methods on relationships like this:


<mx:RemoteObject id="book" destination="Book"/>
...
book.findByPerson(currentPerson)


How was this accomplished, since these methods were not declared on the class "Person" in Java? There is not magic here, just some clever programming. Flamingo on the server side parses the request from the call, and recognizes that a method is dynamic. Then, based on the syntax rules for method names, it generates a dynamic Hibernate SQL query, executes it and returns results back to the caller (on the client side!).

As you can see, this is some powerful stuff. Of course, Flamingo is not for everyone. If you develop business database driven applications, Flamingo is a perfect candidate for consideration, if you already have an application based on Seam or Spring/Hibernate and you want you make it mode dynamic, Flamingo will suit well.

Exadel Flamingo lives here: http://www.exadel.com/web/portal/flamingo

Good luck