Exemplo n.º 1
0
  private static void _updateCompany(HttpServletRequest request) throws Exception {

    Company company = CompanyLocalServiceUtil.getCompanyById(PortalInstances.getDefaultCompanyId());

    Account account = company.getAccount();

    String currentName = account.getName();

    String newName = ParamUtil.getString(request, "companyName", PropsValues.COMPANY_DEFAULT_NAME);

    if (!currentName.equals(newName)) {
      account.setName(newName);

      AccountLocalServiceUtil.updateAccount(account);
    }

    String languageId =
        ParamUtil.getString(request, "companyLocale", PropsValues.COMPANY_DEFAULT_LOCALE);

    User defaultUser = company.getDefaultUser();

    defaultUser.setLanguageId(languageId);

    UserLocalServiceUtil.updateUser(defaultUser);

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    themeDisplay.setCompany(company);
  }
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static Account toModel(AccountSoap soapModel) {
    Account model = new AccountImpl();

    model.setAccountId(soapModel.getAccountId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setParentAccountId(soapModel.getParentAccountId());
    model.setName(soapModel.getName());
    model.setLegalName(soapModel.getLegalName());
    model.setLegalId(soapModel.getLegalId());
    model.setLegalType(soapModel.getLegalType());
    model.setSicCode(soapModel.getSicCode());
    model.setTickerSymbol(soapModel.getTickerSymbol());
    model.setIndustry(soapModel.getIndustry());
    model.setType(soapModel.getType());
    model.setSize(soapModel.getSize());

    return model;
  }