// Path: src/java/is/idega/idegaweb/egov/company/business/CompanyPortalBusiness.java
// public interface CompanyPortalBusiness {
// 
// 	public String SPRING_BEAN_IDENTIFIER = "companyPortalBusiness";
// 
// 	public Group getCompanyPortalRootGroup(IWApplicationContext iwac) throws RemoteException;
// 
// 	public Group getAllCompaniesAdminsGroup(IWApplicationContext iwac);
// 
// 	public Group getCompanyAdminsGroup(IWApplicationContext iwac, String companyName, String personalID);
// 	public Group getCompanyStaffGroup(IWApplicationContext iwac, String companyName, String personalID);
// 
// 	public Group getCompanySuperAdminsGroup(IWApplicationContext iwac);
// 
// 	public Group getGroupByName(Group parentGroup, String name, String personalID);
// 	public Group getChildGroupByType(Group group, String type);
// 	public List<Group> getAllChildGroupsByType(Group group, String type);
// 
// 	public Group createCompanyGroup(IWApplicationContext iwac, String companyName, String personalID);
// 	public Group createCompanyGroup(IWApplicationContext iwac, Group companyPortal, String companyName, String personalID);
// 
// 	public Group getCompanyGroup(IWApplicationContext iwac, String companyName, String personalID);
// 
// 	public List<Group> getAllUserCompanies(User user);
// 	public Company getCompanyForUser(User user);
// 
// 	public Group getCompanyGroupByUser(User user);
// 	public Group getCompanyStaffGroupByUser(User user);
// 	public Group getCompanyAdminsGroupByUser(User user);
// 
// 	public void setHomePage(IWApplicationContext iwac, Group group, String homePageKey);
// 	public void setHomePageToGroups(IWApplicationContext iwac);
// 
// 	public List<User> getAllCompanyUsers(Group company);
// 	public List<User> getAllCompanyUsers(CompanyApplication application);
// 
// 	public List<Group> getAllCompanyGroups(Group company);
// 
// 	public boolean isMemberOfCompany(IWApplicationContext iwac, Group group, User user);
// 
// 	public Company getCompanyByPersonalIdOrUserId(String personalId);
// }


import is.idega.idegaweb.egov.EGOVConstants;
import is.idega.idegaweb.egov.company.business.CompanyPortalBusiness;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import com.idega.builder.business.BuilderLogic;
import com.idega.business.IBOLookup;
import com.idega.business.IBOLookupException;
import com.idega.core.accesscontrol.business.AccessController;
import com.idega.core.accesscontrol.business.StandardRoles;
import com.idega.idegaweb.IWApplicationContext;
import com.idega.idegaweb.IWBundle;
import com.idega.idegaweb.IWBundleStartable;
import com.idega.servlet.filter.IWBundleResourceFilter;
import com.idega.user.business.GroupBusiness;
import com.idega.user.data.Group;
import com.idega.user.data.GroupType;
import com.idega.util.ListUtil;
import com.idega.util.expression.ELUtil;
		Group companyPortal = null;
		try {
			companyPortal = createRootGroup(iwac, groupBusiness);
		} catch(RemoteException e) {
			e.printStackTrace();
		}
		if (companyPortal == null) {
			return;
		}

		try {
			createAdminsGroup(iwac, groupBusiness, companyPortal);
		} catch (RemoteException e) {
			e.printStackTrace();
		}

		try {
			createSuperAdminsGroup(iwac, groupBusiness, companyPortal);
		} catch (RemoteException e) {
			e.printStackTrace();
		}

		setRoleToCommuneAcceptedCitizensGroup(iwac, groupBusiness);

		setHomePageToGroups(iwac);

		IWBundleResourceFilter.copyAllFilesFromJarDirectory(starterBundle.getApplication(), starterBundle, "/resources/");
	}

	private void setHomePageToGroups(IWApplicationContext iwac) {
// Path: src/java/is/idega/idegaweb/egov/company/business/CompanyPortalBusiness.java
// public interface CompanyPortalBusiness {
// 
// 	public String SPRING_BEAN_IDENTIFIER = "companyPortalBusiness";
// 
// 	public Group getCompanyPortalRootGroup(IWApplicationContext iwac) throws RemoteException;
// 
// 	public Group getAllCompaniesAdminsGroup(IWApplicationContext iwac);
// 
// 	public Group getCompanyAdminsGroup(IWApplicationContext iwac, String companyName, String personalID);
// 	public Group getCompanyStaffGroup(IWApplicationContext iwac, String companyName, String personalID);
// 
// 	public Group getCompanySuperAdminsGroup(IWApplicationContext iwac);
// 
// 	public Group getGroupByName(Group parentGroup, String name, String personalID);
// 	public Group getChildGroupByType(Group group, String type);
// 	public List<Group> getAllChildGroupsByType(Group group, String type);
// 
// 	public Group createCompanyGroup(IWApplicationContext iwac, String companyName, String personalID);
// 	public Group createCompanyGroup(IWApplicationContext iwac, Group companyPortal, String companyName, String personalID);
// 
// 	public Group getCompanyGroup(IWApplicationContext iwac, String companyName, String personalID);
// 
// 	public List<Group> getAllUserCompanies(User user);
// 	public Company getCompanyForUser(User user);
// 
// 	public Group getCompanyGroupByUser(User user);
// 	public Group getCompanyStaffGroupByUser(User user);
// 	public Group getCompanyAdminsGroupByUser(User user);
// 
// 	public void setHomePage(IWApplicationContext iwac, Group group, String homePageKey);
// 	public void setHomePageToGroups(IWApplicationContext iwac);
// 
// 	public List<User> getAllCompanyUsers(Group company);
// 	public List<User> getAllCompanyUsers(CompanyApplication application);
// 
// 	public List<Group> getAllCompanyGroups(Group company);
// 
// 	public boolean isMemberOfCompany(IWApplicationContext iwac, Group group, User user);
// 
// 	public Company getCompanyByPersonalIdOrUserId(String personalId);
// }


// Path: src/java/is/idega/idegaweb/egov/company/IWBundleStarter.java
import is.idega.idegaweb.egov.EGOVConstants;
import is.idega.idegaweb.egov.company.business.CompanyPortalBusiness;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import com.idega.builder.business.BuilderLogic;
import com.idega.business.IBOLookup;
import com.idega.business.IBOLookupException;
import com.idega.core.accesscontrol.business.AccessController;
import com.idega.core.accesscontrol.business.StandardRoles;
import com.idega.idegaweb.IWApplicationContext;
import com.idega.idegaweb.IWBundle;
import com.idega.idegaweb.IWBundleStartable;
import com.idega.servlet.filter.IWBundleResourceFilter;
import com.idega.user.business.GroupBusiness;
import com.idega.user.data.Group;
import com.idega.user.data.GroupType;
import com.idega.util.ListUtil;
import com.idega.util.expression.ELUtil;

		Group companyPortal = null;
		try {
			companyPortal = createRootGroup(iwac, groupBusiness);
		} catch(RemoteException e) {
			e.printStackTrace();
		}
		if (companyPortal == null) {
			return;
		}

		try {
			createAdminsGroup(iwac, groupBusiness, companyPortal);
		} catch (RemoteException e) {
			e.printStackTrace();
		}

		try {
			createSuperAdminsGroup(iwac, groupBusiness, companyPortal);
		} catch (RemoteException e) {
			e.printStackTrace();
		}

		setRoleToCommuneAcceptedCitizensGroup(iwac, groupBusiness);

		setHomePageToGroups(iwac);

		IWBundleResourceFilter.copyAllFilesFromJarDirectory(starterBundle.getApplication(), starterBundle, "/resources/");
	}

	private void setHomePageToGroups(IWApplicationContext iwac) {
		CompanyPortalBusiness companyPortalBusiness = ELUtil.getInstance().getBean(CompanyPortalBusiness.SPRING_BEAN_IDENTIFIER);