Search in sources :

Example 16 with OrganisationUnitGroupSet

use of org.hisp.dhis.organisationunit.OrganisationUnitGroupSet in project dhis2-core by dhis2.

the class DefaultDimensionService method getAllDimensions.

@Override
public List<DimensionalObject> getAllDimensions() {
    Collection<DataElementCategory> dcs = idObjectManager.getDataDimensions(DataElementCategory.class);
    Collection<CategoryOptionGroupSet> cogs = idObjectManager.getDataDimensions(CategoryOptionGroupSet.class);
    Collection<DataElementGroupSet> degs = idObjectManager.getDataDimensions(DataElementGroupSet.class);
    Collection<OrganisationUnitGroupSet> ougs = idObjectManager.getDataDimensions(OrganisationUnitGroupSet.class);
    final List<DimensionalObject> dimensions = new ArrayList<>();
    dimensions.addAll(dcs);
    dimensions.addAll(cogs);
    dimensions.addAll(degs);
    dimensions.addAll(ougs);
    User user = currentUserService.getCurrentUser();
    return getCanReadObjects(user, dimensions);
}
Also used : DataElementGroupSet(org.hisp.dhis.dataelement.DataElementGroupSet) User(org.hisp.dhis.user.User) DataElementCategory(org.hisp.dhis.dataelement.DataElementCategory) CategoryOptionGroupSet(org.hisp.dhis.dataelement.CategoryOptionGroupSet) UniqueArrayList(org.hisp.dhis.commons.collection.UniqueArrayList) ArrayList(java.util.ArrayList) OrganisationUnitGroupSet(org.hisp.dhis.organisationunit.OrganisationUnitGroupSet) DimensionalObject(org.hisp.dhis.common.DimensionalObject) BaseDimensionalObject(org.hisp.dhis.common.BaseDimensionalObject)

Example 17 with OrganisationUnitGroupSet

use of org.hisp.dhis.organisationunit.OrganisationUnitGroupSet in project dhis2-core by dhis2.

the class MergeServiceTest method mergeOrgUnitGroup.

@Test
public void mergeOrgUnitGroup() {
    OrganisationUnit organisationUnitA = createOrganisationUnit('A');
    OrganisationUnit organisationUnitB = createOrganisationUnit('B');
    OrganisationUnit organisationUnitC = createOrganisationUnit('C');
    OrganisationUnit organisationUnitD = createOrganisationUnit('D');
    OrganisationUnitGroup organisationUnitGroupA = createOrganisationUnitGroup('A');
    OrganisationUnitGroup organisationUnitGroupB = createOrganisationUnitGroup('B');
    organisationUnitGroupA.getMembers().add(organisationUnitA);
    organisationUnitGroupA.getMembers().add(organisationUnitB);
    organisationUnitGroupA.getMembers().add(organisationUnitC);
    organisationUnitGroupA.getMembers().add(organisationUnitD);
    OrganisationUnitGroupSet organisationUnitGroupSetA = createOrganisationUnitGroupSet('A');
    organisationUnitGroupSetA.addOrganisationUnitGroup(organisationUnitGroupA);
    mergeService.merge(new MergeParams<>(organisationUnitGroupA, organisationUnitGroupB).setMergeMode(MergeMode.REPLACE));
    assertFalse(organisationUnitGroupB.getMembers().isEmpty());
    assertEquals(4, organisationUnitGroupB.getMembers().size());
    assertNotNull(organisationUnitGroupB.getGroupSets());
    assertFalse(organisationUnitGroupB.getGroupSets().isEmpty());
}
Also used : OrganisationUnitGroup(org.hisp.dhis.organisationunit.OrganisationUnitGroup) OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) MergeParams(org.hisp.dhis.schema.MergeParams) OrganisationUnitGroupSet(org.hisp.dhis.organisationunit.OrganisationUnitGroupSet) Test(org.junit.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Example 18 with OrganisationUnitGroupSet

use of org.hisp.dhis.organisationunit.OrganisationUnitGroupSet in project dhis2-core by dhis2.

the class GetOrgUnitDistributionChartAction method execute.

// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() {
    OrganisationUnitGroupSet groupSet = organisationUnitGroupService.getOrganisationUnitGroupSet(groupSetId);
    OrganisationUnit unit = selectionTreeManager.getReloadedSelectedOrganisationUnit();
    chart = distributionService.getOrganisationUnitDistributionChart(groupSet, unit);
    return SUCCESS;
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) OrganisationUnitGroupSet(org.hisp.dhis.organisationunit.OrganisationUnitGroupSet)

Example 19 with OrganisationUnitGroupSet

use of org.hisp.dhis.organisationunit.OrganisationUnitGroupSet in project dhis2-core by dhis2.

the class DhisConvenienceTest method createOrganisationUnitGroupSet.

/**
     * @param uniqueCharacter A unique character to identify the object.
     */
public static OrganisationUnitGroupSet createOrganisationUnitGroupSet(char uniqueCharacter) {
    OrganisationUnitGroupSet groupSet = new OrganisationUnitGroupSet();
    groupSet.setAutoFields();
    groupSet.setName("OrganisationUnitGroupSet" + uniqueCharacter);
    groupSet.setDescription("Description" + uniqueCharacter);
    groupSet.setCompulsory(true);
    return groupSet;
}
Also used : OrganisationUnitGroupSet(org.hisp.dhis.organisationunit.OrganisationUnitGroupSet)

Aggregations

OrganisationUnitGroupSet (org.hisp.dhis.organisationunit.OrganisationUnitGroupSet)19 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)8 CategoryOptionGroupSet (org.hisp.dhis.dataelement.CategoryOptionGroupSet)7 DataElementCategory (org.hisp.dhis.dataelement.DataElementCategory)6 OrganisationUnitGroup (org.hisp.dhis.organisationunit.OrganisationUnitGroup)6 ArrayList (java.util.ArrayList)5 OrganisationUnitLevel (org.hisp.dhis.organisationunit.OrganisationUnitLevel)5 AnalyticsTableColumn (org.hisp.dhis.analytics.AnalyticsTableColumn)4 DataElementGroupSet (org.hisp.dhis.dataelement.DataElementGroupSet)4 PeriodType (org.hisp.dhis.period.PeriodType)4 DhisSpringTest (org.hisp.dhis.DhisSpringTest)3 DimensionalObject (org.hisp.dhis.common.DimensionalObject)3 UniqueArrayList (org.hisp.dhis.commons.collection.UniqueArrayList)3 DataElement (org.hisp.dhis.dataelement.DataElement)3 Test (org.junit.Test)3 ValueType (org.hisp.dhis.common.ValueType)2 TrackedEntityAttribute (org.hisp.dhis.trackedentity.TrackedEntityAttribute)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1