protected JournalArticle getArticle(HttpServletRequest request) {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long groupId = ParamUtil.getLong(request, "groupId", themeDisplay.getScopeGroupId());
    long classNameId = ParamUtil.getLong(request, "classNameId");
    long classPK = ParamUtil.getLong(request, "classPK");
    String articleId = ParamUtil.getString(request, "articleId");
    int status = ParamUtil.getInteger(request, "status", WorkflowConstants.STATUS_ANY);

    JournalArticle article = null;

    if (Validator.isNotNull(articleId)) {
      article = _journalArticleLocalService.fetchLatestArticle(groupId, articleId, status);
    } else if ((classNameId > 0) && (classPK > JournalArticleConstants.CLASSNAME_ID_DEFAULT)) {

      String className = PortalUtil.getClassName(classNameId);

      try {
        article = _journalArticleLocalService.getLatestArticle(groupId, className, classPK);
      } catch (PortalException pe) {
        return null;
      }
    }

    return article;
  }
  protected boolean isCategorizable(long classNameId) {
    String className = PortalUtil.getClassName(classNameId);

    AssetRendererFactory<?> assetRendererFactory =
        AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className);

    if ((assetRendererFactory == null) || !assetRendererFactory.isCategorizable()) {

      return false;
    }

    return true;
  }
Exemplo n.º 3
0
  protected void upgradeRatingsEntry(long classNameId) throws Exception {
    String className = PortalUtil.getClassName(classNameId);

    if (ArrayUtil.contains(PropsValues.RATINGS_UPGRADE_THUMBS_CLASS_NAMES, className)) {

      upgradeRatingsEntryThumbs(classNameId);
    } else {
      int defaultRatingsStarsNormalizationFactor =
          GetterUtil.getInteger(
              PropsUtil.get(
                  PropsKeys.RATINGS_UPGRADE_STARS_NORMALIZATION_FACTOR, new Filter("default")),
              5);

      int ratingsStarsNormalizationFactor =
          GetterUtil.getInteger(
              PropsUtil.get(
                  PropsKeys.RATINGS_UPGRADE_STARS_NORMALIZATION_FACTOR, new Filter(className)),
              defaultRatingsStarsNormalizationFactor);

      upgradeRatingsEntryStars(classNameId, ratingsStarsNormalizationFactor);
    }
  }
  public static String getTemplateModelResourceName(long resourceClassNameId)
      throws PortalException {

    ServiceWrapper<DDMTemplatePermissionSupport> templatePermissionSupportServiceWrapper =
        _ddmPermissionSupportTracker.getDDMTemplatePermissionSupportServiceWrapper(
            resourceClassNameId);

    Map<String, Object> properties = templatePermissionSupportServiceWrapper.getProperties();

    boolean defaultModelResourceName =
        MapUtil.getBoolean(properties, "default.model.resource.name");

    if (defaultModelResourceName) {
      return DDMTemplate.class.getName();
    }

    StringBundler sb = new StringBundler(3);

    sb.append(PortalUtil.getClassName(resourceClassNameId));
    sb.append(ResourceActionsUtil.getCompositeModelNameSeparator());
    sb.append(DDMTemplate.class.getName());

    return sb.toString();
  }