Example usage for com.liferay.portal.kernel.service GroupLocalServiceUtil updateGroup

List of usage examples for com.liferay.portal.kernel.service GroupLocalServiceUtil updateGroup

Introduction

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

Prototype

public static com.liferay.portal.kernel.model.Group updateGroup(long groupId, long parentGroupId,
            java.util.Map<java.util.Locale, String> nameMap, java.util.Map<java.util.Locale, String> descriptionMap,
            int type, boolean manualMembership, int membershipRestriction, String friendlyURL,
            boolean inheritContent, boolean active, ServiceContext serviceContext)
            throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Usage

From source file:com.liferay.site.service.persistence.test.GroupFinderTest.java

License:Open Source License

@Test
public void testFindByLayouts2() throws Exception {
    int initialGroupCount = GroupFinderUtil.countByLayouts(TestPropsValues.getCompanyId(),
            GroupConstants.DEFAULT_PARENT_GROUP_ID, true, true);

    GroupTestUtil.addGroup();/*ww  w  . ja v a 2s .  com*/

    Group parentGroup = GroupTestUtil.addGroup();

    LayoutTestUtil.addLayout(parentGroup, false);

    Group childGroup1 = GroupTestUtil.addGroup(parentGroup.getGroupId());

    LayoutTestUtil.addLayout(childGroup1, false);

    Group childGroup2 = GroupTestUtil.addGroup(parentGroup.getGroupId());

    LayoutTestUtil.addLayout(childGroup2, true);

    GroupLocalServiceUtil.updateGroup(parentGroup.getGroupId(), parentGroup.getParentGroupId(),
            parentGroup.getNameMap(), parentGroup.getDescriptionMap(), parentGroup.getType(),
            parentGroup.isManualMembership(), parentGroup.getMembershipRestriction(),
            parentGroup.getFriendlyURL(), parentGroup.isInheritContent(), false,
            ServiceContextTestUtil.getServiceContext());

    List<Group> groups = GroupFinderUtil.findByLayouts(TestPropsValues.getCompanyId(),
            GroupConstants.DEFAULT_PARENT_GROUP_ID, true, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
            new GroupNameComparator(true));

    Assert.assertEquals(groups.toString(), initialGroupCount, groups.size());

    groups = GroupFinderUtil.findByLayouts(TestPropsValues.getCompanyId(), parentGroup.getGroupId(), true, true,
            QueryUtil.ALL_POS, QueryUtil.ALL_POS, new GroupNameComparator(true));

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

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test
public void testAddParentToStagedGroup() throws Exception {
    Group parentGroup = GroupTestUtil.addGroup();

    Group childGroup = GroupTestUtil.addGroup();

    try {//w ww .  j a  v  a2  s .  c  o m
        GroupTestUtil.enableLocalStaging(childGroup);

        childGroup = GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        Group stagingGroup = childGroup.getStagingGroup();

        Assert.assertEquals(parentGroup.getGroupId(), stagingGroup.getParentGroupId());
    } finally {
        GroupLocalServiceUtil.deleteGroup(childGroup);

        GroupLocalServiceUtil.deleteGroup(parentGroup);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test
public void testAddStagedParentToStagedGroup() throws Exception {
    Group parentGroup = GroupTestUtil.addGroup();

    Group childGroup = GroupTestUtil.addGroup();

    try {//from  www  .  ja v a 2s .  com
        GroupTestUtil.enableLocalStaging(childGroup);

        GroupTestUtil.enableLocalStaging(parentGroup);

        childGroup = GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        Group childGroupStagingGroup = childGroup.getStagingGroup();

        Assert.assertEquals(parentGroup.getGroupId(), childGroupStagingGroup.getParentGroupId());
    } finally {
        GroupLocalServiceUtil.deleteGroup(childGroup);

        GroupLocalServiceUtil.deleteGroup(parentGroup);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test
public void testRemoveParentFromStagedGroup() throws Exception {
    Group parentGroup = GroupTestUtil.addGroup();

    Group childGroup = GroupTestUtil.addGroup();

    try {/*ww  w . j a  v a2 s . co m*/
        GroupTestUtil.enableLocalStaging(childGroup);

        GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        childGroup = GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(),
                GroupConstants.DEFAULT_PARENT_GROUP_ID, childGroup.getNameMap(), childGroup.getDescriptionMap(),
                childGroup.getType(), childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        Group childGroupStagingGroup = childGroup.getStagingGroup();

        Assert.assertEquals(GroupConstants.DEFAULT_PARENT_GROUP_ID, childGroupStagingGroup.getParentGroupId());
    } finally {
        GroupLocalServiceUtil.deleteGroup(childGroup);

        GroupLocalServiceUtil.deleteGroup(parentGroup);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test
public void testRemoveStagedParentFromStagedGroup() throws Exception {
    Group parentGroup = GroupTestUtil.addGroup();

    Group childGroup = GroupTestUtil.addGroup();

    try {//from w w w  .  java2 s. com
        GroupTestUtil.enableLocalStaging(childGroup);

        GroupTestUtil.enableLocalStaging(parentGroup);

        GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        childGroup = GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(),
                GroupConstants.DEFAULT_PARENT_GROUP_ID, childGroup.getNameMap(), childGroup.getDescriptionMap(),
                childGroup.getType(), childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        Group childGroupStagingGroup = childGroup.getStagingGroup();

        Assert.assertEquals(GroupConstants.DEFAULT_PARENT_GROUP_ID, childGroupStagingGroup.getParentGroupId());
    } finally {
        GroupLocalServiceUtil.deleteGroup(childGroup);

        GroupLocalServiceUtil.deleteGroup(parentGroup);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test(expected = GroupParentException.MustNotHaveChildParent.class)
public void testSelectFirstChildGroupAsParentSite() throws Exception {
    Group group1 = GroupTestUtil.addGroup();

    Group group11 = GroupTestUtil.addGroup(group1.getGroupId());

    try {/*from w  w w. j  a  va  2  s .c o  m*/
        GroupLocalServiceUtil.updateGroup(group1.getGroupId(), group11.getGroupId(), group1.getNameMap(),
                group1.getDescriptionMap(), group1.getType(), group1.isManualMembership(),
                group1.getMembershipRestriction(), group1.getFriendlyURL(), group1.isInheritContent(),
                group1.isActive(), ServiceContextTestUtil.getServiceContext());
    } finally {
        GroupLocalServiceUtil.deleteGroup(group11);

        GroupLocalServiceUtil.deleteGroup(group1);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test(expected = GroupParentException.MustNotHaveChildParent.class)
public void testSelectLastChildGroupAsParentSite() throws Exception {
    Group group1 = GroupTestUtil.addGroup();

    Group group11 = GroupTestUtil.addGroup(group1.getGroupId());

    Group group111 = GroupTestUtil.addGroup(group11.getGroupId());

    Group group1111 = GroupTestUtil.addGroup(group111.getGroupId());

    try {/* w  ww . ja v a2s.c o m*/
        GroupLocalServiceUtil.updateGroup(group1.getGroupId(), group1111.getGroupId(), group1.getNameMap(),
                group1.getDescriptionMap(), group1.getType(), group1.isManualMembership(),
                group1.getMembershipRestriction(), group1.getFriendlyURL(), group1.isInheritContent(),
                group1.isActive(), ServiceContextTestUtil.getServiceContext());
    } finally {
        GroupLocalServiceUtil.deleteGroup(group1111);

        GroupLocalServiceUtil.deleteGroup(group111);

        GroupLocalServiceUtil.deleteGroup(group11);

        GroupLocalServiceUtil.deleteGroup(group1);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test(expected = GroupParentException.MustNotHaveStagingParent.class)
public void testSelectLiveGroupAsParentSite() throws Exception {
    Group group = GroupTestUtil.addGroup();

    GroupTestUtil.enableLocalStaging(group);

    Assert.assertTrue(group.hasStagingGroup());

    Group stagingGroup = group.getStagingGroup();

    try {//  w  w w. j a v  a 2  s .c  om
        GroupLocalServiceUtil.updateGroup(stagingGroup.getGroupId(), group.getGroupId(),
                stagingGroup.getNameMap(), stagingGroup.getDescriptionMap(), stagingGroup.getType(),
                stagingGroup.isManualMembership(), stagingGroup.getMembershipRestriction(),
                stagingGroup.getFriendlyURL(), stagingGroup.isInheritContent(), stagingGroup.isActive(),
                ServiceContextTestUtil.getServiceContext());
    } finally {
        GroupLocalServiceUtil.deleteGroup(group);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test(expected = GroupParentException.MustNotBeOwnParent.class)
public void testSelectOwnGroupAsParentSite() throws Exception {
    Group group = GroupTestUtil.addGroup();

    try {/*from w  w  w  .  j  av a  2 s . co m*/
        GroupLocalServiceUtil.updateGroup(group.getGroupId(), group.getGroupId(), group.getNameMap(),
                group.getDescriptionMap(), group.getType(), group.isManualMembership(),
                group.getMembershipRestriction(), group.getFriendlyURL(), group.isInheritContent(),
                group.isActive(), ServiceContextTestUtil.getServiceContext());
    } finally {
        GroupLocalServiceUtil.deleteGroup(group);
    }
}

From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java

License:Open Source License

@Test
public void testUpdateGroupParentFromStagedParentToStagedParentInStagedGroup() throws Exception {

    Group childGroup = GroupTestUtil.addGroup();
    Group parentGroup1 = GroupTestUtil.addGroup();
    Group parentGroup2 = GroupTestUtil.addGroup();

    try {/*from w  w  w.  j  av a 2 s  .  co  m*/
        GroupTestUtil.enableLocalStaging(childGroup);
        GroupTestUtil.enableLocalStaging(parentGroup1);
        GroupTestUtil.enableLocalStaging(parentGroup2);

        GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup1.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        childGroup = GroupLocalServiceUtil.updateGroup(childGroup.getGroupId(), parentGroup2.getGroupId(),
                childGroup.getNameMap(), childGroup.getDescriptionMap(), childGroup.getType(),
                childGroup.isManualMembership(), childGroup.getMembershipRestriction(),
                childGroup.getFriendlyURL(), childGroup.isInheritContent(), childGroup.isActive(), null);

        Group childGroupStagingGroup = childGroup.getStagingGroup();

        Assert.assertEquals(parentGroup2.getGroupId(), childGroupStagingGroup.getParentGroupId());
    } finally {
        GroupLocalServiceUtil.deleteGroup(childGroup);
        GroupLocalServiceUtil.deleteGroup(parentGroup1);
        GroupLocalServiceUtil.deleteGroup(parentGroup2);
    }
}