Subversion Repositories eFlore/Applications.cel

Rev

Rev 157 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 157 Rev 318
Line 29... Line 29...
29
	private ImageModele iModele = null;
29
	private ImageModele iModele = null;
Line 30... Line 30...
30
	
30
	
Line 31... Line 31...
31
	private ObservationModele oModele = null ;
31
	private ObservationModele oModele = null ;
-
 
32
	
-
 
33
	private String identifiant = "" ;
Line 32... Line 34...
32
	
34
	
33
	private String identifiant = "" ;
35
	private String mode = "";
-
 
36
 
34
 
37
	public MotsClesAsynchroneDAO(ImageModele im) {
35
	public MotsClesAsynchroneDAO(ImageModele im) {
38
		iModele = im;
Line 36... Line 39...
36
		iModele = im;
39
		mode = "images";
37
		identifiant = im.getIdentifiant();
40
		identifiant = im.getIdentifiant();
-
 
41
	}
38
	}
42
	
39
	
43
	public MotsClesAsynchroneDAO(ObservationModele om) {
Line 61... Line 65...
61
	 *            le rafraichissable qui demande les données
65
	 *            le rafraichissable qui demande les données
62
	 */
66
	 */
63
	public void obtenirListeMotsCles(final Rafraichissable r) {
67
	public void obtenirListeMotsCles(final Rafraichissable r) {
64
		// on demande tous les mots clés associés à l'utilisateur
68
		// on demande tous les mots clés associés à l'utilisateur
65
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, Configuration.getServiceBaseUrl()
69
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, Configuration.getServiceBaseUrl()
66
				+ "/InventoryKeyWordList/" + identifiant);
70
				+ "/InventoryKeyWordList/"+mode+"/"+identifiant+"/");
Line 67... Line 71...
67
 
71
 
68
		try {
72
		try {
Line 69... Line 73...
69
			rb.sendRequest(null, new RequestCallback() {
73
			rb.sendRequest(null, new RequestCallback() {
Line 73... Line 77...
73
 
77
 
Line 74... Line 78...
74
				}
78
				}
75
 
79
 
76
				public void onResponseReceived(Request request,
80
				public void onResponseReceived(Request request,
77
						Response response) {
81
						Response response) {
78
 
82
					
-
 
83
					final JSONValue responseValue = JSONParser.parse(response
79
					final JSONValue responseValue = JSONParser.parse(response
84
							.getText());
80
							.getText());
85
					
Line 81... Line 86...
81
					// si la requête est un succès on reçoit un tableau
86
					// si la requête est un succès on reçoit un tableau
82
					if (responseValue.isArray() != null) {
87
					if (responseValue.isArray() != null) {
Line 101... Line 106...
101
	 * @param motcle
106
	 * @param motcle
102
	 *            le mots clés à ajouter avec son parent et son identifiant
107
	 *            le mots clés à ajouter avec son parent et son identifiant
103
	 */
108
	 */
104
	public void ajouterBaseDeDonnees(String motcle) {
109
	public void ajouterBaseDeDonnees(String motcle) {
105
		if (!motcle.equals("")) {
110
		if (!motcle.equals("")) {
106
			String postData = motcle;
111
			String postData = motcle+"&mode="+mode;
Line 107... Line 112...
107
 
112
 
108
			// on fait un post asynchrone
113
			// on fait un post asynchrone
109
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
114
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
110
					+ "/InventoryKeyWordList/");
115
					+ "/InventoryKeyWordList/");
Line 148... Line 153...
148
			String postData = "";
153
			String postData = "";
149
			postData += "&action=DELETE";
154
			postData += "&action=DELETE";
Line 150... Line 155...
150
 
155
 
151
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
156
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
-
 
157
					+ "/InventoryKeyWordList/"
152
					+ "/InventoryKeyWordList/"
158
					+ mode
153
					+ identifiant
159
					+ identifiant
154
					+ "/"
160
					+ "/"
Line 155... Line 161...
155
					+ motcle);
161
					+ motcle);
Line 188... Line 194...
188
	public void modifierBaseDeDonnees(String motcle) {
194
	public void modifierBaseDeDonnees(String motcle) {
Line 189... Line 195...
189
 
195
 
Line 190... Line 196...
190
		if (!motcle.equals("")) {
196
		if (!motcle.equals("")) {
191
 
197
 
Line 192... Line 198...
192
			String postData = "";
198
			String postData = "";
193
			postData += "&action=modification" + motcle;
199
			postData += "&action=modification"+motcle;
194
 
200
 
195
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
201
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
Line 196... Line 202...
196
					+ "/InventoryKeyWordList/" + identifiant);
202
					+ "/InventoryKeyWordList/"+mode+"/"+ identifiant);
197
			try {
203
			try {
Line 226... Line 232...
226
	public void deplacerBaseDeDonnees(String motcle) {
232
	public void deplacerBaseDeDonnees(String motcle) {
Line 227... Line 233...
227
 
233
 
Line 228... Line 234...
228
		if (!motcle.equals("")) {
234
		if (!motcle.equals("")) {
229
 
235
 
Line 230... Line 236...
230
			String postData = "";
236
			String postData = "";
231
			postData += "&action=deplacement" + motcle;
237
			postData += "&action=deplacement"+motcle;
232
 
238
 
233
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
239
			RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, Configuration.getServiceBaseUrl()
Line 234... Line 240...
234
					+ "/InventoryKeyWordList/" + identifiant);
240
					+ "/InventoryKeyWordList/"+mode+"/"+identifiant);
235
			try {
241
			try {