// Path: src/java/is/idega/idegaweb/egov/bpm/IWBundleStarter.java
// public class IWBundleStarter implements IWBundleStartable {
// 	
// 	public static final String IW_BUNDLE_IDENTIFIER = "is.idega.idegaweb.egov.bpm";
// 
// 	public void start(IWBundle starterBundle) {
// 		
// //		EgovBPMViewManager viewManager = EgovBPMViewManager.getInstance(starterBundle.getApplication());
// //		viewManager.initializeStandardNodes(starterBundle);
// 	}
// 
// 	public void stop(IWBundle starterBundle) {
// 	}
// }


import is.idega.idegaweb.egov.bpm.IWBundleStarter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import com.idega.block.process.presentation.beans.CasesSearchResultsHolder;
import com.idega.core.file.util.MimeTypeUtil;
import com.idega.idegaweb.IWResourceBundle;
import com.idega.io.DownloadWriter;
import com.idega.io.MediaWritable;
import com.idega.io.MemoryFileBuffer;
import com.idega.jbpm.artifacts.presentation.ProcessArtifacts;
import com.idega.jbpm.exe.BPMFactory;
import com.idega.jbpm.exe.ProcessInstanceW;
import com.idega.jbpm.exe.ProcessManager;
import com.idega.presentation.IWContext;
import com.idega.user.data.User;
import com.idega.util.FileUtil;
import com.idega.util.expression.ELUtil;
package is.idega.idegaweb.egov.bpm.media;






public class ProcessUsersExporter extends DownloadWriter implements MediaWritable {

	public static final String PROCESS_INSTANCE_ID = "pr-inst-id";
	public static final String SHOW_USER_COMPANY = "show-u-c";

	@Autowired
	private BPMFactory bpmFactory;
	
	@Autowired
	private ProcessArtifacts processArtifacts;
	
	private MemoryFileBuffer memory = null;
	
	@Override
	public String getMimeType() {
		return MimeTypeUtil.MIME_TYPE_EXCEL_2;
	}

	
	@Override
	public void init(HttpServletRequest req, IWContext iwc) {
		ELUtil.getInstance().autowire(this);
		String id = iwc.getParameter(PROCESS_INSTANCE_ID);
// Path: src/java/is/idega/idegaweb/egov/bpm/IWBundleStarter.java
// public class IWBundleStarter implements IWBundleStartable {
// 	
// 	public static final String IW_BUNDLE_IDENTIFIER = "is.idega.idegaweb.egov.bpm";
// 
// 	public void start(IWBundle starterBundle) {
// 		
// //		EgovBPMViewManager viewManager = EgovBPMViewManager.getInstance(starterBundle.getApplication());
// //		viewManager.initializeStandardNodes(starterBundle);
// 	}
// 
// 	public void stop(IWBundle starterBundle) {
// 	}
// }


// Path: src/java/is/idega/idegaweb/egov/bpm/media/ProcessUsersExporter.java
import is.idega.idegaweb.egov.bpm.IWBundleStarter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import com.idega.block.process.presentation.beans.CasesSearchResultsHolder;
import com.idega.core.file.util.MimeTypeUtil;
import com.idega.idegaweb.IWResourceBundle;
import com.idega.io.DownloadWriter;
import com.idega.io.MediaWritable;
import com.idega.io.MemoryFileBuffer;
import com.idega.jbpm.artifacts.presentation.ProcessArtifacts;
import com.idega.jbpm.exe.BPMFactory;
import com.idega.jbpm.exe.ProcessInstanceW;
import com.idega.jbpm.exe.ProcessManager;
import com.idega.presentation.IWContext;
import com.idega.user.data.User;
import com.idega.util.FileUtil;
import com.idega.util.expression.ELUtil;

package is.idega.idegaweb.egov.bpm.media;






public class ProcessUsersExporter extends DownloadWriter implements MediaWritable {

	public static final String PROCESS_INSTANCE_ID = "pr-inst-id";
	public static final String SHOW_USER_COMPANY = "show-u-c";

	@Autowired
	private BPMFactory bpmFactory;
	
	@Autowired
	private ProcessArtifacts processArtifacts;
	
	private MemoryFileBuffer memory = null;
	
	@Override
	public String getMimeType() {
		return MimeTypeUtil.MIME_TYPE_EXCEL_2;
	}

	
	@Override
	public void init(HttpServletRequest req, IWContext iwc) {
		ELUtil.getInstance().autowire(this);
		String id = iwc.getParameter(PROCESS_INSTANCE_ID);
		long processInstanceId = Long.valueOf(id);