Example usage for com.liferay.portal.kernel.service LayoutSetBranchLocalServiceUtil fetchLayoutSetBranch

List of usage examples for com.liferay.portal.kernel.service LayoutSetBranchLocalServiceUtil fetchLayoutSetBranch

Introduction

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

Prototype

public static com.liferay.portal.kernel.model.LayoutSetBranch fetchLayoutSetBranch(long groupId,
            boolean privateLayout, String name) 

Source Link

Usage

From source file:com.liferay.staging.test.StagingImplTest.java

License:Open Source License

protected void enableLocalStaging(boolean branching) throws Exception {
    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    Map<String, Serializable> attributes = serviceContext.getAttributes();

    attributes.putAll(ExportImportConfigurationParameterMapFactory.buildParameterMap());

    if (branching) {
        serviceContext.setSignedIn(true);
    }//from   w w w. j  a v  a  2s  .  c o  m

    ServiceContextThreadLocal.pushServiceContext(serviceContext);

    enableLocalStaging(branching, serviceContext);

    ServiceContextThreadLocal.popServiceContext();

    if (!branching) {
        return;
    }

    UnicodeProperties typeSettingsProperties = _group.getTypeSettingsProperties();

    Assert.assertTrue(GetterUtil.getBoolean(typeSettingsProperties.getProperty("branchingPrivate")));
    Assert.assertTrue(GetterUtil.getBoolean(typeSettingsProperties.getProperty("branchingPublic")));

    Group stagingGroup = _group.getStagingGroup();

    LayoutSetBranch layoutSetBranch = LayoutSetBranchLocalServiceUtil.fetchLayoutSetBranch(
            stagingGroup.getGroupId(), false, LayoutSetBranchConstants.MASTER_BRANCH_NAME);

    Assert.assertNotNull(layoutSetBranch);

    layoutSetBranch = LayoutSetBranchLocalServiceUtil.fetchLayoutSetBranch(stagingGroup.getGroupId(), true,
            LayoutSetBranchConstants.MASTER_BRANCH_NAME);

    Assert.assertNotNull(layoutSetBranch);
}