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.document.library.service.test.DLFileEntryLocalServiceTest.java

License:Open Source License

protected DLFileEntry updateAndApproveDLFileEntry(DLFileEntry dlFileEntry, InputStream inputStream,
        Map<String, DDMFormValues> ddmFormValuesMap, ServiceContext serviceContext) throws Exception {

    dlFileEntry = DLFileEntryLocalServiceUtil.updateFileEntry(TestPropsValues.getUserId(),
            dlFileEntry.getFileEntryId(), StringUtil.randomString(), ContentTypes.TEXT_PLAIN,
            StringUtil.randomString(), StringPool.BLANK, StringPool.BLANK, true,
            DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT, ddmFormValuesMap, null, inputStream, 0,
            serviceContext);/*from   w  w  w  .j a va  2 s . co m*/

    DLFileVersion dlFileVersion = dlFileEntry.getLatestFileVersion(true);

    return DLFileEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(),
            dlFileVersion.getFileVersionId(), WorkflowConstants.STATUS_APPROVED, serviceContext,
            new HashMap<String, Serializable>());
}

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

License:Open Source License

protected DLFileEntry updateStatus(DLFileVersion dlFileVersion, ServiceContext serviceContext)
        throws Exception {

    return DLFileEntryLocalServiceUtil.updateStatus(dlFileVersion.getUserId(), dlFileVersion.getFileVersionId(),
            WorkflowConstants.STATUS_APPROVED, serviceContext, new HashMap<String, Serializable>());
}

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

License:Open Source License

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

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(6, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), null, false, queryDefinition));
    Assert.assertEquals(5, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, false, queryDefinition));
    Assert.assertEquals(1, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, null, false, queryDefinition));
    Assert.assertEquals(2, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, null, true, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(4, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), null, false, queryDefinition));
    Assert.assertEquals(2, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_HTML }, false, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH);

    Assert.assertEquals(2, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), null, false, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(4, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), null, false, queryDefinition));
    Assert.assertEquals(3, DLFolderFinderUtil.filterCountF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, false, queryDefinition));
}

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

License:Open Source License

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

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(4, DLFolderFinderUtil.filterCountFE_FS_ByG_F(_group.getGroupId(), _folder.getFolderId(),
            queryDefinition));//from   w  ww  .ja  va2 s  . c om

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(3, DLFolderFinderUtil.filterCountFE_FS_ByG_F(_group.getGroupId(), _folder.getFolderId(),
            queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH);

    Assert.assertEquals(1, DLFolderFinderUtil.filterCountFE_FS_ByG_F(_group.getGroupId(), _folder.getFolderId(),
            queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(3, DLFolderFinderUtil.filterCountFE_FS_ByG_F(_group.getGroupId(), _folder.getFolderId(),
            queryDefinition));
}

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

License:Open Source License

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

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(4, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), null, queryDefinition));
    Assert.assertEquals(3, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(3, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), null, queryDefinition));
    Assert.assertEquals(1, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_HTML }, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH);

    Assert.assertEquals(1, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), null, queryDefinition));
    Assert.assertEquals(1, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, queryDefinition));

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(3, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), null, queryDefinition));
    Assert.assertEquals(2, DLFolderFinderUtil.filterCountFE_FS_ByG_F_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, queryDefinition));
}

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

License:Open Source License

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

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    List<Object> results = DLFolderFinderUtil.filterFindF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            _folder.getFolderId(), new String[] { ContentTypes.TEXT_PLAIN }, false, queryDefinition);

    Assert.assertEquals(results.toString(), 3, results.size());

    for (Object result : results) {
        Assert.assertTrue(String.valueOf(result.getClass()), result instanceof DLFileEntry
                || result instanceof DLFileShortcut || result instanceof DLFolder);

        if (result instanceof DLFileEntry) {
            DLFileEntry dlFileEntry = (DLFileEntry) result;

            Assert.assertEquals("FE1.txt", dlFileEntry.getTitle());
        } else if (result instanceof FileShortcut) {
            FileShortcut fileShortcut = (FileShortcut) result;

            Assert.assertEquals(this._fileShortcut.getFileShortcutId(), fileShortcut.getFileShortcutId());
        } else if (result instanceof DLFolder) {
            DLFolder dlFolder = (DLFolder) result;

            Assert.assertEquals("Folder B", dlFolder.getName());
        }/*from   www. j  a  v  a 2s .c o  m*/
    }

    results = DLFolderFinderUtil.filterFindF_FE_FS_ByG_F_M_M(_group.getGroupId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, null, true, queryDefinition);

    Assert.assertEquals(results.toString(), 2, results.size());

    boolean assertMountPointFolder = false;
    boolean assertRegularFolder = false;

    for (Object result : results) {
        Assert.assertTrue(String.valueOf(result.getClass()), result instanceof DLFolder);

        DLFolder dlFolder = (DLFolder) result;

        if (dlFolder.isMountPoint()) {
            Assert.assertEquals("Test Repository", dlFolder.getName());

            assertMountPointFolder = true;
        } else {
            Assert.assertEquals("Folder A", dlFolder.getName());

            assertRegularFolder = true;
        }
    }

    Assert.assertTrue(assertMountPointFolder);
    Assert.assertTrue(assertRegularFolder);
}

From source file:com.liferay.document.library.trash.test.DLFileEntryTrashHandlerTest.java

License:Open Source License

@Override
public int getMineBaseModelsCount(long groupId, long userId) throws Exception {

    return DLAppServiceUtil.getGroupFileEntriesCount(groupId, userId,
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, null, WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.document.library.trash.test.DLFileEntryTrashHandlerTest.java

License:Open Source License

@Override
public int getRecentBaseModelsCount(long groupId) throws Exception {
    return DLAppServiceUtil.getGroupFileEntriesCount(groupId, 0, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
            null, WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.document.library.trash.test.DLFileShortcutTrashHandlerTest.java

License:Open Source License

@Override
protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception {

    DLFolder dlFolder = (DLFolder) parentBaseModel;

    return DLFileShortcutLocalServiceUtil.getFileShortcutsCount(dlFolder.getGroupId(), dlFolder.getFolderId(),
            true, WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.document.library.trash.test.DLFolderTrashHandlerTest.java

License:Open Source License

@Override
protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception {

    DLFolder parentDLFolder = (DLFolder) parentBaseModel;

    return DLFolderLocalServiceUtil.getFoldersCount(parentDLFolder.getGroupId(), parentDLFolder.getFolderId(),
            WorkflowConstants.STATUS_APPROVED, false);
}