public void checkCompany(String companyId)
throws PortalException, SystemException {
// Company
Company company = null;
try {
company = CompanyUtil.findByPrimaryKey(companyId);
}
catch (NoSuchCompanyException nsce) {
company = CompanyUtil.create(companyId);
company.setPortalURL("localhost");
company.setHomeURL("localhost");
company.setMx(companyId);
company.setName(companyId);
company.setShortName(companyId);
company.setType("biz");
company.setEmailAddress("test@" + companyId);
company.setAuthType(Company.AUTH_TYPE_EA);
company.setAutoLogin(true);
company.setStrangers(true);
CompanyUtil.update(company);
}
// Key
checkCompanyKey(companyId);
// Groups
// GroupLocalManagerUtil.checkSystemGroups(companyId);
// Roles
// RoleLocalManagerUtil.checkSystemRoles(companyId);
// Default admin
User defaultUser = createDefaultUser(company);
if (countUsers(companyId) == 0) {
Date now = new Date();
User user = UserLocalManagerUtil.addUser(
companyId, true, StringPool.BLANK, false, "test", "test", false,
"Test", StringPool.BLANK, "Test", StringPool.BLANK, true, now,
"test@" + company.getMx(), defaultUser.getLocale());
Role adminRole;
try {
adminRole = APILocator.getRoleAPI().loadRoleByKey("Administrator");
} catch (DotDataException e) {