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

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

Introduction

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

Prototype

int STATUS_PENDING

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

Click Source Link

Usage

From source file:org.liferay.jukebox.service.impl.AlbumLocalServiceImpl.java

License:Open Source License

protected void moveDependentsToTrash(List<Song> songs, long trashEntryId)
        throws PortalException, SystemException {

    for (Song song : songs) {

        // Entry//from  w  w  w  .j a v  a 2  s  .  com

        if (song.isInTrash()) {
            continue;
        }

        int oldStatus = song.getStatus();

        song.setStatus(WorkflowConstants.STATUS_IN_TRASH);

        songPersistence.update(song);

        // Trash

        int status = oldStatus;

        if (oldStatus == WorkflowConstants.STATUS_PENDING) {
            status = WorkflowConstants.STATUS_DRAFT;
        }

        if (oldStatus != WorkflowConstants.STATUS_APPROVED) {
            trashVersionLocalService.addTrashVersion(trashEntryId, Song.class.getName(), song.getSongId(),
                    status, null);
        }

        // Asset

        assetEntryLocalService.updateVisible(Song.class.getName(), song.getSongId(), false);

        // Indexer

        Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(Song.class);

        indexer.reindex(song);
    }
}

From source file:se.gothiaforum.actorsarticle.service.impl.ActorsServiceImpl.java

License:Open Source License

@Override
public void addActor(ActorArticle actorArticle, long userId, long defaultUserId, long companyId,
        ServiceContext serviceContext, String tagsEntries, long groupId) {
    /**//from  ww  w . ja  v a2s  . co m
     * Create a organization and add the user to it.
     */
    Organization parentOrganization = actorsServiceUtil.getParentOrganization(defaultUserId);
    String name = actorArticle.getCompanyName();
    String type = "gothia-actor";
    boolean recursable = true;
    long regionId = 0;
    long countryId = 0;
    int statusId = actorsServiceUtil.getStatusIdForOrganizationFullMember();
    String comments = "This is the organization for " + name;
    Organization org = null;

    long parentOrganizationId = parentOrganization.getOrganizationId();

    try {
        org = organizationService.addOrganization(userId, parentOrganizationId, name, type, recursable,
                regionId, countryId, statusId, comments, false, serviceContext);

    } catch (PortalException e) {
        throw new RuntimeException("Unable to add a organization", e);
    } catch (SystemException e) {
        throw new RuntimeException("Unable to add a organization", e);
    }

    actorsServiceUtil.addUserToOrg(userId, org.getOrganizationId());
    actorsServiceUtil.addUserRole(userId, companyId, org.getGroup().getGroupId());

    try {
        /**
         * Create a article and setts all the values for the article.
         */
        JournalArticle article = articleService.createJournalArticle(counterService.increment());
        article = actorsServiceUtil.setArticleFields(article, actorArticle, org.getGroup().getGroupId(),
                parentOrganization.getGroup().getGroupId(), userId);

        /**
         * Create a resource for the article.
         */
        JournalArticleResource articleResource = articleResourceService
                .createJournalArticleResource(counterService.increment());

        articleResource.setArticleId(article.getArticleId());
        articleResource.setGroupId(org.getGroup().getGroupId());
        article.setResourcePrimKey(articleResource.getPrimaryKey());
        articleResourceService.addJournalArticleResource(articleResource);

        /**
         * Creating the content String from the field of the form.
         */
        article.setContent(actorsServiceUtil.content2XML(actorArticle));
        articleService.addJournalArticle(article); // Add the article.

        /**
         * Add AssetEntry for the article.
         */

        articleService.addArticleResources(article, true, true); // Add the article to the DB.

        AssetEntry assetEntry = actorsServiceUtil.getAssetEntry(userId, org.getGroup().getGroupId(), article);

        assetEntryService.addAssetEntry(assetEntry);

        addArticleTags(userId, groupId, article, tagsEntries, serviceContext, assetEntry);

        // Message Boards
        mBMessageLocalService.addDiscussionMessage(userId, article.getUserName(), org.getGroup().getGroupId(),
                JournalArticle.class.getName(), article.getResourcePrimKey(), WorkflowConstants.STATUS_PENDING);

    } catch (SystemException e) {
        throw new RuntimeException("Unable to add a actor", e);
    } catch (PortalException e) {
        throw new RuntimeException("Unable to add a actor", e);
    }
}