// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java
// public class CaseArg {
// 	
// 	private GeneralCase gcase;
// 	private Status status;
// 	
// 	public GeneralCase getGcase() {
// 		return gcase;
// 	}
// 	public void setGcase(GeneralCase gcase) {
// 		this.gcase = gcase;
// 	}
// 	public Status getStatus() {
// 		return status;
// 	}
// 	public void setStatus(Status status) {
// 		this.status = status;
// 	}
// }
// 
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java
// public class Status {
// 	
// 	public static final int success 				= 0;
// 	public static final int unknown_fail 			= 1;
// 	public static final int no_customer 			= 2;
// 	public static final int no_projects 			= 3;
// 	public static final int failed_to_save 			= 6;
// 	
// 	/*
// 	 * "1" = Error with getting a support document. A more detailed error message comes within "errorText"
// 		"2" =  errorText = "Error: User does not have access to use this webservice"
// 		"3" = errorText = "Error: Database was not found on "| + strServer + | " - " |  + strPath +|"|
// 		"6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + "   -   " + Error  (A more detailed explanation comes why saving was not successful)
// 		"0" = OK, no errorText sent with
// 		"100" = errorText = "Error  " + Cstr(Err) + "   -   " + Error   (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) 
// 	 */
// 	
// 	private int status = -1;
// 	
// 	public Status(int status) {
// 		
// 		if(status < 0 || (status > 3 && status != 6))
// 			throw new RuntimeException("Value not supported: "+status);
// 		
// 		this.status = status;
// 	}
// 	
// 	public Integer getStatus() {
// 		
// 		return new Integer(status);
// 	}
// }


import is.idega.idegaweb.egov.cases.data.GeneralCase;
import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg;
import is.idega.idegaweb.egov.cases.focal.business.beans.Status;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import com.idega.business.IBOServiceBean;
import com.idega.data.IDOStoreException;
import com.idega.transaction.IdegaTransactionManager;
package is.idega.idegaweb.egov.cases.focal.business;





/**
 * 
 * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $
 * 
 * @author <a href="civilis@idega.com">Vytautas Čivilis</a>
 * @version $Revision: 1.2 $
 */
public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement {

	private static final long serialVersionUID = -4409596745472629280L;
	private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName());

	/**
	 * @see ExportCasesManagement method description
	 * 
	 */
	public void updateCasesExternalId(String project_id, List cases) {
	
		TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class);
		
		boolean transaction_started = false;
		
		try {
			tm.begin();
			transaction_started = true;
			
		} catch (Exception e) {
			logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e);
		}
		
		for (Iterator iter = cases.iterator(); iter.hasNext();) {
			
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java
// public class CaseArg {
// 	
// 	private GeneralCase gcase;
// 	private Status status;
// 	
// 	public GeneralCase getGcase() {
// 		return gcase;
// 	}
// 	public void setGcase(GeneralCase gcase) {
// 		this.gcase = gcase;
// 	}
// 	public Status getStatus() {
// 		return status;
// 	}
// 	public void setStatus(Status status) {
// 		this.status = status;
// 	}
// }
// 
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java
// public class Status {
// 	
// 	public static final int success 				= 0;
// 	public static final int unknown_fail 			= 1;
// 	public static final int no_customer 			= 2;
// 	public static final int no_projects 			= 3;
// 	public static final int failed_to_save 			= 6;
// 	
// 	/*
// 	 * "1" = Error with getting a support document. A more detailed error message comes within "errorText"
// 		"2" =  errorText = "Error: User does not have access to use this webservice"
// 		"3" = errorText = "Error: Database was not found on "| + strServer + | " - " |  + strPath +|"|
// 		"6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + "   -   " + Error  (A more detailed explanation comes why saving was not successful)
// 		"0" = OK, no errorText sent with
// 		"100" = errorText = "Error  " + Cstr(Err) + "   -   " + Error   (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) 
// 	 */
// 	
// 	private int status = -1;
// 	
// 	public Status(int status) {
// 		
// 		if(status < 0 || (status > 3 && status != 6))
// 			throw new RuntimeException("Value not supported: "+status);
// 		
// 		this.status = status;
// 	}
// 	
// 	public Integer getStatus() {
// 		
// 		return new Integer(status);
// 	}
// }


// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/ExportCasesManagementBean.java
import is.idega.idegaweb.egov.cases.data.GeneralCase;
import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg;
import is.idega.idegaweb.egov.cases.focal.business.beans.Status;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import com.idega.business.IBOServiceBean;
import com.idega.data.IDOStoreException;
import com.idega.transaction.IdegaTransactionManager;

package is.idega.idegaweb.egov.cases.focal.business;





/**
 * 
 * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $
 * 
 * @author <a href="civilis@idega.com">Vytautas Čivilis</a>
 * @version $Revision: 1.2 $
 */
public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement {

	private static final long serialVersionUID = -4409596745472629280L;
	private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName());

	/**
	 * @see ExportCasesManagement method description
	 * 
	 */
	public void updateCasesExternalId(String project_id, List cases) {
	
		TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class);
		
		boolean transaction_started = false;
		
		try {
			tm.begin();
			transaction_started = true;
			
		} catch (Exception e) {
			logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e);
		}
		
		for (Iterator iter = cases.iterator(); iter.hasNext();) {
			
			CaseArg case_arg = (CaseArg) iter.next();