Example usage for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil deleteLayoutSetPrototype

List of usage examples for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil deleteLayoutSetPrototype

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil deleteLayoutSetPrototype.

Prototype

public static com.liferay.portal.kernel.model.LayoutSetPrototype deleteLayoutSetPrototype(
        long layoutSetPrototypeId) throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Document

Deletes the layout set prototype with the primary key from the database.

Usage

From source file:com.liferay.exportimport.test.LayoutExportImportTest.java

License:Open Source License

@Test
public void testExportImportLayoutPrototypeInvalidLARType() throws Exception {

    // Import a layout prototype to a layout set

    LayoutPrototype layoutPrototype = LayoutTestUtil.addLayoutPrototype(RandomTestUtil.randomString());

    group = layoutPrototype.getGroup();//from w ww  .  ja  va  2s . c  o m

    importedGroup = GroupTestUtil.addGroup();

    long[] layoutIds = new long[0];

    try {
        exportImportLayouts(layoutIds, getImportParameterMap());

        Assert.fail();
    } catch (LARTypeException larte) {
    }

    // Import a layout prototype to a layout set pototype

    LayoutSetPrototype layoutSetPrototype = LayoutTestUtil.addLayoutSetPrototype(RandomTestUtil.randomString());

    importedGroup = layoutSetPrototype.getGroup();

    try {
        exportImportLayouts(layoutIds, getImportParameterMap());

        Assert.fail();
    } catch (LARTypeException larte) {
    } finally {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);

        importedGroup = null;
    }
}

From source file:com.liferay.exportimport.test.LayoutExportImportTest.java

License:Open Source License

@Test
public void testExportImportLayoutSetInvalidLARType() throws Exception {

    // Import a layout set to a layout prototype

    LayoutPrototype layoutPrototype = LayoutTestUtil.addLayoutPrototype(RandomTestUtil.randomString());

    importedGroup = layoutPrototype.getGroup();

    long[] layoutIds = new long[0];

    try {/*from   w w  w . j  a v a2 s. c o  m*/
        exportImportLayouts(layoutIds, getImportParameterMap());

        Assert.fail();
    } catch (LARTypeException larte) {
    }

    // Import a layout set to a layout set prototype

    LayoutSetPrototype layoutSetPrototype = LayoutTestUtil.addLayoutSetPrototype(RandomTestUtil.randomString());

    importedGroup = layoutSetPrototype.getGroup();

    try {
        exportImportLayouts(layoutIds, getImportParameterMap());

        Assert.fail();
    } catch (LARTypeException larte) {
    } finally {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);

        importedGroup = null;
    }
}

From source file:com.liferay.exportimport.test.LayoutExportImportTest.java

License:Open Source License

@Test
public void testExportImportLayoutSetPrototypeInvalidLARType() throws Exception {

    // Import a layout set prototype to a layout set

    LayoutSetPrototype layoutSetPrototype = LayoutTestUtil.addLayoutSetPrototype(RandomTestUtil.randomString());

    try {/*from   w ww.j av  a2  s  .c o m*/
        group = layoutSetPrototype.getGroup();
        importedGroup = GroupTestUtil.addGroup();

        long[] layoutIds = new long[0];

        try {
            exportImportLayouts(layoutIds, getImportParameterMap());

            Assert.fail();
        } catch (LARTypeException larte) {
        }

        // Import a layout set prototype to a layout prototyope

        LayoutPrototype layoutPrototype = LayoutTestUtil.addLayoutPrototype(RandomTestUtil.randomString());

        importedGroup = layoutPrototype.getGroup();

        try {
            exportImportLayouts(layoutIds, getImportParameterMap());

            Assert.fail();
        } catch (LARTypeException larte) {
        }
    } finally {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);

        group = null;
    }
}

From source file:com.liferay.exportimport.test.PermissionExportImportTest.java

License:Open Source License

@Test
public void testPortletGuestPermissionsExportImport() throws Exception {

    // Export//from  w w w  .  j a  v a2  s  . c om

    LayoutSetPrototype exportLayoutSetPrototype = LayoutTestUtil
            .addLayoutSetPrototype(RandomTestUtil.randomString());

    Group exportGroup = exportLayoutSetPrototype.getGroup();

    Layout exportLayout = LayoutTestUtil.addLayout(exportGroup, true);

    String exportResourcePrimKey = PortletPermissionUtil.getPrimaryKey(exportLayout.getPlid(), _PORTLET_ID);

    Role role = RoleLocalServiceUtil.getRole(TestPropsValues.getCompanyId(), RoleConstants.GUEST);

    addPortletPermissions(exportGroup, role, exportResourcePrimKey);

    Element portletElement = exportPortletPermissions(exportGroup, exportLayout);

    // Import

    LayoutSetPrototype importLayoutSetPrototype = LayoutTestUtil
            .addLayoutSetPrototype(RandomTestUtil.randomString());

    Group importGroup = importLayoutSetPrototype.getGroup();

    Layout importLayout = LayoutTestUtil.addLayout(importGroup, true);

    String importResourcePrimKey = PortletPermissionUtil.getPrimaryKey(importLayout.getPlid(), _PORTLET_ID);

    importPortletPermissions(importGroup, importLayout, portletElement);

    validateImportedPortletPermissions(importGroup, role, importResourcePrimKey);

    LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(exportLayoutSetPrototype);
    LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(importLayoutSetPrototype);
}

From source file:com.liferay.layout.set.prototype.exportimport.data.handler.test.LayoutSetPrototypeStagedModelDataHandlerTest.java

License:Open Source License

@After
@Override//w w w  . j  a  va2s  . com
public void tearDown() throws Exception {
    super.tearDown();

    if (_layoutSetPrototype != null) {
        _layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.fetchLayoutSetPrototypeByUuidAndCompanyId(
                _layoutSetPrototype.getUuid(), _layoutSetPrototype.getCompanyId());

        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(_layoutSetPrototype);
    }

    if (_layoutPrototype != null) {
        _layoutPrototype = LayoutPrototypeLocalServiceUtil.fetchLayoutPrototypeByUuidAndCompanyId(
                _layoutPrototype.getUuid(), _layoutPrototype.getCompanyId());

        LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype(_layoutPrototype);
    }
}

From source file:com.liferay.layout.set.prototype.exportimport.data.handler.test.LayoutSetPrototypeStagedModelDataHandlerTest.java

License:Open Source License

@Override
protected void deleteStagedModel(StagedModel stagedModel,
        Map<String, List<StagedModel>> dependentStagedModelsMap, Group group) throws Exception {

    LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype((LayoutSetPrototype) stagedModel);
}