Search in sources :

Example 71 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.

the class BusinessGroupDAOTest method findBusinessGroupsHeadless.

@Test
public void findBusinessGroupsHeadless() {
    Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("head-1-" + UUID.randomUUID().toString());
    BusinessGroup headlessGroup = businessGroupDao.createAndPersist(null, "headless-grp", "headless-grp-desc", 0, 5, true, false, true, false, false);
    BusinessGroup headedGroup = businessGroupDao.createAndPersist(owner, "headed-grp", "headed-grp-desc", 0, 5, true, false, true, false, false);
    dbInstance.commitAndCloseSession();
    // check marked
    BusinessGroupQueryParams headlessParams = new BusinessGroupQueryParams();
    headlessParams.setHeadless(true);
    List<BusinessGroupRow> groups = businessGroupDao.searchBusinessGroupsWithMemberships(headlessParams, owner);
    Assert.assertNotNull(groups);
    Assert.assertFalse(groups.isEmpty());
    Assert.assertTrue(contains(groups, headlessGroup));
    Assert.assertFalse(contains(groups, headedGroup));
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams) BusinessGroup(org.olat.group.BusinessGroup) Identity(org.olat.core.id.Identity) StatisticsBusinessGroupRow(org.olat.group.model.StatisticsBusinessGroupRow) BusinessGroupRow(org.olat.group.model.BusinessGroupRow) OpenBusinessGroupRow(org.olat.group.model.OpenBusinessGroupRow) Test(org.junit.Test)

Example 72 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.

the class BusinessGroupDAOTest method findBusinessGroupsWithResources.

@Test
public void findBusinessGroupsWithResources() {
    // create a group attach to a resource
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("bg-search-10");
    Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("marker-");
    RepositoryEntry re = JunitTestHelper.createAndPersistRepositoryEntry();
    BusinessGroup group1 = businessGroupDao.createAndPersist(owner, "rsrc-grp-1", "rsrc-grp-1-desc", 0, 5, true, false, true, false, false);
    BusinessGroup group2 = businessGroupDao.createAndPersist(owner, "rsrc-grp-2", "rsrc-grp-2-desc", 0, 5, true, false, true, false, false);
    businessGroupRelationDao.addRelationToResource(group1, re);
    dbInstance.commitAndCloseSession();
    // check the same with the views
    // check the search function with resources
    BusinessGroupQueryParams queryWithParams = new BusinessGroupQueryParams();
    queryWithParams.setResources(Boolean.TRUE);
    List<BusinessGroupRow> groupViewWith = businessGroupDao.searchBusinessGroupsWithMemberships(queryWithParams, id);
    Assert.assertNotNull(groupViewWith);
    Assert.assertFalse(groupViewWith.isEmpty());
    Assert.assertTrue(contains(groupViewWith, group1));
    // check the search function without resources
    BusinessGroupQueryParams queryWithoutParams = new BusinessGroupQueryParams();
    queryWithoutParams.setResources(Boolean.FALSE);
    List<BusinessGroupRow> groupViewWithout = businessGroupDao.searchBusinessGroupsWithMemberships(queryWithoutParams, id);
    Assert.assertNotNull(groupViewWithout);
    Assert.assertFalse(groupViewWithout.isEmpty());
    Assert.assertTrue(contains(groupViewWithout, group2));
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) StatisticsBusinessGroupRow(org.olat.group.model.StatisticsBusinessGroupRow) BusinessGroupRow(org.olat.group.model.BusinessGroupRow) OpenBusinessGroupRow(org.olat.group.model.OpenBusinessGroupRow) Test(org.junit.Test)

Example 73 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.

the class BusinessGroupDAOTest method findMarkedBusinessGroup.

@Test
public void findMarkedBusinessGroup() {
    Identity marker = JunitTestHelper.createAndPersistIdentityAsUser("marker-" + UUID.randomUUID().toString());
    // create a group with a mark and an other without as control
    BusinessGroup group1 = businessGroupDao.createAndPersist(marker, "marked-grp-1", "marked-grp-1-desc", 0, 5, true, false, true, false, false);
    BusinessGroup group2 = businessGroupDao.createAndPersist(marker, "marked-grp-2", "marked-grp-2-desc", 0, 5, true, false, true, false, false);
    markManager.setMark(group1.getResource(), marker, null, "[BusinessGroup:" + group1.getKey() + "]");
    dbInstance.commitAndCloseSession();
    // check the search with the views
    // check marked
    BusinessGroupQueryParams queryMarkedParams = new BusinessGroupQueryParams();
    queryMarkedParams.setOwner(true);
    queryMarkedParams.setMarked(true);
    List<BusinessGroupRow> markedGroupViews = businessGroupDao.searchBusinessGroupsWithMemberships(queryMarkedParams, marker);
    Assert.assertNotNull(markedGroupViews);
    Assert.assertEquals(1, markedGroupViews.size());
    Assert.assertTrue(contains(markedGroupViews, group1));
    Assert.assertFalse(contains(markedGroupViews, group2));
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams) BusinessGroup(org.olat.group.BusinessGroup) Identity(org.olat.core.id.Identity) StatisticsBusinessGroupRow(org.olat.group.model.StatisticsBusinessGroupRow) BusinessGroupRow(org.olat.group.model.BusinessGroupRow) OpenBusinessGroupRow(org.olat.group.model.OpenBusinessGroupRow) Test(org.junit.Test)

Example 74 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.

the class CourseBusinessGroupListController method getSearchParams.

@Override
protected BusinessGroupQueryParams getSearchParams(SearchEvent event) {
    BusinessGroupQueryParams params = event.convertToBusinessGroupQueriesParams();
    params.setRepositoryEntry(re);
    return params;
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Example 75 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.

the class AbstractBusinessGroupListController method search.

private void search(SearchEvent event) {
    if (event == null) {
        loadModel(null);
    } else {
        BusinessGroupQueryParams params = getSearchParams(event);
        loadModel(params);
    }
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Aggregations

BusinessGroupQueryParams (org.olat.group.model.BusinessGroupQueryParams)82 Test (org.junit.Test)38 Identity (org.olat.core.id.Identity)38 BusinessGroup (org.olat.group.BusinessGroup)38 StatisticsBusinessGroupRow (org.olat.group.model.StatisticsBusinessGroupRow)38 OpenBusinessGroupRow (org.olat.group.model.OpenBusinessGroupRow)36 BusinessGroupRow (org.olat.group.model.BusinessGroupRow)34 SearchBusinessGroupParams (org.olat.group.model.SearchBusinessGroupParams)16 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Offer (org.olat.resource.accesscontrol.Offer)4 OfferAccess (org.olat.resource.accesscontrol.OfferAccess)4 AccessMethod (org.olat.resource.accesscontrol.model.AccessMethod)4 TokenAccessMethod (org.olat.resource.accesscontrol.model.TokenAccessMethod)4 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 BGPermission (org.olat.course.member.PermissionHelper.BGPermission)2 BusinessGroupMembership (org.olat.group.BusinessGroupMembership)2 BusinessGroupRowComparator (org.olat.group.model.comparator.BusinessGroupRowComparator)2