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

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

Introduction

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

Prototype

int STATUS_APPROVED

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

Click Source Link

Usage

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getGroupEntries(long groupId, int start, int end) {

    return bookmarksEntryPersistence.findByG_S(groupId, WorkflowConstants.STATUS_APPROVED, start, end,
            new EntryModifiedDateComparator());
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getGroupEntries(long groupId, long userId, int start, int end) {

    OrderByComparator<BookmarksEntry> orderByComparator = new EntryModifiedDateComparator();

    if (userId <= 0) {
        return bookmarksEntryPersistence.findByG_S(groupId, WorkflowConstants.STATUS_APPROVED, start, end,
                orderByComparator);/*w w w.  j a va2  s  .c  o m*/
    } else {
        return bookmarksEntryPersistence.findByG_U_S(groupId, userId, WorkflowConstants.STATUS_APPROVED, start,
                end, orderByComparator);
    }
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public int getGroupEntriesCount(long groupId) {
    return bookmarksEntryPersistence.countByG_S(groupId, WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public int getGroupEntriesCount(long groupId, long userId) {
    if (userId <= 0) {
        return getGroupEntriesCount(groupId);
    } else {//www  .j  a va  2 s .  c o  m
        return bookmarksEntryPersistence.countByG_U_S(groupId, userId, WorkflowConstants.STATUS_APPROVED);
    }
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public BookmarksEntry moveEntryFromTrash(long userId, long entryId, long parentFolderId)
        throws PortalException {

    BookmarksEntry entry = getBookmarksEntry(entryId);

    if (!entry.isInTrash()) {
        throw new RestoreEntryException(RestoreEntryException.INVALID_STATUS);
    }//w  w w .  ja va  2  s  . c om

    if (entry.isInTrashExplicitly()) {
        restoreEntryFromTrash(userId, entryId);
    } else {

        // Entry

        TrashVersion trashVersion = trashVersionLocalService.fetchVersion(BookmarksEntry.class.getName(),
                entryId);

        int status = WorkflowConstants.STATUS_APPROVED;

        if (trashVersion != null) {
            status = trashVersion.getStatus();
        }

        updateStatus(userId, entry, status);

        // Trash

        if (trashVersion != null) {
            trashVersionLocalService.deleteTrashVersion(trashVersion);
        }
    }

    return bookmarksEntryLocalService.moveEntry(entryId, parentFolderId);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public BookmarksEntry updateStatus(long userId, BookmarksEntry entry, int status) throws PortalException {

    // Entry/*from w  w w .  j ava2 s  .com*/

    User user = userPersistence.findByPrimaryKey(userId);

    entry.setStatus(status);
    entry.setStatusByUserId(userId);
    entry.setStatusByUserName(user.getScreenName());
    entry.setStatusDate(new Date());

    bookmarksEntryPersistence.update(entry);

    JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject();

    extraDataJSONObject.put("title", entry.getName());

    if (status == WorkflowConstants.STATUS_APPROVED) {

        // Asset

        assetEntryLocalService.updateVisible(BookmarksEntry.class.getName(), entry.getEntryId(), true);

        // Social

        socialActivityLocalService.addActivity(userId, entry.getGroupId(), BookmarksEntry.class.getName(),
                entry.getEntryId(), SocialActivityConstants.TYPE_RESTORE_FROM_TRASH,
                extraDataJSONObject.toString(), 0);
    } else if (status == WorkflowConstants.STATUS_IN_TRASH) {

        // Asset

        assetEntryLocalService.updateVisible(BookmarksEntry.class.getName(), entry.getEntryId(), false);

        // Social

        socialActivityLocalService.addActivity(userId, entry.getGroupId(), BookmarksEntry.class.getName(),
                entry.getEntryId(), SocialActivityConstants.TYPE_MOVE_TO_TRASH, extraDataJSONObject.toString(),
                0);
    }

    return entry;
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getEntries(long groupId, long folderId, int start, int end) {

    return bookmarksEntryPersistence.filterFindByG_F_S(groupId, folderId, WorkflowConstants.STATUS_APPROVED,
            start, end);//from   w w w .  j  a  v a  2  s.  com
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getEntries(long groupId, long folderId, int start, int end,
        OrderByComparator<BookmarksEntry> orderByComparator) {

    return bookmarksEntryPersistence.filterFindByG_F_S(groupId, folderId, WorkflowConstants.STATUS_APPROVED,
            start, end, orderByComparator);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java

License:Open Source License

@Override
public int getFoldersEntriesCount(long groupId, List<Long> folderIds) {
    return bookmarksEntryPersistence.filterCountByG_F_S(groupId,
            ArrayUtil.toArray(folderIds.toArray(new Long[folderIds.size()])),
            WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getGroupEntries(long groupId, int start, int end) throws PortalException {

    return getGroupEntries(groupId, 0, WorkflowConstants.STATUS_APPROVED, start, end);
}