You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This module will contain a Complex Observation Handler used to store unstructured data in the form of a complex observation to any storage systems suited for the purpose. It will also provide an API for other modules to store unstructured data using a DAO that can be implemented to store this data using various storage backends. It will also provide configuration options page allowing the user to select the preferred backend that is used for storage.

Design

Implementing the ComplexObsHandler (and ComplexNoteHandler in the future)

Complex Obs Handler
public class UnstructuredDataHandler extends AbstractHandler implements ComplexObsHandler {
	
	@Override
	public Obs saveObs(Obs obs) throws APIException {
		
		String contentType = getContentType(obs.getComplexData().getTitle()); 
		
		if (UnstructuredDAOUnstructuredDataHandler.getUnstructuredDAO(contentType).saveObs(obs)){
			obs.setComplexData(null);
			obs.setValueComplex(obs.getTitle());
		}	else {
			throw new UnstructuredDataStorageException();
		}
		
		return obs;
	}
	
	@Override
	public boolean purgeComplexData(Obs obs) {
		String contentType = getContentType(obs.getComplexData().getTitle());		
		return UnstructuredDAOUnstructuredDataHandler.getUnstructuredDAO(contentType).purgeObs(obs);
	}

	@Override
	public Obs getObs(Obs obs, String view) {
		String contentType = getContentType(obs.getComplexData().getTitle());		
		return UnstructuredDAOUnstructuredDataHandler.getUnstructuredDAO(contentType).getObs(obs);
	}
 
	String getContentType(String title){
	//do parsing here
	}
}

Interfaces

Unstructured Data Service Interface
public interface UnstructuredDataHandler {

	/** To be called by the ComplexObsHandler/ComplexNoteHandler */
	UnstructuredDAO getUnstructuredDAO(String contentType);

	/** For each DAO a call to this method will be added in the ModuleActivator willStart() method */
	void RegisterUnstructuredDAO (String contentType, UnstructuredDAO prototype) throws AlreadyRegisteredException;
	/** For each DAO a call to this method will be added in the ModuleActivator willStop() method */
	void DeregisterUnstructuredDAO(String contentType);
}


Unstructured DAO Interface
public interface UnstructuredDAO {
	
	Boolean saveObs(Obs obs);
	Boolean saveNote(Note note);
	
	Boolean purgeObs(Obs obs);
	Boolean purgeNote(Note note);
 
	Note getNote(Note note);
	Obs getObs(Obs obs);
}

 

THIS PAGE IS A WORK IN PROGRESS

  • No labels