Example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_SCHEDULED

List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_SCHEDULED

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_SCHEDULED.

Prototype

int STATUS_SCHEDULED

To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_SCHEDULED.

Click Source Link

Usage

From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java

License:Open Source License

protected void checkArticlesByDisplayDate(Date displayDate) throws PortalException {

    String portletId = PortletProviderUtil.getPortletId(JournalArticle.class.getName(),
            PortletProvider.Action.EDIT);

    List<JournalArticle> articles = journalArticlePersistence.findByLtD_S(displayDate,
            WorkflowConstants.STATUS_SCHEDULED);

    for (JournalArticle article : articles) {
        long userId = PortalUtil.getValidUserId(article.getCompanyId(), article.getUserId());

        ServiceContext serviceContext = new ServiceContext();

        serviceContext.setCommand(Constants.UPDATE);

        String layoutFullURL = PortalUtil.getLayoutFullURL(article.getGroupId(), portletId);

        serviceContext.setLayoutFullURL(layoutFullURL);

        serviceContext.setScopeGroupId(article.getGroupId());

        journalArticleLocalService.updateStatus(userId, article, WorkflowConstants.STATUS_APPROVED, null,
                serviceContext, new HashMap<String, Serializable>());
    }//ww  w . j ava2  s .c  o m
}

From source file:com.liferay.journal.util.impl.JournalUtil.java

License:Open Source License

public static boolean isHeadListable(JournalArticle article) {
    JournalArticle latestArticle = JournalArticleLocalServiceUtil
            .fetchLatestArticle(article.getResourcePrimKey(), new int[] { WorkflowConstants.STATUS_APPROVED,
                    WorkflowConstants.STATUS_IN_TRASH, WorkflowConstants.STATUS_SCHEDULED });

    if ((latestArticle != null) && (article.getId() == latestArticle.getId())) {

        return true;
    }//from  ww  w . j  a v a2s  . c  o  m

    return false;
}

From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java

License:Open Source License

public List<ManagementBarFilterItem> getManagementBarStatusFilterItems()
        throws PortalException, PortletException {

    List<ManagementBarFilterItem> managementBarFilterItems = new ArrayList<>();

    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_ANY));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_DRAFT));

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

    int workflowDefinitionLinksCount = WorkflowDefinitionLinkLocalServiceUtil.getWorkflowDefinitionLinksCount(
            themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), JournalFolder.class.getName());

    if (workflowDefinitionLinksCount > 0) {
        managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_PENDING));
        managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_DENIED));
    }/*from  w  w  w. java  2 s  .  com*/

    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_SCHEDULED));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_APPROVED));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_EXPIRED));

    return managementBarFilterItems;
}

From source file:com.liferay.lms.model.CompetenceClp.java

License:Open Source License

public boolean isScheduled() {
    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
        return true;
    } else {//w  ww. j  av  a  2  s .  c  o  m
        return false;
    }
}

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

@Override
protected void addStatus(BooleanQuery contextQuery, SearchContext searchContext) throws Exception {

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    boolean includeScheduledArticles = false;

    if (params != null) {
        includeScheduledArticles = GetterUtil.getBoolean(params.get("includeScheduledArticles"));
    }/* w  w w .j a  v a2s  . c om*/

    if (includeScheduledArticles) {
        BooleanQuery statusQuery = BooleanQueryFactoryUtil.create(searchContext);

        BooleanQuery statusHeadQuery = BooleanQueryFactoryUtil.create(searchContext);

        statusHeadQuery.addRequiredTerm("head", Boolean.TRUE);
        statusHeadQuery.addRequiredTerm(Field.STATUS, WorkflowConstants.STATUS_APPROVED);

        statusQuery.add(statusHeadQuery, BooleanClauseOccur.SHOULD);

        BooleanQuery statusScheduledHeadQuery = BooleanQueryFactoryUtil.create(searchContext);

        statusScheduledHeadQuery.addRequiredTerm("scheduledHead", Boolean.TRUE);
        statusScheduledHeadQuery.addRequiredTerm(Field.STATUS, WorkflowConstants.STATUS_SCHEDULED);

        statusQuery.add(statusScheduledHeadQuery, BooleanClauseOccur.SHOULD);

        contextQuery.add(statusQuery, BooleanClauseOccur.MUST);
    } else {
        super.addStatus(contextQuery, searchContext);

        boolean head = GetterUtil.getBoolean(searchContext.getAttribute("head"), Boolean.TRUE);
        boolean relatedClassName = GetterUtil.getBoolean(searchContext.getAttribute("relatedClassName"));

        if (head && !relatedClassName) {
            contextQuery.addRequiredTerm("head", Boolean.TRUE);
        }
    }
}

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

protected void addStatusHeads(Document document, JournalArticle article) throws SystemException {

    boolean head = false;
    boolean scheduledHead = false;

    int[] statuses = new int[] { WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH };

    JournalArticle latestArticle = JournalArticleLocalServiceUtil
            .fetchLatestArticle(article.getResourcePrimKey(), statuses);

    if (latestArticle == null) {
        statuses = new int[] { WorkflowConstants.STATUS_SCHEDULED };

        latestArticle = JournalArticleLocalServiceUtil.fetchLatestArticle(article.getResourcePrimKey(),
                statuses);/*from   w w w  .  ja va 2 s  .c  o  m*/
    }

    if ((latestArticle != null) && latestArticle.isIndexable() && (article.getId() == latestArticle.getId())) {

        if (latestArticle.getStatus() == WorkflowConstants.STATUS_SCHEDULED) {

            scheduledHead = true;
        } else {
            head = true;
        }
    }

    document.addKeyword("head", head);
    document.addKeyword("scheduledHead", scheduledHead);
}

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

@Override
protected void doReindex(Object obj) throws Exception {
    JournalArticle article = (JournalArticle) obj;

    if (PortalUtil.getClassNameId(DDMStructure.class) == article.getClassNameId()) {

        Document document = getDocument(article);

        SearchEngineUtil.deleteDocument(getSearchEngineId(), article.getCompanyId(), document.get(Field.UID));

        return;/* w w w.jav a  2 s .  c om*/
    }

    if (!PropsValues.JOURNAL_ARTICLE_INDEX_ALL_VERSIONS) {
        int status = article.getStatus();

        if ((status != WorkflowConstants.STATUS_APPROVED) && (status != WorkflowConstants.STATUS_IN_TRASH)
                && (status != WorkflowConstants.STATUS_SCHEDULED)) {

            deleteDocument(article.getCompanyId(), article.getResourcePrimKey());
        }
    }

    reindexArticleVersions(article);
}

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

protected void reindexArticles(long companyId) throws PortalException, SystemException {

    ActionableDynamicQuery actionableDynamicQuery = new JournalArticleActionableDynamicQuery() {

        @Override/*from  w w w  . j  av  a 2 s  .c  o  m*/
        protected void addCriteria(DynamicQuery dynamicQuery) {
            if (PropsValues.JOURNAL_ARTICLE_INDEX_ALL_VERSIONS) {
                return;
            }

            Property statusProperty = PropertyFactoryUtil.forName("status");

            Integer[] statuses = { WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH,
                    WorkflowConstants.STATUS_SCHEDULED };

            dynamicQuery.add(statusProperty.in(statuses));
        }

        @Override
        protected void performAction(Object object) throws PortalException {
            JournalArticle article = (JournalArticle) object;

            Document document = getDocument(article);

            addDocument(document);
        }

    };

    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
}