// Path: src/java/is/idega/idegaweb/egov/citizen/data/CitizenRemoteServices.java
// public interface CitizenRemoteServices extends IDOEntity {
// 	public String getServerName();
// 	public void setServerName(String name);
// 	public String getAddress();
// 	public void setAddress(String address);
// 	public Collection<User> getUsers() throws IDORelationshipException;
// 	public void addUser(User user)  throws IDORelationshipException;
// 	public void removeUser(User user)throws IDORelationshipException;
// }
// 
// Path: src/java/is/idega/idegaweb/egov/citizen/data/CitizenRemoteServicesHome.java
// public interface CitizenRemoteServicesHome extends IDOHome {
// 	public Collection<CitizenRemoteServices> getRemoteServicesByNames(Collection <String> names);
// 	public Collection<CitizenRemoteServices> getRemoteServices(int maxAmount);
// 	public Collection<CitizenRemoteServices> getRemoteServicesByUserId(String userId) throws IDORelationshipException ;
// }


import is.idega.idegaweb.egov.citizen.data.CitizenRemoteServices;
import is.idega.idegaweb.egov.citizen.data.CitizenRemoteServicesHome;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.CreateException;
import com.idega.builder.bean.AdvancedProperty;
import com.idega.core.contact.data.ContactPurpose;
import com.idega.core.contact.data.ContactPurposeHome;
import com.idega.data.IDOLookup;
import com.idega.data.IDOLookupException;
import com.idega.idegaweb.IWBundle;
import com.idega.idegaweb.IWBundleStartable;
import com.idega.util.ListUtil;
/*
 * $Id$
 * Created on Oct 30, 2005
 *
 * Copyright (C) 2005 Idega Software hf. All Rights Reserved.
 *
 * This software is the proprietary information of Idega hf.
 * Use is subject to license terms.
 */
package is.idega.idegaweb.egov.citizen;





public class IWBundleStarter implements IWBundleStartable {

	public final static String IW_BUNDLE_IDENTIFIER = "is.idega.idegaweb.egov.citizen";
	
	@Override
	public void start(IWBundle starterBundle) {
		addDefaultRemoteServices(starterBundle);
		try{
			addDefaultContactPurposes();
		}catch(Exception e){
			Logger.getLogger(IWBundleStarter.class.getName()).log(Level.WARNING, "failed adding default contact purposes for ehub", e);
		}
	}

	@Override
	public void stop(IWBundle starterBundle) {
	}
	
	private void addDefaultContactPurposes() throws CreateException, IDOLookupException{
		ContactPurposeHome contactPurposeHome = (ContactPurposeHome) IDOLookup.getHome(ContactPurpose.class);
// Path: src/java/is/idega/idegaweb/egov/citizen/data/CitizenRemoteServices.java
// public interface CitizenRemoteServices extends IDOEntity {
// 	public String getServerName();
// 	public void setServerName(String name);
// 	public String getAddress();
// 	public void setAddress(String address);
// 	public Collection<User> getUsers() throws IDORelationshipException;
// 	public void addUser(User user)  throws IDORelationshipException;
// 	public void removeUser(User user)throws IDORelationshipException;
// }
// 
// Path: src/java/is/idega/idegaweb/egov/citizen/data/CitizenRemoteServicesHome.java
// public interface CitizenRemoteServicesHome extends IDOHome {
// 	public Collection<CitizenRemoteServices> getRemoteServicesByNames(Collection <String> names);
// 	public Collection<CitizenRemoteServices> getRemoteServices(int maxAmount);
// 	public Collection<CitizenRemoteServices> getRemoteServicesByUserId(String userId) throws IDORelationshipException ;
// }


// Path: src/java/is/idega/idegaweb/egov/citizen/IWBundleStarter.java
import is.idega.idegaweb.egov.citizen.data.CitizenRemoteServices;
import is.idega.idegaweb.egov.citizen.data.CitizenRemoteServicesHome;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.CreateException;
import com.idega.builder.bean.AdvancedProperty;
import com.idega.core.contact.data.ContactPurpose;
import com.idega.core.contact.data.ContactPurposeHome;
import com.idega.data.IDOLookup;
import com.idega.data.IDOLookupException;
import com.idega.idegaweb.IWBundle;
import com.idega.idegaweb.IWBundleStartable;
import com.idega.util.ListUtil;

/*
 * $Id$
 * Created on Oct 30, 2005
 *
 * Copyright (C) 2005 Idega Software hf. All Rights Reserved.
 *
 * This software is the proprietary information of Idega hf.
 * Use is subject to license terms.
 */
package is.idega.idegaweb.egov.citizen;





public class IWBundleStarter implements IWBundleStartable {

	public final static String IW_BUNDLE_IDENTIFIER = "is.idega.idegaweb.egov.citizen";
	
	@Override
	public void start(IWBundle starterBundle) {
		addDefaultRemoteServices(starterBundle);
		try{
			addDefaultContactPurposes();
		}catch(Exception e){
			Logger.getLogger(IWBundleStarter.class.getName()).log(Level.WARNING, "failed adding default contact purposes for ehub", e);
		}
	}

	@Override
	public void stop(IWBundle starterBundle) {
	}
	
	private void addDefaultContactPurposes() throws CreateException, IDOLookupException{
		ContactPurposeHome contactPurposeHome = (ContactPurposeHome) IDOLookup.getHome(ContactPurpose.class);
		Collection<ContactPurpose> contacts = contactPurposeHome.getContactPurposes(1);