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

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

Introduction

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

Prototype

int STATUS_IN_TRASH

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

Click Source Link

Usage

From source file:com.liferay.document.library.internal.service.SubscriptionDLAppHelperLocalServiceWrapper.java

License:Open Source License

@Override
public void updateStatus(long userId, FileEntry fileEntry, FileVersion latestFileVersion, int oldStatus,
        int newStatus, ServiceContext serviceContext, Map<String, Serializable> workflowContext)
        throws PortalException {

    if (!_isEnabled(fileEntry)) {
        return;/*w w  w  .j  a v  a 2  s  .c  o m*/
    }

    super.updateStatus(userId, fileEntry, latestFileVersion, oldStatus, newStatus, serviceContext,
            workflowContext);

    if ((newStatus == WorkflowConstants.STATUS_APPROVED) && (oldStatus != WorkflowConstants.STATUS_IN_TRASH)
            && !fileEntry.isInTrash()) {

        // Subscriptions

        notifySubscribers(userId, latestFileVersion,
                (String) workflowContext.get(WorkflowConstants.CONTEXT_URL), serviceContext);
    }
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public int getTrashContainedModelsCount(long classPK) throws PortalException {

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    return documentRepository.getFileEntriesAndFileShortcutsCount(classPK, WorkflowConstants.STATUS_IN_TRASH);
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public List<TrashRenderer> getTrashContainedModelTrashRenderers(long classPK, int start, int end)
        throws PortalException {

    List<TrashRenderer> trashRenderers = new ArrayList<>();

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    List<RepositoryEntry> repositoryEntries = documentRepository.getFileEntriesAndFileShortcuts(classPK,
            WorkflowConstants.STATUS_IN_TRASH, start, end);

    for (RepositoryEntry repositoryEntry : repositoryEntries) {
        String curClassName = StringPool.BLANK;
        long curClassPK = 0;

        if (repositoryEntry instanceof FileShortcut) {
            FileShortcut fileShortcut = (FileShortcut) repositoryEntry;

            curClassName = DLFileShortcutConstants.getClassName();
            curClassPK = fileShortcut.getPrimaryKey();
        } else if (repositoryEntry instanceof FileEntry) {
            FileEntry fileEntry = (FileEntry) repositoryEntry;

            curClassName = DLFileEntry.class.getName();
            curClassPK = fileEntry.getPrimaryKey();
        } else {/*from w  ww .  ja  v a2s.  com*/
            continue;
        }

        TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(curClassName);

        TrashRenderer trashRenderer = trashHandler.getTrashRenderer(curClassPK);

        trashRenderers.add(trashRenderer);
    }

    return trashRenderers;
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public int getTrashContainerModelsCount(long classPK) throws PortalException {

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    return documentRepository.getFoldersCount(classPK, WorkflowConstants.STATUS_IN_TRASH, false);
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public List<TrashRenderer> getTrashContainerModelTrashRenderers(long classPK, int start, int end)
        throws PortalException {

    List<TrashRenderer> trashRenderers = new ArrayList<>();

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    List<Folder> folders = documentRepository.getFolders(classPK, WorkflowConstants.STATUS_IN_TRASH, false,
            start, end, null);//from w  w  w . j av  a 2  s.  c o m

    for (Folder folder : folders) {
        TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(DLFolder.class.getName());

        TrashRenderer trashRenderer = trashHandler.getTrashRenderer(folder.getPrimaryKey());

        trashRenderers.add(trashRenderer);
    }

    return trashRenderers;
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public int getTrashModelsCount(long classPK) throws PortalException {
    DocumentRepository documentRepository = getDocumentRepository(classPK);

    return documentRepository.getFileEntriesAndFileShortcutsCount(classPK, WorkflowConstants.STATUS_IN_TRASH);
}

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public List<TrashRenderer> getTrashModelTrashRenderers(long classPK, int start, int end, OrderByComparator obc)
        throws PortalException {

    List<TrashRenderer> trashRenderers = new ArrayList<>();

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    List<RepositoryEntry> repositoryEntries = documentRepository.getFoldersAndFileEntriesAndFileShortcuts(
            classPK, WorkflowConstants.STATUS_IN_TRASH, false, start, end, obc);

    for (RepositoryEntry repositoryEntry : repositoryEntries) {
        TrashRenderer trashRenderer = null;

        if (repositoryEntry instanceof FileShortcut) {
            FileShortcut fileShortcut = (FileShortcut) repositoryEntry;

            TrashHandler trashHandler = TrashHandlerRegistryUtil
                    .getTrashHandler(DLFileShortcutConstants.getClassName());

            trashRenderer = trashHandler.getTrashRenderer(fileShortcut.getPrimaryKey());
        } else if (repositoryEntry instanceof FileEntry) {
            FileEntry fileEntry = (FileEntry) repositoryEntry;

            TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(DLFileEntry.class.getName());

            trashRenderer = trashHandler.getTrashRenderer(fileEntry.getPrimaryKey());
        } else {/*from   w ww.  j  av a2s .  com*/
            Folder folder = (Folder) repositoryEntry;

            TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(DLFolder.class.getName());

            trashRenderer = trashHandler.getTrashRenderer(folder.getPrimaryKey());
        }

        trashRenderers.add(trashRenderer);
    }

    return trashRenderers;
}

From source file:com.liferay.document.library.service.test.DLFileEntryFinderTest.java

License:Open Source License

@Test
public void testCountByG_U_F_M_StatusInTrash() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(2, doCountBy_G_U_F_M(0, null, queryDefinition));
}

From source file:com.liferay.document.library.service.test.DLFileEntryFinderTest.java

License:Open Source License

@Test
public void testCountByG_U_F_M_StatusInTrashByMimeType() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(1, doCountBy_G_U_F_M(0, ContentTypes.TEXT_PLAIN, queryDefinition));
}

From source file:com.liferay.document.library.service.test.DLFileEntryFinderTest.java

License:Open Source License

@Test
public void testCountByG_U_F_M_StatusInTrashByUserId() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(1, doCountBy_G_U_F_M(_defaultRepositoryFolder.getUserId(), null, queryDefinition));
}