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
- Host: GitHub
- URL: https://github.com/fiware/cloud.commons
- Owner: FIWARE
- License: apache-2.0
- Created: 2016-03-02T15:15:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T15:15:54.000Z (almost 10 years ago)
- Last Synced: 2025-01-18T08:29:29.186Z (12 months ago)
- Language: Java
- Size: 126 KB
- Stars: 0
- Watchers: 10
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
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