An open API service indexing awesome lists of open source software.

https://github.com/fiware/cloud.commons

This is a mirror repo. Please fork from https://github.com/telefonicaid/fiware-commons
https://github.com/fiware/cloud.commons

Last synced: 4 months ago
JSON representation

This is a mirror repo. Please fork from https://github.com/telefonicaid/fiware-commons

Awesome Lists containing this project

README

          

Commons library - Overview
____________________________

| |Build Status| |Coverage Status|

What you get
============

Fiware commons library used in paasmanager, sdc and puppetwrapper

How to use DAO with this library
=========================

As you can see, the provided interface is a template using generic data types:

* The first template parameter is the <> of the entity to be managed by the DAO.

* The second template parameter is the <> of the entity's business key:

The code below is a common example of how to use BaseDAO.::

public interface ExampleDao extends BaseDAO {
// Add here some additional methods only if needed
List findByCriteria(ExampleSearchCriteria criteria);
}

If you want to use the JPA-Based implementation you only have to write the code bellow::

public class ExampleDaoJpaImpl extends AbstractBaseJpaDao implements ExampleDao {
/**
* @see AbstractBaseDao#findAll()
*/
public List findAll() throws DaoException {
return findAll(Example.class);
}

/**
* @see AbstractBaseDao#load(java.io.Serializable)
*/
public Example load(String id) throws NoSuchEntityException {
return loadByUniqueField(
Example.class, FIELD_USERNAME, id);
}

// The rest of methods are already implements
//...

/**
* This method shall be implemented
*/
List findByCriteria(ExampleSearchCriteria criteria) {
...
}
}

Installation
==============
If you are using maven in your project, you simply add this dependency to your pom.xml::


com.telefonica.fiware
commons
${commons-version}

.. IMAGES

.. |Build Status| image:: https://travis-ci.org/telefonicaid/fiware-commons.svg
:target: https://travis-ci.org/telefonicaid/fiware-commons
.. |Coverage Status| image:: https://coveralls.io/repos/telefonicaid/fiware-commons/badge.svg?branch=develop
:target: https://coveralls.io/r/telefonicaid/fiware-commons