/* 
 *  Process Aware Web Application Platform 
 * 
 *  Copyright (C) 2011-2013 Inherit S AB 
 * 
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU Affero General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 * 
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU Affero General Public License for more details. 
 * 
 *  You should have received a copy of the GNU Affero General Public License 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 *  e-mail: info _at_ inherit.se 
 *  mail: Inherit S AB, Långsjövägen 8, SE-131 33 NACKA, SWEDEN 
 *  phone: +46 8 641 64 14 
 */ 
 
package org.inheritsource.service.rest.server;

import java.util.logging.Logger;

import org.inheritsource.service.common.util.ParameterEncoder;
import org.inheritsource.taskform.engine.TaskFormService;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;



public class GetPreviousActivitiesDataByDocId extends ServerResource {

	public static final Logger log = Logger.getLogger(GetPreviousActivitiesDataByDocId.class.getName());
	
	TaskFormService engine = new TaskFormService();
	
	@Post
	@Get
	public String getPreviousActivitiesDataByDocId() {
		
		String currentActivityFormDocId = ParameterEncoder.decode((String)getRequestAttributes().get("currentActivityFormDocId"));
		
		log.fine("REST getPreviousActivitiesDataByDocId with parameter currentActivityFormDocId=[" + currentActivityFormDocId+  "]" );
		
		return engine.getPrevoiusActivitiesData(currentActivityFormDocId);
	}
}

@@ -1121,16 +1121,107 @@
 ervice;%0A
+import org.restlet.data.MediaType;%0Aimport org.restlet.representation.StringRepresentation;%0A
 import o
@@ -1245,16 +1245,16 @@
 ce.Get;%0A
-
 import o
@@ -1580,16 +1580,30 @@
 c String
+Representation
  getPrev
@@ -1898,18 +1898,59 @@
 ;%0A%09%09
-%0A%09%09return 
+StringRepresentation sr = new StringRepresentation(
 engi
@@ -2003,15 +2003,77 @@
 rmDocId)
+);%0A%09    sr.setMediaType(MediaType.TEXT_XML);%0A%09    %0A%09%09return sr
 ;%0A%09%7D%0A%7D%0A

use media type xml