use of org.hisp.dhis.category.CategoryOptionGroupSet in project dhis2-core by dhis2.
the class DefaultCascadeSharingService method handleCategoryOptionGroupSetDimensions.
/**
* Check if can merge sharing from given source to given analyticalObject's
* {@link CategoryOptionGroupSetDimension} and all related objects that has
* Sharing enabled.
*
* @param sourceSharing {@link Sharing}
* @param analyticalObject any object extends {@link BaseAnalyticalObject}
* @param listUpdateObjects Set of objects need to be updated
* @param parameters {@link CascadeSharingParameters}
*/
private void handleCategoryOptionGroupSetDimensions(final Sharing sourceSharing, BaseAnalyticalObject analyticalObject, Set<IdentifiableObject> listUpdateObjects, CascadeSharingParameters parameters) {
List<CategoryOptionGroupSetDimension> catOptionGroupSetDimensions = analyticalObject.getCategoryOptionGroupSetDimensions();
if (CollectionUtils.isEmpty(catOptionGroupSetDimensions)) {
return;
}
catOptionGroupSetDimensions.forEach(categoryOptionGroupSetDimension -> {
CategoryOptionGroupSet catOptionGroupSet = categoryOptionGroupSetDimension.getDimension();
handleIdentifiableObject(sourceSharing, CategoryOptionGroupSet.class, catOptionGroupSet, listUpdateObjects, parameters);
List<CategoryOptionGroup> catOptionGroups = catOptionGroupSet.getMembers();
if (CollectionUtils.isEmpty(catOptionGroups)) {
return;
}
catOptionGroups.forEach(catOptionGroup -> {
handleIdentifiableObject(sourceSharing, CategoryOptionGroup.class, catOptionGroup, listUpdateObjects, parameters);
handleIdentifiableObjects(sourceSharing, CategoryOption.class, catOptionGroup.getMembers(), listUpdateObjects, parameters);
});
});
}
use of org.hisp.dhis.category.CategoryOptionGroupSet in project dhis2-core by dhis2.
the class User method getDimensionConstraints.
/**
* Returns the dimensions to use as constrains (filters) in data analytics
* aggregation.
*/
public Set<DimensionalObject> getDimensionConstraints() {
Set<DimensionalObject> constraints = new HashSet<>();
for (CategoryOptionGroupSet cogs : cogsDimensionConstraints) {
cogs.setDimensionType(DimensionType.CATEGORY_OPTION_GROUP_SET);
constraints.add(cogs);
}
for (Category cat : catDimensionConstraints) {
cat.setDimensionType(DimensionType.CATEGORY);
constraints.add(cat);
}
return constraints;
}
use of org.hisp.dhis.category.CategoryOptionGroupSet in project dhis2-core by dhis2.
the class DefaultDimensionService method getDimensionType.
@Override
public DimensionType getDimensionType(String uid) {
Category cat = idObjectManager.get(Category.class, uid);
if (cat != null) {
return DimensionType.CATEGORY;
}
DataElementGroupSet degs = idObjectManager.get(DataElementGroupSet.class, uid);
if (degs != null) {
return DimensionType.DATA_ELEMENT_GROUP_SET;
}
OrganisationUnitGroupSet ougs = idObjectManager.get(OrganisationUnitGroupSet.class, uid);
if (ougs != null) {
return DimensionType.ORGANISATION_UNIT_GROUP_SET;
}
CategoryOptionGroupSet cogs = idObjectManager.get(CategoryOptionGroupSet.class, uid);
if (cogs != null) {
return DimensionType.CATEGORY_OPTION_GROUP_SET;
}
TrackedEntityAttribute tea = idObjectManager.get(TrackedEntityAttribute.class, uid);
if (tea != null) {
return DimensionType.PROGRAM_ATTRIBUTE;
}
DataElement pde = idObjectManager.get(DataElement.class, uid);
if (pde != null && DataElementDomain.TRACKER.equals(pde.getDomainType())) {
return DimensionType.PROGRAM_DATA_ELEMENT;
}
ProgramIndicator pin = idObjectManager.get(ProgramIndicator.class, uid);
if (pin != null) {
return DimensionType.PROGRAM_INDICATOR;
}
final Map<String, DimensionType> dimObjectTypeMap = new HashMap<>();
dimObjectTypeMap.put(DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X);
dimObjectTypeMap.put(DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD);
dimObjectTypeMap.put(DimensionalObject.ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT);
return dimObjectTypeMap.get(uid);
}
use of org.hisp.dhis.category.CategoryOptionGroupSet in project dhis2-core by dhis2.
the class DefaultDimensionService method getAllDimensions.
@Override
public List<DimensionalObject> getAllDimensions() {
Collection<Category> dcs = idObjectManager.getDataDimensions(Category.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);
}
use of org.hisp.dhis.category.CategoryOptionGroupSet in project dhis2-core by dhis2.
the class JdbcCompletenessTargetTableManager method getDimensionColumns.
private List<AnalyticsTableColumn> getDimensionColumns() {
List<AnalyticsTableColumn> columns = new ArrayList<>();
List<OrganisationUnitGroupSet> orgUnitGroupSets = idObjectManager.getDataDimensionsNoAcl(OrganisationUnitGroupSet.class);
List<OrganisationUnitLevel> levels = organisationUnitService.getFilledOrganisationUnitLevels();
List<CategoryOptionGroupSet> attributeCategoryOptionGroupSets = categoryService.getAttributeCategoryOptionGroupSetsNoAcl();
List<Category> attributeCategories = categoryService.getAttributeDataDimensionCategoriesNoAcl();
for (OrganisationUnitGroupSet groupSet : orgUnitGroupSets) {
columns.add(new AnalyticsTableColumn(quote(groupSet.getUid()), CHARACTER_11, "ougs." + quote(groupSet.getUid())).withCreated(groupSet.getCreated()));
}
for (OrganisationUnitLevel level : levels) {
String column = quote(PREFIX_ORGUNITLEVEL + level.getLevel());
columns.add(new AnalyticsTableColumn(column, CHARACTER_11, "ous." + column).withCreated(level.getCreated()));
}
for (CategoryOptionGroupSet groupSet : attributeCategoryOptionGroupSets) {
columns.add(new AnalyticsTableColumn(quote(groupSet.getUid()), CHARACTER_11, "acs." + quote(groupSet.getUid())).withCreated(groupSet.getCreated()));
}
for (Category category : attributeCategories) {
columns.add(new AnalyticsTableColumn(quote(category.getUid()), CHARACTER_11, "acs." + quote(category.getUid())).withCreated(category.getCreated()));
}
columns.addAll(getFixedColumns());
return filterDimensionColumns(columns);
}
Aggregations