public static void updateSetup(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    UnicodeProperties unicodeProperties =
        PropertiesParamUtil.getProperties(request, _PROPERTIES_PREFIX);

    unicodeProperties.setProperty(
        PropsKeys.LIFERAY_HOME, SystemProperties.get(PropsKeys.LIFERAY_HOME));

    boolean databaseConfigured = _isDatabaseConfigured(unicodeProperties);

    _processDatabaseProperties(request, unicodeProperties, databaseConfigured);

    updateLanguage(request, response);

    unicodeProperties.put(PropsKeys.SETUP_WIZARD_ENABLED, String.valueOf(false));

    PropsUtil.addProperties(unicodeProperties);

    if (!databaseConfigured) {
      _reloadServletContext(request, unicodeProperties);
    }

    _updateCompany(request);
    _updateAdminUser(request, unicodeProperties);

    _initPlugins();

    boolean propertiesFileCreated = _writePropertiesFile(unicodeProperties);

    HttpSession session = request.getSession();

    session.setAttribute(WebKeys.SETUP_WIZARD_PROPERTIES, unicodeProperties);
    session.setAttribute(WebKeys.SETUP_WIZARD_PROPERTIES_FILE_CREATED, propertiesFileCreated);
  }
  @Override
  public void removeNestedColumns(String portletNamespace) {
    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();

    UnicodeProperties newTypeSettingsProperties = new UnicodeProperties();

    for (Map.Entry<String, String> entry : typeSettingsProperties.entrySet()) {

      String key = entry.getKey();

      if (!key.startsWith(portletNamespace)) {
        newTypeSettingsProperties.setProperty(key, entry.getValue());
      }
    }

    Layout layout = getLayout();

    layout.setTypeSettingsProperties(newTypeSettingsProperties);

    String nestedColumnIds =
        GetterUtil.getString(getTypeSettingsProperty(LayoutTypePortletConstants.NESTED_COLUMN_IDS));

    String[] nestedColumnIdsArray =
        ArrayUtil.removeByPrefix(StringUtil.split(nestedColumnIds), portletNamespace);

    setTypeSettingsProperty(
        LayoutTypePortletConstants.NESTED_COLUMN_IDS, StringUtil.merge(nestedColumnIdsArray));
  }
  protected void fixImportTypeSettings(Layout layout) throws Exception {
    Object[] friendlyURLInfo = extractFriendlyURLInfo(layout);

    if (friendlyURLInfo == null) {
      return;
    }

    String friendlyURL = (String) friendlyURLInfo[0];

    if (!friendlyURL.equals(_SAME_GROUP_FRIENDLY_URL)) {
      return;
    }

    Group group = layout.getGroup();

    UnicodeProperties typeSettings = layout.getTypeSettingsProperties();

    String url = (String) friendlyURLInfo[1];

    int x = (Integer) friendlyURLInfo[2];
    int y = (Integer) friendlyURLInfo[3];

    typeSettings.setProperty(
        "url", url.substring(0, x) + group.getFriendlyURL() + url.substring(y));
  }
  public void updateConfiguration(ActionRequest actionRequest, ActionResponse actionResponse)
      throws IOException, PortletException {

    try {
      ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

      long scopeGroupId = serviceContext.getScopeGroupId();

      Group scopeGroup = GroupLocalServiceUtil.getGroup(scopeGroupId);

      if (scopeGroup.isStagingGroup()) {
        scopeGroup = scopeGroup.getLiveGroup();
      }

      UnicodeProperties typeSettingsProperties = scopeGroup.getTypeSettingsProperties();

      UnicodeProperties properties = PropertiesParamUtil.getProperties(actionRequest, "settings--");

      typeSettingsProperties.putAll(properties);

      GroupServiceUtil.updateGroup(scopeGroup.getGroupId(), scopeGroup.getTypeSettings());
    } catch (Exception e) {
      SessionErrors.add(actionRequest, e.getClass().getName());
    }
  }
  protected void verifyLDAPProperties() throws Exception {
    long[] companyIds = PortalInstances.getCompanyIdsBySQL();

    for (long companyId : companyIds) {
      UnicodeProperties properties = new UnicodeProperties();

      long[] ldapServerIds =
          StringUtil.split(PrefsPropsUtil.getString(companyId, "ldap.server.ids"), 0L);

      for (long ldapServerId : ldapServerIds) {
        String postfix = LDAPSettingsUtil.getPropertyPostfix(ldapServerId);

        for (String key : _LDAP_KEYS) {
          String value = PrefsPropsUtil.getString(companyId, key + postfix, null);

          if (value == null) {
            properties.put(key + postfix, StringPool.BLANK);
          }
        }
      }

      if (!properties.isEmpty()) {
        CompanyLocalServiceUtil.updatePreferences(companyId, properties);
      }
    }
  }
  private LayoutTypePortlet _getLayoutTypePortletClone(HttpServletRequest request)
      throws IOException {

    LayoutTypePortlet layoutTypePortlet = null;

    LayoutClone layoutClone = LayoutCloneFactory.getInstance();

    if (layoutClone != null) {
      String typeSettings = layoutClone.get(request, getPlid());

      if (typeSettings != null) {
        UnicodeProperties typeSettingsProperties = new UnicodeProperties(true);

        typeSettingsProperties.load(typeSettings);

        String stateMax = typeSettingsProperties.getProperty(LayoutTypePortletConstants.STATE_MAX);
        String stateMin = typeSettingsProperties.getProperty(LayoutTypePortletConstants.STATE_MIN);

        Layout layout = (Layout) this.clone();

        layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();

        layoutTypePortlet.setStateMax(stateMax);
        layoutTypePortlet.setStateMin(stateMin);
      }
    }

    if (layoutTypePortlet == null) {
      layoutTypePortlet = (LayoutTypePortlet) getLayoutType();
    }

    return layoutTypePortlet;
  }
  protected void deleteLDAPServer(ActionRequest actionRequest) throws Exception {

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

    long ldapServerId = ParamUtil.getLong(actionRequest, "ldapServerId");

    // Remove preferences

    String postfix = LDAPSettingsUtil.getPropertyPostfix(ldapServerId);

    String[] keys = new String[_KEYS.length];

    for (int i = 0; i < _KEYS.length; i++) {
      keys[i] = _KEYS[i] + postfix;
    }

    CompanyServiceUtil.removePreferences(themeDisplay.getCompanyId(), keys);

    // Update preferences

    PortletPreferences preferences = PrefsPropsUtil.getPreferences(themeDisplay.getCompanyId());

    UnicodeProperties properties = new UnicodeProperties();

    String ldapServerIds = preferences.getValue("ldap.server.ids", StringPool.BLANK);

    ldapServerIds = StringUtil.remove(ldapServerIds, String.valueOf(ldapServerId));

    properties.put("ldap.server.ids", ldapServerIds);

    CompanyServiceUtil.updatePreferences(themeDisplay.getCompanyId(), properties);
  }
  public void applyAction(
      MDRAction mdrAction, HttpServletRequest request, HttpServletResponse response) {

    long companyId = PortalUtil.getCompanyId(request);

    UnicodeProperties typeSettingsProperties = mdrAction.getTypeSettingsProperties();

    String themeId = GetterUtil.getString(typeSettingsProperties.getProperty("themeId"));

    Theme theme = _themeLocalService.fetchTheme(companyId, themeId);

    if (theme == null) {
      return;
    }

    request.setAttribute(WebKeys.THEME, theme);

    String colorSchemeId =
        GetterUtil.getString(typeSettingsProperties.getProperty("colorSchemeId"));

    ColorScheme colorScheme =
        _themeLocalService.fetchColorScheme(companyId, themeId, colorSchemeId);

    if (colorScheme == null) {
      colorScheme = ColorSchemeImpl.getNullColorScheme();
    }

    request.setAttribute(WebKeys.COLOR_SCHEME, colorScheme);

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

    String contextPath = PortalUtil.getPathContext();

    themeDisplay.setLookAndFeel(contextPath, theme, colorScheme);
  }
  public static void checkRepository(
      long repositoryId,
      Map<String, String> parameters,
      UnicodeProperties typeSettingsProperties,
      String typeSettingsKey)
      throws PortalException, RepositoryException {

    if (!typeSettingsProperties.containsKey(typeSettingsKey)) {
      org.apache.chemistry.opencmis.client.api.Repository cmisRepository =
          _sessionFactory.getRepositories(parameters).get(0);

      typeSettingsProperties.setProperty(typeSettingsKey, cmisRepository.getId());

      try {
        Repository repository = RepositoryUtil.findByPrimaryKey(repositoryId);

        repository.setTypeSettingsProperties(typeSettingsProperties);

        RepositoryUtil.update(repository, false);
      } catch (Exception e) {
        throw new RepositoryException(e);
      }
    }

    parameters.put(
        SessionParameter.REPOSITORY_ID,
        getTypeSettingsValue(typeSettingsProperties, typeSettingsKey));
  }
  protected void exportJournalArticle(
      PortletDataContext portletDataContext, Layout layout, Element layoutElement)
      throws Exception {

    UnicodeProperties typeSettingsProperties = layout.getTypeSettingsProperties();

    String articleId = typeSettingsProperties.getProperty("article-id", StringPool.BLANK);

    long articleGroupId = layout.getGroupId();

    if (Validator.isNull(articleId)) {
      if (_log.isWarnEnabled()) {
        _log.warn("No article id found in typeSettings of layout " + layout.getPlid());
      }
    }

    JournalArticle article = null;

    try {
      article =
          JournalArticleLocalServiceUtil.getLatestArticle(
              articleGroupId, articleId, WorkflowConstants.STATUS_APPROVED);
    } catch (NoSuchArticleException nsae) {
      if (_log.isWarnEnabled()) {
        _log.warn(
            "No approved article found with group id "
                + articleGroupId
                + " and article id "
                + articleId);
      }
    }

    if (article == null) {
      return;
    }

    String path = JournalPortletDataHandlerImpl.getArticlePath(portletDataContext, article);

    Element articleElement = layoutElement.addElement("article");

    articleElement.addAttribute("path", path);

    Element dlFileEntryTypesElement = layoutElement.addElement("dl-file-entry-types");
    Element dlFoldersElement = layoutElement.addElement("dl-folders");
    Element dlFilesElement = layoutElement.addElement("dl-file-entries");
    Element dlFileRanksElement = layoutElement.addElement("dl-file-ranks");

    JournalPortletDataHandlerImpl.exportArticle(
        portletDataContext,
        layoutElement,
        layoutElement,
        layoutElement,
        dlFileEntryTypesElement,
        dlFoldersElement,
        dlFilesElement,
        dlFileRanksElement,
        article,
        false);
  }
  @Override
  protected String getURL(
      MDRAction mdrAction, HttpServletRequest request, HttpServletResponse response) {

    UnicodeProperties typeSettingsProperties = mdrAction.getTypeSettingsProperties();

    return GetterUtil.getString(typeSettingsProperties.getProperty("url"));
  }
  public String getSourcePrototypeLayoutProperty(String key) {
    if (_sourcePrototypeLayout == null) {
      return StringPool.BLANK;
    }

    UnicodeProperties typeSettingsProperties = _sourcePrototypeLayout.getTypeSettingsProperties();

    return typeSettingsProperties.getProperty(key);
  }
  @Override
  public Group disableTrash(Group group) {
    UnicodeProperties typeSettingsProperties = group.getParentLiveGroupTypeSettingsProperties();

    typeSettingsProperties.setProperty("trashEnabled", StringPool.FALSE);

    group.setTypeSettingsProperties(typeSettingsProperties);

    return GroupLocalServiceUtil.updateGroup(group);
  }
  @Test
  public void testVerifyWhenUpdatingGroupTypeSettings() throws Exception {
    Group group = MembershipPolicyTestUtil.addGroup();

    UnicodeProperties unicodeProperties = RandomTestUtil.randomUnicodeProperties(10, 2, 2);

    GroupServiceUtil.updateGroup(group.getGroupId(), unicodeProperties.toString());

    Assert.assertTrue(isVerify());
  }
  protected boolean isCacheableData(long companyId, HttpServletRequest request) {

    try {
      if (_pattern == _PATTERN_RESOURCE) {
        return true;
      }

      long plid =
          getPlid(
              companyId,
              request.getPathInfo(),
              request.getServletPath(),
              ParamUtil.getLong(request, "p_l_id"));

      if (plid <= 0) {
        return false;
      }

      Layout layout = LayoutLocalServiceUtil.getLayout(plid);

      if (!layout.isTypePortlet()) {
        return false;
      }

      UnicodeProperties properties = layout.getTypeSettingsProperties();

      for (int i = 0; i < 10; i++) {
        String columnId = "column-" + i;

        String settings = properties.getProperty(columnId, StringPool.BLANK);

        if (!isCacheableColumn(companyId, settings)) {
          return false;
        }
      }

      String columnIdsString = properties.get(LayoutTypePortletConstants.NESTED_COLUMN_IDS);

      if (columnIdsString != null) {
        String[] columnIds = StringUtil.split(columnIdsString);

        for (String columnId : columnIds) {
          String settings = properties.getProperty(columnId, StringPool.BLANK);

          if (!isCacheableColumn(companyId, settings)) {
            return false;
          }
        }
      }

      return true;
    } catch (Exception e) {
      return false;
    }
  }
  protected void updateLayoutSetPrototype(long groupId, boolean privateLayout)
      throws PortalException {

    // Layout

    LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(groupId, privateLayout);

    LayoutSetPrototype layoutSetPrototype =
        LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(
            layoutSet.getLayoutSetPrototypeId());

    Group layoutSetPrototypeGroup = layoutSetPrototype.getGroup();

    List<Layout> layoutSetPrototypeLayouts =
        LayoutLocalServiceUtil.getLayouts(layoutSetPrototypeGroup.getGroupId(), true);

    String[] layoutSetPrototypeLayoutUuids = new String[layoutSetPrototypeLayouts.size()];

    for (int i = 0; i < layoutSetPrototypeLayouts.size(); i++) {
      Layout layout = layoutSetPrototypeLayouts.get(i);

      layoutSetPrototypeLayoutUuids[i] = layout.getUuid();
    }

    List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout);

    for (Layout layout : layouts) {
      if (ArrayUtil.contains(
          layoutSetPrototypeLayoutUuids, layout.getSourcePrototypeLayoutUuid())) {

        layout.setLayoutPrototypeUuid(StringPool.BLANK);
        layout.setLayoutPrototypeLinkEnabled(false);
        layout.setSourcePrototypeLayoutUuid(StringPool.BLANK);

        LayoutLocalServiceUtil.updateLayout(layout);
      }
    }

    // Layout set

    UnicodeProperties settingsProperties = layoutSet.getSettingsProperties();

    settingsProperties.remove("last-merge-time");

    layoutSet.setSettingsProperties(settingsProperties);

    layoutSet.setLayoutSetPrototypeUuid(StringPool.BLANK);
    layoutSet.setLayoutSetPrototypeLinkEnabled(false);

    LayoutSetLocalServiceUtil.updateLayoutSet(layoutSet);

    LayoutSetLocalServiceUtil.updateLookAndFeel(
        layoutSet.getGroupId(), null, null, StringPool.BLANK, false);
  }
  public boolean isStagedPortlet(String portletId) {
    try {
      if (isLayout()) {
        Group parentGroup = GroupLocalServiceUtil.getGroup(getParentGroupId());

        return parentGroup.isStagedPortlet(portletId);
      }
    } catch (Exception e) {
    }

    portletId = PortletConstants.getRootPortletId(portletId);

    String typeSettingsProperty =
        getTypeSettingsProperty(StagingConstants.STAGED_PORTLET.concat(portletId));

    if (Validator.isNotNull(typeSettingsProperty)) {
      return GetterUtil.getBoolean(typeSettingsProperty);
    }

    try {
      Portlet portlet = PortletLocalServiceUtil.getPortletById(portletId);

      String portletDataHandlerClass = portlet.getPortletDataHandlerClass();

      if (Validator.isNull(portletDataHandlerClass)) {
        return true;
      }

      UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();

      for (Map.Entry<String, String> entry : typeSettingsProperties.entrySet()) {

        String key = entry.getKey();

        if (!key.contains(StagingConstants.STAGED_PORTLET)) {
          continue;
        }

        String stagedPortletId =
            StringUtil.replace(key, StagingConstants.STAGED_PORTLET, StringPool.BLANK);

        Portlet stagedPortlet = PortletLocalServiceUtil.getPortletById(stagedPortletId);

        if (portletDataHandlerClass.equals(stagedPortlet.getPortletDataHandlerClass())) {

          return GetterUtil.getBoolean(entry.getValue());
        }
      }
    } catch (Exception e) {
    }

    return true;
  }
  protected void updateMergePages(ActionRequest actionRequest, long liveGroupId) throws Exception {

    boolean mergeGuestPublicPages = ParamUtil.getBoolean(actionRequest, "mergeGuestPublicPages");

    Group liveGroup = groupLocalService.getGroup(liveGroupId);

    UnicodeProperties typeSettingsProperties = liveGroup.getTypeSettingsProperties();

    typeSettingsProperties.setProperty(
        "mergeGuestPublicPages", String.valueOf(mergeGuestPublicPages));

    groupService.updateGroup(liveGroupId, liveGroup.getTypeSettings());
  }
  private static void _processDatabaseProperties(
      HttpServletRequest request, UnicodeProperties unicodeProperties, boolean databaseConfigured)
      throws Exception {

    boolean defaultDatabase = ParamUtil.getBoolean(request, "defaultDatabase", true);

    if (defaultDatabase || databaseConfigured) {
      unicodeProperties.remove(PropsKeys.JDBC_DEFAULT_URL);
      unicodeProperties.remove(PropsKeys.JDBC_DEFAULT_DRIVER_CLASS_NAME);
      unicodeProperties.remove(PropsKeys.JDBC_DEFAULT_USERNAME);
      unicodeProperties.remove(PropsKeys.JDBC_DEFAULT_PASSWORD);
    }
  }
Beispiel #20
0
  @Override
  public int getMaxAge(Group group) {
    int trashEntriesMaxAge =
        PrefsPropsUtil.getInteger(
            group.getCompanyId(),
            PropsKeys.TRASH_ENTRIES_MAX_AGE,
            PropsValues.TRASH_ENTRIES_MAX_AGE);

    UnicodeProperties typeSettingsProperties = group.getParentLiveGroupTypeSettingsProperties();

    return GetterUtil.getInteger(
        typeSettingsProperties.getProperty("trashEntriesMaxAge"), trashEntriesMaxAge);
  }
Beispiel #21
0
  @Override
  public boolean isTrashEnabled(Group group) {
    boolean companyTrashEnabled =
        PrefsPropsUtil.getBoolean(group.getCompanyId(), PropsKeys.TRASH_ENABLED);

    if (!companyTrashEnabled) {
      return false;
    }

    UnicodeProperties typeSettingsProperties = group.getParentLiveGroupTypeSettingsProperties();

    return GetterUtil.getBoolean(typeSettingsProperties.getProperty("trashEnabled"), true);
  }
  @Override
  public boolean isContentDisplayPage() {
    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();

    String defaultAssetPublisherPortletId =
        typeSettingsProperties.getProperty(
            LayoutTypePortletConstants.DEFAULT_ASSET_PUBLISHER_PORTLET_ID);

    if (Validator.isNotNull(defaultAssetPublisherPortletId)) {
      return true;
    }

    return false;
  }
  @Override
  public String getThemeSetting(String key, String device, boolean inheritLookAndFeel) {

    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();

    String value =
        typeSettingsProperties.getProperty(ThemeSettingImpl.namespaceProperty(device, key));

    if (value != null) {
      return value;
    }

    return getDefaultThemeSetting(key, device, inheritLookAndFeel);
  }
  public static void updateLastPublishDate(LayoutSet layoutSet, long lastPublishDate)
      throws Exception {

    UnicodeProperties settingsProperties = layoutSet.getSettingsProperties();

    if (lastPublishDate <= 0) {
      settingsProperties.remove("last-publish-date");
    } else {
      settingsProperties.setProperty("last-publish-date", String.valueOf(lastPublishDate));
    }

    LayoutSetLocalServiceUtil.updateSettings(
        layoutSet.getGroupId(), layoutSet.isPrivateLayout(), settingsProperties.toString());
  }
Beispiel #25
0
  public boolean isTrashEnabled(long groupId) throws PortalException, SystemException {

    Group group = GroupLocalServiceUtil.getGroup(groupId);

    UnicodeProperties typeSettingsProperties = group.getParentLiveGroupTypeSettingsProperties();

    boolean companyTrashEnabled =
        PrefsPropsUtil.getBoolean(group.getCompanyId(), PropsKeys.TRASH_ENABLED);

    if (!companyTrashEnabled) {
      return false;
    }

    return GetterUtil.getBoolean(typeSettingsProperties.getProperty("trashEnabled"), true);
  }
  protected void importJournalArticle(
      PortletDataContext portletDataContext, Layout layout, Element layoutElement)
      throws Exception {

    UnicodeProperties typeSettingsProperties = layout.getTypeSettingsProperties();

    String articleId = typeSettingsProperties.getProperty("article-id", StringPool.BLANK);

    if (Validator.isNull(articleId)) {
      return;
    }

    JournalPortletDataHandlerImpl.importReferencedData(portletDataContext, layoutElement);

    Element structureElement = layoutElement.element("structure");

    if (structureElement != null) {
      JournalPortletDataHandlerImpl.importStructure(portletDataContext, structureElement);
    }

    Element templateElement = layoutElement.element("template");

    if (templateElement != null) {
      JournalPortletDataHandlerImpl.importTemplate(portletDataContext, templateElement);
    }

    Element articleElement = layoutElement.element("article");

    if (articleElement != null) {
      JournalPortletDataHandlerImpl.importArticle(portletDataContext, articleElement);
    }

    Map<String, String> articleIds =
        (Map<String, String>)
            portletDataContext.getNewPrimaryKeysMap(JournalArticle.class + ".articleId");

    articleId = MapUtil.getString(articleIds, articleId, articleId);

    typeSettingsProperties.setProperty("article-id", articleId);

    JournalContentSearchLocalServiceUtil.updateContentSearch(
        portletDataContext.getScopeGroupId(),
        layout.isPrivateLayout(),
        layout.getLayoutId(),
        StringPool.BLANK,
        articleId,
        true);
  }
  protected void setThemeSettingProperties(
      ActionRequest actionRequest,
      UnicodeProperties typeSettingsProperties,
      Map<String, ThemeSetting> themeSettings,
      String device,
      boolean isLayout)
      throws PortalException {

    Layout layout = null;

    if (isLayout) {
      long groupId = ParamUtil.getLong(actionRequest, "groupId");
      boolean privateLayout = ParamUtil.getBoolean(actionRequest, "privateLayout");
      long layoutId = ParamUtil.getLong(actionRequest, "layoutId");

      layout = layoutLocalService.getLayout(groupId, privateLayout, layoutId);
    }

    for (String key : themeSettings.keySet()) {
      ThemeSetting themeSetting = themeSettings.get(key);

      String property = device + "ThemeSettingsProperties--" + key + StringPool.DOUBLE_DASH;

      String value = ParamUtil.getString(actionRequest, property, themeSetting.getValue());

      if ((isLayout && !Validator.equals(value, layout.getDefaultThemeSetting(key, device, false)))
          || (!isLayout && !value.equals(themeSetting.getValue()))) {

        typeSettingsProperties.setProperty(ThemeSettingImpl.namespaceProperty(device, key), value);
      }
    }
  }
Beispiel #28
0
  public int getMaxAge(Group group) throws PortalException, SystemException {
    if (group.isLayout()) {
      group = group.getParentGroup();
    }

    int trashEntriesMaxAge =
        PrefsPropsUtil.getInteger(
            group.getCompanyId(),
            PropsKeys.TRASH_ENTRIES_MAX_AGE,
            GetterUtil.getInteger(PropsUtil.get(PropsKeys.TRASH_ENTRIES_MAX_AGE)));

    UnicodeProperties typeSettingsProperties = group.getTypeSettingsProperties();

    return GetterUtil.getInteger(
        typeSettingsProperties.getProperty("trashEntriesMaxAge"), trashEntriesMaxAge);
  }
  private static boolean _isDatabaseConfigured(UnicodeProperties unicodeProperties) {

    String defaultDriverClassName = unicodeProperties.get(PropsKeys.JDBC_DEFAULT_DRIVER_CLASS_NAME);
    String defaultPassword = unicodeProperties.get(PropsKeys.JDBC_DEFAULT_PASSWORD);
    String defaultURL = unicodeProperties.get(PropsKeys.JDBC_DEFAULT_URL);
    String defaultUsername = unicodeProperties.get(PropsKeys.JDBC_DEFAULT_USERNAME);

    if (PropsValues.JDBC_DEFAULT_DRIVER_CLASS_NAME.equals(defaultDriverClassName)
        && PropsValues.JDBC_DEFAULT_PASSWORD.equals(defaultPassword)
        && PropsValues.JDBC_DEFAULT_URL.equals(defaultURL)
        && PropsValues.JDBC_DEFAULT_USERNAME.equals(defaultUsername)) {

      return true;
    }

    return false;
  }
Beispiel #30
0
  protected void visitLayout(Element element, Layout layout, ThemeDisplay themeDisplay)
      throws PortalException, SystemException {

    UnicodeProperties typeSettingsProperties = layout.getTypeSettingsProperties();

    if (!PortalUtil.isLayoutSitemapable(layout)
        || !GetterUtil.getBoolean(typeSettingsProperties.getProperty("sitemap-include"), true)) {

      return;
    }

    String layoutFullURL = PortalUtil.getLayoutFullURL(layout, themeDisplay);

    layoutFullURL = PortalUtil.getCanonicalURL(layoutFullURL, themeDisplay, layout);

    addURLElement(
        element,
        layoutFullURL,
        typeSettingsProperties,
        layout.getModifiedDate(),
        layoutFullURL,
        getAlternateURLs(layoutFullURL, themeDisplay, layout));

    Locale[] availableLocales = LanguageUtil.getAvailableLocales(layout.getGroupId());

    if (availableLocales.length > 1) {
      Locale defaultLocale = LocaleUtil.getSiteDefault();

      for (Locale availableLocale : availableLocales) {
        if (availableLocale.equals(defaultLocale)) {
          continue;
        }

        String alternateURL =
            PortalUtil.getAlternateURL(layoutFullURL, themeDisplay, availableLocale, layout);

        addURLElement(
            element,
            alternateURL,
            typeSettingsProperties,
            layout.getModifiedDate(),
            layoutFullURL,
            getAlternateURLs(layoutFullURL, themeDisplay, layout));
      }
    }
  }