private static List<String> _getDependencies(String bundleId, List<String> dependencies) {

    if (!ArrayUtil.contains(PropsValues.JAVASCRIPT_BUNDLE_IDS, bundleId)) {
      return dependencies;
    }

    String[] bundleDependencies =
        PropsUtil.getArray(PropsKeys.JAVASCRIPT_BUNDLE_DEPENDENCIES, new Filter(bundleId));

    for (String bundleDependency : bundleDependencies) {
      String[] bundleDependencyDependencies =
          PropsUtil.getArray(
              PropsKeys.JAVASCRIPT_BUNDLE_DEPENDENCIES, new Filter(bundleDependency));

      if (!ArrayUtil.contains(bundleDependencyDependencies, bundleId)) {
        _getDependencies(bundleDependency, dependencies);
      }

      dependencies.add(bundleDependency);
    }

    dependencies.add(bundleId);

    return dependencies;
  }
Пример #2
0
 private PortalInstances() {
   _companyIds = new long[0];
   _autoLoginIgnoreHosts =
       SetUtil.fromArray(PropsUtil.getArray(PropsKeys.AUTO_LOGIN_IGNORE_HOSTS));
   _autoLoginIgnorePaths =
       SetUtil.fromArray(PropsUtil.getArray(PropsKeys.AUTO_LOGIN_IGNORE_PATHS));
   _virtualHostsIgnoreHosts =
       SetUtil.fromArray(PropsUtil.getArray(PropsKeys.VIRTUAL_HOSTS_IGNORE_HOSTS));
   _virtualHostsIgnorePaths =
       SetUtil.fromArray(PropsUtil.getArray(PropsKeys.VIRTUAL_HOSTS_IGNORE_PATHS));
 }
  protected String[] getStaticPortletIds(String position) throws PortalException {

    Layout layout = getLayout();

    String selector1 = StringPool.BLANK;

    Group group = layout.getGroup();

    if (group.isUser()) {
      selector1 = LayoutTypePortletConstants.STATIC_PORTLET_USER_SELECTOR;
    } else if (group.isOrganization()) {
      selector1 = LayoutTypePortletConstants.STATIC_PORTLET_ORGANIZATION_SELECTOR;
    } else if (group.isRegularSite()) {
      selector1 = LayoutTypePortletConstants.STATIC_PORTLET_REGULAR_SITE_SELECTOR;
    }

    String selector2 = layout.getFriendlyURL();

    String[] portletIds = PropsUtil.getArray(position, new Filter(selector1, selector2));

    for (int i = 0; i < portletIds.length; i++) {
      portletIds[i] = JS.getSafeName(portletIds[i]);
    }

    return portletIds;
  }
Пример #4
0
  @Override
  public void init(FilterConfig filterConfig) {
    super.init(filterConfig);

    _basicAuthEnabled = GetterUtil.getBoolean(filterConfig.getInitParameter("basic_auth"));
    _digestAuthEnabled = GetterUtil.getBoolean(filterConfig.getInitParameter("digest_auth"));

    String propertyPrefix = filterConfig.getInitParameter("portal_property_prefix");

    String[] hostsAllowed = null;

    if (Validator.isNull(propertyPrefix)) {
      hostsAllowed = StringUtil.split(filterConfig.getInitParameter("hosts.allowed"));
      _httpsRequired = GetterUtil.getBoolean(filterConfig.getInitParameter("https.required"));
    } else {
      hostsAllowed = PropsUtil.getArray(propertyPrefix + "hosts.allowed");
      _httpsRequired = GetterUtil.getBoolean(PropsUtil.get(propertyPrefix + "https.required"));
    }

    for (String hostAllowed : hostsAllowed) {
      _hostsAllowed.add(hostAllowed);
    }

    _usePermissionChecker =
        GetterUtil.getBoolean(filterConfig.getInitParameter("use_permission_checker"));
  }
Пример #5
0
  public Set<String> getReminderQueryQuestions() throws PortalException, SystemException {

    Set<String> questions = new TreeSet<String>();

    List<Organization> organizations =
        OrganizationLocalServiceUtil.getUserOrganizations(getUserId());

    for (Organization organization : organizations) {
      Set<String> organizationQuestions = organization.getReminderQueryQuestions(getLanguageId());

      if (organizationQuestions.size() == 0) {
        Organization parentOrganization = organization.getParentOrganization();

        while ((organizationQuestions.size() == 0) && (parentOrganization != null)) {

          organizationQuestions = parentOrganization.getReminderQueryQuestions(getLanguageId());

          parentOrganization = parentOrganization.getParentOrganization();
        }
      }

      questions.addAll(organizationQuestions);
    }

    if (questions.size() == 0) {
      Set<String> defaultQuestions =
          SetUtil.fromArray(PropsUtil.getArray(PropsKeys.USERS_REMINDER_QUERIES_QUESTIONS));

      questions.addAll(defaultQuestions);
    }

    return questions;
  }
  @Override
  public List<String> getConfigLocations() {
    List<String> configLocations = ListUtil.fromArray(PropsUtil.getArray(PropsKeys.SPRING_CONFIGS));

    configLocations.remove("META-INF/model-listener-spring.xml");

    return configLocations;
  }
Пример #7
0
  public Transformer(
      String transformerListenerPropertyKey, String errorTemplatePropertyKey, boolean restricted) {

    this(errorTemplatePropertyKey, restricted);

    _transformerListenerClassNames =
        SetUtil.fromArray(PropsUtil.getArray(transformerListenerPropertyKey));
  }
  public static void validateFriendlyURLKeyword(String friendlyURL)
      throws LayoutFriendlyURLException {

    String[] keywords = PropsUtil.getArray(PropsKeys.LAYOUT_FRIENDLY_URL_KEYWORDS);

    for (int i = 0; i < keywords.length; i++) {
      String keyword = keywords[i];

      if ((friendlyURL.indexOf(StringPool.SLASH + keyword + StringPool.SLASH) != -1)
          || (friendlyURL.endsWith(StringPool.SLASH + keyword))) {

        LayoutFriendlyURLException lfurle =
            new LayoutFriendlyURLException(LayoutFriendlyURLException.KEYWORD_CONFLICT);

        lfurle.setKeywordConflict(keyword);

        throw lfurle;
      }
    }
  }
Пример #9
0
  @Override
  public void init(FilterConfig filterConfig) {
    super.init(filterConfig);

    _basicAuthEnabled = GetterUtil.getBoolean(filterConfig.getInitParameter("basic_auth"));
    _digestAuthEnabled = GetterUtil.getBoolean(filterConfig.getInitParameter("digest_auth"));

    String propertyPrefix = filterConfig.getInitParameter("portal_property_prefix");

    String[] hostsAllowedArray = null;

    if (Validator.isNull(propertyPrefix)) {
      hostsAllowedArray = StringUtil.split(filterConfig.getInitParameter("hosts.allowed"));
      _httpsRequired = GetterUtil.getBoolean(filterConfig.getInitParameter("https.required"));
    } else {
      hostsAllowedArray = PropsUtil.getArray(propertyPrefix + "hosts.allowed");
      _httpsRequired = GetterUtil.getBoolean(PropsUtil.get(propertyPrefix + "https.required"));
    }

    for (int i = 0; i < hostsAllowedArray.length; i++) {
      _hostsAllowed.add(hostsAllowedArray[i]);
    }
  }
  public static String[] getFileNames(String bundleId) {
    String[] fileNames = (String[]) _portalCache.get(bundleId);

    if (fileNames == null) {
      List<String> fileNamesList = new ArrayList<String>();

      List<String> dependencies = _getDependencies(bundleId, new UniqueList<String>());

      for (String dependency : dependencies) {
        String[] dependencyFileNames = PropsUtil.getArray(dependency);

        for (String dependencyFileName : dependencyFileNames) {
          fileNamesList.add(dependencyFileName);
        }
      }

      fileNames = fileNamesList.toArray(new String[fileNamesList.size()]);

      _portalCache.put(bundleId, fileNames);
    }

    return fileNames;
  }