diff --git a/core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipHandlerImpl.java index 4cd4334ff8..a6011ea238 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipHandlerImpl.java @@ -34,6 +34,8 @@ import org.hisp.dhis.android.core.relationship.Relationship; import org.hisp.dhis.android.core.relationship.RelationshipItem; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import javax.inject.Inject; @@ -65,6 +67,20 @@ final class RelationshipHandlerImpl extends IdentifiableHandlerImpl beforeCollectionHandled(Collection relationships) { + Collection supportedRelationships = new ArrayList<>(); + + for (Relationship relationship : relationships) { + // Only TEI - TEI relationships are supported so far + if (relationship.from().hasTrackedEntityInstance() && relationship.to().hasTrackedEntityInstance()) { + supportedRelationships.add(relationship); + } + } + + return supportedRelationships; + } + @Override protected Relationship beforeObjectHandled(Relationship relationship) { if (!versionManager.isRelationshipSupported(relationship)) {