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.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByAnyStatus() throws Exception {
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Event", null, WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Contact", null, WorkflowConstants.STATUS_DRAFT);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, null, null, null, null, null,
            WorkflowConstants.STATUS_ANY, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    Assert.assertEquals(templates.toString(), 2, templates.size());
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByDescription() throws Exception {
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Event", "Event",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Contact", "Contact",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Meeting", "Meeting",
            WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, null, "Meeting", null, null,
            null, WorkflowConstants.STATUS_APPROVED, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    Assert.assertEquals(templates.toString(), 1, templates.size());

    DDMTemplate template = templates.get(0);

    Assert.assertEquals("Meeting", template.getDescription(group.getDefaultLanguageId()));
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByDraftStatus() throws Exception {
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Event", null, WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Contact", null, WorkflowConstants.STATUS_DRAFT);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, null, null, null, null, null,
            WorkflowConstants.STATUS_DRAFT, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    Assert.assertEquals(templates.toString(), 1, templates.size());
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByKeywords() throws Exception {
    addDisplayTemplate(_classNameId, _resourceClassNameId, "Event Template", WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, _resourceClassNameId, "Contact Template",
            WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, "Event", null, null,
            WorkflowConstants.STATUS_APPROVED, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
            new TemplateIdComparator(true));

    Assert.assertEquals(templates.toString(), 1, templates.size());
    Assert.assertEquals("Event Template", getTemplateName(templates.get(0)));

    templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, "Template", null, null,
            WorkflowConstants.STATUS_APPROVED, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
            new TemplateIdComparator(true));

    Assert.assertEquals("Event Template", getTemplateName(templates.get(0)));
    Assert.assertEquals("Contact Template", getTemplateName(templates.get(1)));
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByName() throws Exception {
    addDisplayTemplate(_classNameId, _resourceClassNameId, "Event", WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, _resourceClassNameId, "Contact", WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, _resourceClassNameId, "Meeting", WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, "Event", null, null, null,
            null, WorkflowConstants.STATUS_APPROVED, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    Assert.assertEquals(templates.toString(), 1, templates.size());
    Assert.assertEquals("Event", getTemplateName(templates.get(0)));
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByNameAndDescription() throws Exception {
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Event", "Event",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Contact", "Contact",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Meeting", "Meeting",
            WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, 0, "Event", "Meeting", null, null, null,
            WorkflowConstants.STATUS_APPROVED, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    Assert.assertEquals(templates.toString(), 0, templates.size());
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchByNameOrDescription() throws Exception {
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Event", "Event",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Contact", "Contact",
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Meeting", "Meeting",
            WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, null, null, _resourceClassNameId, "Event", "Meeting", null, null,
            null, WorkflowConstants.STATUS_APPROVED, false, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
            new TemplateIdComparator(true));

    Assert.assertEquals("Event", getTemplateName(templates.get(0)));
    Assert.assertEquals("Meeting", getTemplateName(templates.get(1)));
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchCount() throws Exception {
    int initialCount = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            group.getGroupId(), _classNameId, 0, 0, "Test Template", null, null, null, null,
            WorkflowConstants.STATUS_APPROVED, false);

    addDisplayTemplate(_classNameId, 0, _resourceClassNameId, "Test Template", "Test Template",
            WorkflowConstants.STATUS_APPROVED);

    int count = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(), group.getGroupId(),
            _classNameId, 0, _resourceClassNameId, "Test Template", null, null, null, null,
            WorkflowConstants.STATUS_APPROVED, false);

    Assert.assertEquals(initialCount + 1, count);
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchCountByClassNameIdAndClassPK() throws Exception {
    long classNameId1 = RandomTestUtil.randomLong();
    long classPK1 = RandomTestUtil.randomLong();

    addDisplayTemplate(classNameId1, classPK1, _resourceClassNameId, StringUtil.randomString(),
            StringUtil.randomString(), WorkflowConstants.STATUS_APPROVED);

    addDisplayTemplate(classNameId1, RandomTestUtil.randomLong(), _resourceClassNameId,
            StringUtil.randomString(), StringUtil.randomString(), WorkflowConstants.STATUS_APPROVED);

    long classNameId2 = RandomTestUtil.randomLong();

    addDisplayTemplate(classNameId2, RandomTestUtil.randomLong(), _resourceClassNameId,
            StringUtil.randomString(), StringUtil.randomString(), WorkflowConstants.STATUS_APPROVED);

    int count = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, new long[] { classNameId1 }, new long[] { classPK1 },
            _resourceClassNameId, null, null, null, WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(1, count);/* w w  w .  j av  a2  s  .  c o m*/

    count = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, new long[] { classNameId2 }, new long[] { classPK1 },
            _resourceClassNameId, null, null, null, WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(0, count);
}

From source file:com.liferay.dynamic.data.mapping.service.test.DDMTemplateLocalServiceTest.java

License:Open Source License

@Test
public void testSearchCountByClassNameIds() throws Exception {
    long classNameId1 = RandomTestUtil.randomLong();

    addDisplayTemplate(classNameId1, _resourceClassNameId, StringUtil.randomString(),
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(classNameId1, _resourceClassNameId, StringUtil.randomString(),
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(classNameId1, _resourceClassNameId, StringUtil.randomString(),
            WorkflowConstants.STATUS_APPROVED);

    long classNameId2 = RandomTestUtil.randomLong();

    addDisplayTemplate(classNameId2, _resourceClassNameId, StringUtil.randomString(),
            WorkflowConstants.STATUS_APPROVED);
    addDisplayTemplate(classNameId2, _resourceClassNameId, StringUtil.randomString(),
            WorkflowConstants.STATUS_APPROVED);

    int count = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, new long[] { classNameId1 }, null, _resourceClassNameId, null,
            null, null, WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(3, count);/*w  w  w .j  a v a 2 s .  c  om*/

    count = DDMTemplateLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, new long[] { classNameId1, classNameId2 }, null,
            _resourceClassNameId, null, null, null, WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(5, count);
}