protected int getStatus(RenderRequest renderRequest) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!themeDisplay.isSignedIn()) {
      return WorkflowConstants.STATUS_APPROVED;
    }

    String statusString = renderRequest.getParameter("status");

    int status = GetterUtil.getInteger(statusString);

    if ((statusString != null) && (status == WorkflowConstants.STATUS_APPROVED)) {

      return WorkflowConstants.STATUS_APPROVED;
    }

    Tuple resourceTuple = getResourceTuple(renderRequest);

    long resourcePrimKey = (Long) resourceTuple.getObject(1);

    if (resourcePrimKey == KBFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
      return WorkflowConstants.STATUS_APPROVED;
    }

    long resourceClassNameId = (Long) resourceTuple.getObject(0);

    long kbArticleClassNameId = PortalUtil.getClassNameId(KBArticleConstants.getClassName());

    if (resourceClassNameId == kbArticleClassNameId) {
      KBArticle kbArticle =
          KBArticleServiceUtil.fetchLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_ANY);

      if (kbArticle == null) {
        return WorkflowConstants.STATUS_APPROVED;
      }

      if (KBArticlePermission.contains(
          themeDisplay.getPermissionChecker(), resourcePrimKey, ActionKeys.UPDATE)) {

        return ParamUtil.getInteger(renderRequest, "status", WorkflowConstants.STATUS_ANY);
      }
    }

    return WorkflowConstants.STATUS_APPROVED;
  }
  @Override
  protected void doExportStagedModel(PortletDataContext portletDataContext, KBArticle kbArticle)
      throws Exception {

    if (kbArticle.getParentResourcePrimKey() != KBFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

      long kbArticleClassNameId = PortalUtil.getClassNameId(KBArticleConstants.getClassName());

      if (kbArticle.getParentResourceClassNameId() == kbArticleClassNameId) {

        KBArticle parentKBArticle =
            KBArticleLocalServiceUtil.getLatestKBArticle(
                kbArticle.getParentResourcePrimKey(), WorkflowConstants.STATUS_APPROVED);

        StagedModelDataHandlerUtil.exportReferenceStagedModel(
            portletDataContext,
            kbArticle,
            parentKBArticle,
            PortletDataContext.REFERENCE_TYPE_PARENT);
      } else {
        KBFolder parentKBFolder =
            KBFolderLocalServiceUtil.getKBFolder(kbArticle.getParentResourcePrimKey());

        StagedModelDataHandlerUtil.exportReferenceStagedModel(
            portletDataContext,
            kbArticle,
            parentKBFolder,
            PortletDataContext.REFERENCE_TYPE_PARENT);
      }
    }

    Element kbArticleElement = portletDataContext.getExportDataElement(kbArticle);

    exportKBArticleAttachments(portletDataContext, kbArticleElement, kbArticle);

    portletDataContext.addClassedModel(
        kbArticleElement, ExportImportPathUtil.getModelPath(kbArticle), kbArticle);
  }