Beispiel #1
0
  protected TemplateResource getErrorTemplateResource(String langType) {
    try {
      long companyId = CompanyThreadLocal.getCompanyId();

      JournalServiceConfiguration journalServiceConfiguration =
          ConfigurationProviderUtil.getCompanyConfiguration(
              JournalServiceConfiguration.class, companyId);

      String template = StringPool.BLANK;

      if (langType.equals(TemplateConstants.LANG_TYPE_FTL)) {
        template = journalServiceConfiguration.errorTemplateFTL();
      } else if (langType.equals(TemplateConstants.LANG_TYPE_VM)) {
        template = journalServiceConfiguration.errorTemplateVM();
      } else if (langType.equals(TemplateConstants.LANG_TYPE_XSL)) {
        template = journalServiceConfiguration.errorTemplateXSL();
      } else {
        return null;
      }

      return new StringTemplateResource(langType, template);
    } catch (Exception e) {
    }

    return null;
  }
  protected boolean isIndexAllArticleVersions() {
    JournalServiceConfiguration journalServiceConfiguration = null;

    try {
      journalServiceConfiguration =
          _configurationProvider.getCompanyConfiguration(
              JournalServiceConfiguration.class, CompanyThreadLocal.getCompanyId());

      return journalServiceConfiguration.indexAllArticleVersionsEnabled();
    } catch (Exception e) {
      _log.error(e, e);
    }

    return false;
  }
  @Override
  public List<Long> filterFindByR_U_T(long groupId, long userId, long[] typePKs) {

    if (ArrayUtil.isEmpty(typePKs)) {
      return Collections.emptyList();
    }

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(getClass(), FIND_BY_TYPE_PKS);

      sql =
          StringUtil.replace(
              sql,
              new String[] {"[$TYPE_PKS$]", "[$ROLE_IDS_OR_OWNER_ID$]"},
              new String[] {getTypePKsSQL(typePKs), getRoleOwnerIdsSQL(groupId, userId)});

      SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);

      sqlQuery.addScalar("primKey", Type.LONG);

      QueryPos qPos = QueryPos.getInstance(sqlQuery);

      qPos.add(CompanyThreadLocal.getCompanyId());
      qPos.add(ResourceConstants.SCOPE_INDIVIDUAL);

      return (List<Long>) sqlQuery.list();
    } catch (Exception e) {
      throw new SystemException(e);
    } finally {
      closeSession(session);
    }
  }