2012-12-11

Ujorm 1.31 released

There is available a new release of Ujorm framework, the major changes are:
  • database statements UPDATE or DELETE supports entity relations in the Criterion - including batch mode
  • SQL entity and column names can be "quoted" optionally in the real SQL statements, for more information see the method: MetaParams.setQuotedSqlNames()
  • the one critical bug is fixed for some cases of the lazy loading
  • explicitly defined Key name created using a factory is fixed now
  • there is available the new great plugging to NetBeans IDE to generate getters and setters easy for UJO - thanks to Martin Mahr
See a more information on the release notes page.

Getter Generator for NetBeans

I would like to introduce a new open-source plugin designed for NetBeans IDE 7.2 which is used for generating getters and setters of the UJO objects by its Keys. The source  is ready to download on the SourceForge repository code include binaries. To illustrate see a few screenshots:

1. Download a file type "nbm" from SourceForge to a local directory and call the NB-plugin manager to install the plugin:




2. The new plugin we can find in the context menu on the place, where we have actions for generate getters and setters for the ordinary JavaBeans:





3. The dialog lets as select a Keys to getters and setters. The last option below under the list enables to copy a JavaDoc from Keys to the methods.





4. Result: The generated code will look similar to the following:



For this plugin deserve our thanks to the author Martin Mahr.

2012-11-27

Instructions for migration to Ujorm 1.30

If you are considering migrating to Ujorm 1.30, I recommend to use three simple steps:
  1. upgrade Maven dependendecies to: groupId=org.ujorm + version=1.30
  2. replace all texts "UjoProperty" for the targets "Key" in your project and
  3. fix deprecated methods

Optionally, you can use the KeyFactory class to create new keys instead of original static factory methods.

2012-11-04

Module Ujo-Wicket dependency

In the last release 1.30 I have found a small bug in dependency on the artifact ujo-wicket. Fortunately there is a simple solution using a small hack. See the next dependecies solution to fix it:
<dependency>
    <groupId>org.ujorm</groupId>
    <artifactId>ujo-wicket</artifactId>
    <version>1.30</version>
    <exclusions>
        <exclusion>
            <groupId>org.ujorm</groupId>
            <artifactId>ujo-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.ujorm</groupId>
    <artifactId>ujo-core</artifactId>
    <version>1.30</version>
</dependency>

2012-10-27

Ujorm 1.30 released

After a long pause I would like to introduce a new version, Ujorm 1.30, with several important changes in the API - in the first place I should mention that the original interface called UjoProperty was renamed to Key. The original interface is kept as @Deprecated now, however, its implementation classes remain. The reasons for the change are the following:
  • the original interface name UjoProperty was a little confusing due his immutable features and it was sometimes difficult to explain its meaning. The new name reflects the parameter names of the common interface java.util.Map.
  • the original name was too long and therefore the source code was difficult to read
  • several new classes have been created recently and it was useful to make the decision quickly. Particularly there are two new classes, KeyRing and KeyFactory.

The new KeyRing object is a serializable collection of Keys. Know that any instance of the Key is not serializable directly because it must have a unique instance in the class-loader. Yet sometimes we need to serialize some Keys, and the KeyRing can be the right solution. An example of this real use can be a use with the Wicket framework.

The second class is called KeyFactory and is used to create new instances Keys. An advantage of the factory is that it can also be used to create static Keys in an interface. The factory can create the Key name according to its field name, optionally the name can be converted to camel-case. Now there is no need to send the key’s data type as a parameter when creating it because this framework can obtain the value from the meta-model of the field when the factory is locked (or when the getKeys() method is called for the first time). Each Key contains a new attribute with its domain class now. An example of the use:

public class Person extends AbstractUjo {
private static final KeyFactory f = newFactory(Person.class);
   
public static final Key<Person,String > NAME = f.newKey();
public static final Key<Person,Boolean> MALE = f.newKey();
public static final Key<Person,Double > CASH = f.newKey();
   
@Override public KeyList<?> readKeys() {
    return f.getKeys();
}
}

The Ujorm framework offers a new, simplified key called WeakKey, which does not have a generic domain parameter. It can be used instead of constants for working with Map, List objects, or for reading parameters from the HttpRequest object, where it converts to the desired data type. The instance is created using the WeakKeyFactory class.

Ujorm can be connected with a Maven project using:

<dependency>
    <groupId>org.ujorm</groupId>
    <artifactId>ujo-core</artifactId>
    <version>1.30</version>
</dependency>


in case of use of the ORM module use:

<dependency>
    <groupId>org.ujorm</groupId>
    <artifactId>ujo-orm</artifactId>
    <version>1.30</version>
</dependency>


To use UJO objects in Wicket framework, an implementation of the KeyModel class is necessary. The KeyModel class is similar to the standard implementation of a Wicket class called PropertyModel. The class can be joined using the following depenency:

<dependency>
    <groupId>org.ujorm</groupId>
    <artifactId>ujo-wicket/artifactId>
    <version>1.30</version>
</dependency>

The Wicket-support module does not contain a wide range of services, yet I am enclosing a simple example of creating a simple table for inspiration:

List<ICellPopulator> columns = KeyPopulator.list
    ( Employee.ID
    , Employee.FIRSTNAME
    , Employee.LASTNAME
    , Employee.ADDRESS.add(Address.CITY)
    );

final WebMarkupContainer table = new WebMarkupContainer("table");
final DataGridView grid = new DataGridView("gridPanel", columns,
     new  InnerPeopleProvicer());
table.setOutputMarkupId(true);
grid.setItemsPerPage(20);
add(table);
table.add(grid);
add(new AjaxPagingNavigator("tableNavigator", grid));


I apologize for significant API changes to all users of the Ujorm framework, however, all the chages are necessary for further development of this library.

Further information can be found in: