예제 #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);
  }
  protected Account toUnwrappedModel(Account account) {
    if (account instanceof AccountImpl) {
      return account;
    }

    AccountImpl accountImpl = new AccountImpl();

    accountImpl.setNew(account.isNew());
    accountImpl.setPrimaryKey(account.getPrimaryKey());

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

    return accountImpl;
  }
예제 #3
0
  @Override
  public String getDescriptiveName(Locale locale) throws PortalException {
    Group curGroup = this;

    String name = getName(locale);

    if (Validator.isNull(name)) {
      Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(getGroupId());

      name = getName(siteDefaultLocale);
    }

    if (isCompany() && !isCompanyStagingGroup()) {
      name = LanguageUtil.get(locale, "global");
    } else if (isControlPanel()) {
      name = LanguageUtil.get(locale, "control-panel");
    } else if (isGuest()) {
      Company company = CompanyLocalServiceUtil.getCompany(getCompanyId());

      Account account = company.getAccount();

      name = account.getName();
    } else if (isLayout()) {
      Layout layout = LayoutLocalServiceUtil.getLayout(getClassPK());

      name = layout.getName(locale);
    } else if (isLayoutPrototype()) {
      LayoutPrototype layoutPrototype =
          LayoutPrototypeLocalServiceUtil.getLayoutPrototype(getClassPK());

      name = layoutPrototype.getName(locale);
    } else if (isLayoutSetPrototype()) {
      LayoutSetPrototype layoutSetPrototype =
          LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(getClassPK());

      name = layoutSetPrototype.getName(locale);
    } else if (isOrganization()) {
      long organizationId = getOrganizationId();

      Organization organization = OrganizationLocalServiceUtil.getOrganization(organizationId);

      name = organization.getName();

      curGroup = organization.getGroup();
    } else if (isUser()) {
      long userId = getClassPK();

      User user = UserLocalServiceUtil.getUser(userId);

      name = user.getFullName();
    } else if (isUserGroup()) {
      long userGroupId = getClassPK();

      UserGroup userGroup = UserGroupLocalServiceUtil.getUserGroup(userGroupId);

      name = userGroup.getName();
    } else if (isUserPersonalSite()) {
      name = LanguageUtil.get(locale, "user-personal-site");
    }

    if (curGroup.isStaged() && !curGroup.isStagedRemotely() && curGroup.isStagingGroup()) {

      Group liveGroup = getLiveGroup();

      name = liveGroup.getDescriptiveName(locale);
    }

    return name;
  }