Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
lincmba committed Jul 16, 2024
1 parent 1da65ba commit c288cc6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ following search parameters are available:
- `administrativeLevelMin`: Specifies the minimum administrative level to
include in the response. Locations at this level and above will be included.
- `administrativeLevelMax`: Specifies the maximum administrative level to
include in the response. Locations at this level and below will be included. If not set, it defaults to the value of `DEFAULT_MAX_ADMIN_LEVEL` set in the `Constants.java` file.
include in the response. Locations at this level and below will be included.
If not set, it defaults to the value of `DEFAULT_MAX_ADMIN_LEVEL` set in the
`Constants.java` file.

Behavior based on parameters:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;

import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Composition;
import org.hl7.fhir.r4.model.Location;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartregister.model.location.LocationHierarchy;
import org.smartregister.model.location.LocationHierarchyTree;

import com.google.fhir.gateway.ExceptionUtil;

import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.fhir.gateway.ExceptionUtil;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.api.IGenericClient;
Expand Down Expand Up @@ -67,7 +66,8 @@ public LocationHierarchy getLocationHierarchy(String locationId, List<String> ad
return locationHierarchy;
}

public List<LocationHierarchy> getLocationHierarchies(List<String> locationIds, List<String> adminLevels) {
public List<LocationHierarchy> getLocationHierarchies(
List<String> locationIds, List<String> adminLevels) {
List<LocationHierarchy> locationHierarchies = new ArrayList<>();
for (String locationId : locationIds) {
locationHierarchies.add(getLocationHierarchy(locationId, adminLevels));
Expand Down Expand Up @@ -170,7 +170,7 @@ public Bundle handleIdentifierRequest(HttpServletRequest request, String identif
String administrativeLevelMin = request.getParameter(Constants.MIN_ADMIN_LEVEL);
String administrativeLevelMax = request.getParameter(Constants.MAX_ADMIN_LEVEL);
List<String> adminLevels =
generateAdminLevels(administrativeLevelMin, administrativeLevelMax);
generateAdminLevels(administrativeLevelMin, administrativeLevelMax);
String mode = request.getParameter(Constants.MODE);
if (Constants.LIST.equals(mode)) {
List<String> locationIds = Collections.singletonList(identifier);
Expand All @@ -190,7 +190,7 @@ public Bundle handleNonIdentifierRequest(
String administrativeLevelMin = request.getParameter(Constants.MIN_ADMIN_LEVEL);
String administrativeLevelMax = request.getParameter(Constants.MAX_ADMIN_LEVEL);
List<String> adminLevels =
generateAdminLevels(administrativeLevelMin, administrativeLevelMax);
generateAdminLevels(administrativeLevelMin, administrativeLevelMax);
List<String> selectedSyncLocations = extractSyncLocations(syncLocationsParam);
String practitionerId = verifiedJwt.getSubject();
List<String> userRoles = JwtUtils.getUserRolesFromJWT(verifiedJwt);
Expand Down Expand Up @@ -312,7 +312,7 @@ public Bundle getPaginatedLocations(HttpServletRequest request, List<String> loc
for (String identifier : locationIds) {
Location parentLocation = getLocationById(identifier);
List<Location> locations =
getLocationHierarchyLocations(identifier, parentLocation, adminLevels);
getLocationHierarchyLocations(identifier, parentLocation, adminLevels);
resourceLocations.addAll(locations);
}
int totalEntries = resourceLocations.size();
Expand Down

0 comments on commit c288cc6

Please sign in to comment.