Skip to content

Commons library for the Software Deployment & Configuration and PaaS Manager implementations of the FIWARE project.

License

Notifications You must be signed in to change notification settings

telefonicaid/fiware-commons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commons library - Overview

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 <<class>> of the entity to be managed by the DAO.
  • The second template parameter is the <<type>> of the entity's business key:

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

public interface ExampleDao extends BaseDAO<Example, String> {
     // Add here some additional methods only if needed
     List<Example> 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<Example, String> implements ExampleDao {
/**
 * @see AbstractBaseDao#findAll()
 */
    public List<Example> 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<Example> findByCriteria(ExampleSearchCriteria criteria) {
    ...
}

}

Installation

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

<dependency>
    <groupId>com.telefonica.fiware</groupId>
    <artifactId>commons</artifactId>
    <version>${commons-version}</version>
</dependency>

About

Commons library for the Software Deployment & Configuration and PaaS Manager implementations of the FIWARE project.

Resources

License

Stars

Watchers

Forks

Packages

No packages published