This module is a quick solution as well as exclusive for the management,organization and storage of generic Entities and their Addresses in a common web application. The module provides hooks to manage duplicated entries through the use of deduplication algorithm: a simple but efficient one has been already implemented

Terms and definitions

  • Entry Represents a logical entry in the registry. Logical entries are the registry elements thus they does not provide any specific information about the real entry information. Registry entries could be categorized into two main types: 1)groups of entries, also known as List - 2)And a single Entity.
  • A List is a set of non duplicate Entries usable whenever an Entry is required. Being another entry it can also contains other List as Entries useful whenever you want to "group" your entries.
  • an Entity represent the atomic and concrete element of the registry. Properties of this Entry could be used to generically to describe both a person and a corporation and should be as flexible to allow any other possible definition.
  • a Person represents a phisical person registry entry.
  • a Corporation represents a legal person entity in the registry. It can be used to store commercial corporation entities, non-profit organizations informations and public corporations like countries and states, eventually through subclassing.
  • the Address generic concept of a physical address. Registry module provide a list of its implementations as Mail,Phone,Email,Web,Messenger ready to be related to your Entity.
  • Reletionship describes the relations between two Entities.
  • EntryHelper used to retrieving more address informations from your entities.

Avoid Duplicate Entries

Often ,one of the first requirement in a management system , is to avoid the duplicate data into the database. Registry module provides ,through the use of DeduplicationStrategy ,an easy way to resolve this problem

As described above ,supposing you have a reasonable number of Entity,represented by Person or Corporation in your data storage, and would like to clean them from duplicates,

the first step to move is trying registry generic algorithm. In this way you can obtain , starting from a registered Entity, a list of possible duplicates to remove.

import net.smartlab.web.*;
import net.smartlab.web.registry.*;

public class MyAction extends Action {
        
        net.smartlab.web.registry.Domain domain=net.smartlab.web.registry.Domain.getInstance();
        
        public String myMethod(ActionForm form, HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws ActionException {
                try {
                        Entity entity = (Entity)domain.findEntry(request.getParameter("id"));
                        Collection duplicates = domain.listDuplicates(Entity entity);
                        //your code here
                        ....
                        ....
                        request.setAttribute("duplicates", duplicates);
                        return "success";
                } catch (BusinessException be) {
                        throw new ActionException(be.getMessage(), be.getCause());
                }
        }
}

However a framework should allow for simplicity without force so if you need to implements your DuplicationStrategy and to integrate it with the existent code.

import net.smartlab.web.*;
import net.smartlab.web.registry.*;

public class YourBusinessDeduplicationStrategy implements DeduplicationStrategy {

        
        public DeduplicationCode digest(Entity entity){
                //Insert here your code to digest the entity
        }

        public Criteria getCriteria(Criteria criteria, DeduplicationCode code) throws HibernateException{
                //Insert here your code to get a right hibernate criteria.
        }
        

}