use of org.hisp.dhis.dataelement.DataElementGroupSet in project dhis2-core by dhis2.
the class DefaultDimensionService method getDimensionType.
@Override
public DimensionType getDimensionType(String uid) {
DataElementCategory cat = idObjectManager.get(DataElementCategory.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.dataelement.DataElementGroupSet 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);
}
Aggregations