/**
 * 
 */
package fr.utbm.to52.smarthome.repository;

import java.util.List;

import org.json.JSONObject;
import org.lightcouch.CouchDbDesign;
import org.lightcouch.DesignDocument;

import fr.utbm.to52.smarthome.model.note.Note;

/**
 * @author Alexandre Guyon
 *
 */
public class NoteDAO extends AbstractDAO<Note> {

	private static final String designDoc = "note";
	
	public void setUp(org.lightcouch.CouchDbClient s) {
		super.setUp(s);
		
		CouchDbDesign d = s.design();
		d.synchronizeAllWithDb();
		DesignDocument ds = d.getFromDesk(NoteDAO.designDoc);
		s.design().synchronizeWithDb(ds);
	}
	
	
	@Override
	public void save(Note data) {
		this.couch.save(data);
	}

	@Override
	public List<Note> getData() {
		return this.couch.view(NoteDAO.designDoc+ "/list").query(Note.class);
	}

	@Override
	public List<Note> getData(JSONObject criteria) {
		// TODO Auto-generated method stub
		return null;
	}

}

@@ -104,83 +104,8 @@
 ect;
-%0Aimport org.lightcouch.CouchDbDesign;%0Aimport org.lightcouch.DesignDocument;
 %0A%0Aim
@@ -366,29 +366,8 @@
 ;%0A%09%09
-%0A%09%09CouchDbDesign d = 
 s.de
@@ -376,13 +376,8 @@
 gn()
-;%0A%09%09d
 .syn
@@ -388,44 +388,25 @@
 nize
-All
 WithDb(
-);%0A%09%09DesignDocument ds = d
+s.design()
 .get
@@ -436,43 +436,8 @@
 Doc)
-;%0A%09%09s.design().synchronizeWithDb(ds
 );%0A%09

Clean note DAO