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.DDMStructureLocalServiceTest.java

License:Open Source License

@Test
public void testSearchCountByType() throws Exception {
    int initialCount = DDMStructureLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_FRAGMENT, WorkflowConstants.STATUS_ANY, true);

    addStructure(0, _classNameId, null, StringUtil.randomString(), StringPool.BLANK, read("test-structure.xsd"),
            StorageType.JSON.getValue(), DDMStructureConstants.TYPE_FRAGMENT,
            WorkflowConstants.STATUS_APPROVED);

    int count = DDMStructureLocalServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_FRAGMENT, WorkflowConstants.STATUS_ANY, true);

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

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

License:Open Source License

@Test
public void testSearchByType() throws Exception {
    addStructure(0, _classNameId, null, StringUtil.randomString(), StringPool.BLANK, read("test-structure.xsd"),
            StorageType.JSON.getValue(), DDMStructureConstants.TYPE_DEFAULT, WorkflowConstants.STATUS_APPROVED);

    addStructure(0, _classNameId, null, StringUtil.randomString(), StringPool.BLANK, read("test-structure.xsd"),
            StorageType.JSON.getValue(), DDMStructureConstants.TYPE_FRAGMENT,
            WorkflowConstants.STATUS_APPROVED);

    List<DDMStructure> structures = DDMStructureServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_DEFAULT, WorkflowConstants.STATUS_APPROVED, true, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, null);/*  www . j a  v  a 2s  .  com*/

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

    structures = DDMStructureServiceUtil.search(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_FRAGMENT, WorkflowConstants.STATUS_APPROVED, true, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, null);

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

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

License:Open Source License

@Test
public void testSearchCountByType() throws Exception {
    int initialCount = DDMStructureServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_FRAGMENT, WorkflowConstants.STATUS_ANY, true);

    addStructure(0, _classNameId, null, StringUtil.randomString(), StringPool.BLANK, read("test-structure.xsd"),
            StorageType.JSON.getValue(), DDMStructureConstants.TYPE_FRAGMENT,
            WorkflowConstants.STATUS_APPROVED);

    int count = DDMStructureServiceUtil.searchCount(TestPropsValues.getCompanyId(),
            new long[] { group.getGroupId() }, _classNameId, null, null, null,
            DDMStructureConstants.TYPE_FRAGMENT, WorkflowConstants.STATUS_ANY, true);

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

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

License:Open Source License

@Test
public void testAddTemplateWithDuplicateKey() throws Exception {
    String templateKey = RandomTestUtil.randomString();
    String language = TemplateConstants.LANG_TYPE_VM;

    try {//from w w  w .ja v  a 2  s.co  m
        addTemplate(_classNameId, 0, templateKey, "Test Template 1", DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY,
                DDMTemplateConstants.TEMPLATE_MODE_CREATE, language, getTestTemplateScript(language),
                WorkflowConstants.STATUS_APPROVED);
        addTemplate(_classNameId, 0, templateKey, "Test Template 2", DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY,
                DDMTemplateConstants.TEMPLATE_MODE_CREATE, language, getTestTemplateScript(language),
                WorkflowConstants.STATUS_APPROVED);

        Assert.fail();
    } catch (TemplateDuplicateTemplateKeyException tdtke) {
    }
}

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

License:Open Source License

@Test
public void testAddTemplateWithoutName() throws Exception {
    String language = TemplateConstants.LANG_TYPE_VM;

    try {//from   w w w.  j  a  va2 s .  co  m
        addTemplate(_classNameId, 0, null, StringPool.BLANK, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY,
                DDMTemplateConstants.TEMPLATE_MODE_CREATE, language, getTestTemplateScript(language),
                WorkflowConstants.STATUS_APPROVED);

        Assert.fail();
    } catch (TemplateNameException tne) {
    }
}

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

License:Open Source License

@Test
public void testAddTemplateWithoutScript() throws Exception {
    try {//from w w w. j av a  2  s .c om
        addTemplate(_classNameId, 0, null, "Test Template", DDMTemplateConstants.TEMPLATE_TYPE_FORM,
                DDMTemplateConstants.TEMPLATE_MODE_CREATE, TemplateConstants.LANG_TYPE_VM, StringPool.BLANK,
                WorkflowConstants.STATUS_APPROVED);

        Assert.fail();
    } catch (TemplateScriptException tse) {
    }
}

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

License:Open Source License

@Test
public void testCopyTemplates() throws Exception {
    int initialCount = DDMTemplateLocalServiceUtil.getTemplatesCount(group.getGroupId(), _classNameId, 0);

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

    copyTemplate(template);/*w ww  .  java2  s  .  c o  m*/

    int count = DDMTemplateLocalServiceUtil.getTemplatesCount(group.getGroupId(), _classNameId, 0);

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

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

License:Open Source License

@Test
public void testDeleteTemplate() throws Exception {
    DDMTemplate template = addDisplayTemplate(_classNameId, 0, "Test Template",
            WorkflowConstants.STATUS_APPROVED);

    DDMTemplateLocalServiceUtil.deleteTemplate(template.getTemplateId());

    Assert.assertNull(DDMTemplateLocalServiceUtil.fetchDDMTemplate(template.getTemplateId()));
}

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

License:Open Source License

@Test
public void testFetchTemplate() throws Exception {
    DDMTemplate template = addDisplayTemplate(_classNameId, _resourceClassNameId, "Test Template",
            WorkflowConstants.STATUS_APPROVED);

    Assert.assertNotNull(DDMTemplateLocalServiceUtil.fetchTemplate(template.getGroupId(), _classNameId,
            template.getTemplateKey()));
}

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

License:Open Source License

@Test
public void testGetTemplates() throws Exception {
    DDMTemplate template = addDisplayTemplate(_classNameId, _resourceClassNameId, "Test Template",
            WorkflowConstants.STATUS_APPROVED);

    List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.getTemplates(template.getGroupId(),
            template.getClassNameId());/*from  w  ww.  j a v  a  2s . co  m*/

    Assert.assertTrue(templates.toString(), templates.contains(template));
}