Skip to content

Commit

Permalink
feat: export /tracker/event using different idSchemes DHIS2-14968 (#1…
Browse files Browse the repository at this point in the history
…9039)

* feat: export /tracker/event using different idSchemes

* feat: use original change log metadata [DHIS2-14968]

---------

Co-authored-by: Marc <[email protected]>
  • Loading branch information
teleivo and muilpp authored Nov 8, 2024
1 parent c8725d9 commit 59991d7
Show file tree
Hide file tree
Showing 22 changed files with 2,057 additions and 361 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,20 @@ public MetadataIdentifier toMetadataIdentifier(String identifier) {
}
return MetadataIdentifier.of(this.idScheme, identifier, null);
}

/**
* Returns this {@link TrackerIdSchemeParam} as expected in a request parameter which makes it
* usable in tests. It is also a more readable format than what lombok produces.
*/
@Override
public String toString() {
if (this.idScheme == null) {
return "";
}
if (this.idScheme == TrackerIdScheme.ATTRIBUTE) {
return this.idScheme.name() + ":" + this.attributeUid;
}

return this.idScheme.name();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import lombok.Getter;
import org.hisp.dhis.category.CategoryOptionCombo;
import org.hisp.dhis.common.AssignedUserSelectionMode;
import org.hisp.dhis.common.IdSchemes;
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.common.QueryFilter;
import org.hisp.dhis.common.SortDirection;
Expand Down Expand Up @@ -110,8 +109,6 @@ public class EventOperationParams {

private CategoryOptionCombo categoryOptionCombo;

@Builder.Default private IdSchemes idSchemes = new IdSchemes();

private boolean includeRelationships;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public EventQueryParams map(
.setEnrollmentOccurredAfter(operationParams.getEnrollmentOccurredAfter())
.setEventStatus(operationParams.getEventStatus())
.setCategoryOptionCombo(attributeOptionCombo)
.setIdSchemes(operationParams.getIdSchemes())
.setIncludeAttributes(false)
.setIncludeAllDataElements(false)
.setEvents(operationParams.getEvents())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.commons.collections4.SetUtils;
import org.hisp.dhis.category.CategoryOptionCombo;
import org.hisp.dhis.common.AssignedUserQueryParam;
import org.hisp.dhis.common.IdSchemes;
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.common.QueryFilter;
import org.hisp.dhis.common.SortDirection;
Expand Down Expand Up @@ -103,8 +102,6 @@ class EventQueryParams {

private CategoryOptionCombo categoryOptionCombo;

private IdSchemes idSchemes = new IdSchemes();

private boolean includeRelationships;

/**
Expand Down Expand Up @@ -376,15 +373,6 @@ public EventQueryParams setEnrollmentOccurredAfter(Date enrollmentOccurredAfter)
return this;
}

public IdSchemes getIdSchemes() {
return idSchemes;
}

public EventQueryParams setIdSchemes(IdSchemes idSchemes) {
this.idSchemes = idSchemes;
return this;
}

public boolean isIncludeAttributes() {
return includeAttributes;
}
Expand Down Expand Up @@ -560,7 +548,7 @@ public boolean isOrganisationUnitMode(OrganisationUnitSelectionMode mode) {

public boolean isPathOrganisationUnitMode() {
return orgUnitMode != null
&& (orgUnitMode.equals(OrganisationUnitSelectionMode.DESCENDANTS)
|| orgUnitMode.equals(OrganisationUnitSelectionMode.CHILDREN));
&& (OrganisationUnitSelectionMode.DESCENDANTS.equals(orgUnitMode)
|| OrganisationUnitSelectionMode.CHILDREN.equals(orgUnitMode));
}
}
Loading

0 comments on commit 59991d7

Please sign in to comment.