diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/dimension/TeiAnalyticsPrefixStrategy.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/dimension/TeiAnalyticsPrefixStrategy.java index c9a437250768..2b167db63efd 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/dimension/TeiAnalyticsPrefixStrategy.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/dimension/TeiAnalyticsPrefixStrategy.java @@ -29,15 +29,22 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.common.PrefixedDimension; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.program.ProgramStageDataElement; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class TeiAnalyticsPrefixStrategy implements PrefixStrategy { - public static final PrefixStrategy INSTANCE = EnrollmentAnalyticsPrefixStrategy.INSTANCE; + public static final PrefixStrategy INSTANCE = new TeiAnalyticsPrefixStrategy(); @Override public String apply(PrefixedDimension pDimension) { - throw new UnsupportedOperationException("This method should not be called for TEI analytics"); + if (pDimension.getItem() instanceof DataElement + || pDimension.getItem() instanceof ProgramStageDataElement) { + return pDimension.getPrefix(); + } + return StringUtils.EMPTY; } }