Last active
October 20, 2020 15:03
-
-
Save nazar-art/808d97a082cd68fc33ccbfc55b30d652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IotPermission permission = null; | |
// get only valid permissions | |
List<IotPermission> permissions = getValidPermissionsListByPlateNumber(plateNumber); | |
// check if permission is for this carpark | |
boolean isCarparkFound = false; | |
for (IotPermission perm : permissions) { | |
if (carparkId.equals(perm.getCarParkRef())) { | |
isCarparkFound = true; | |
permission = perm; | |
break; | |
} | |
} | |
// check permission for parent carpark | |
if (!isCarparkFound) { | |
Integer parentCarpark = entrance.getGatewayRef().getCarParkRef().getParentCarParkRef(); | |
for (IotPermission perm : permissions) { | |
if (parentCarpark != null && parentCarpark.equals(perm.getCarParkRef())) { | |
permission = perm; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment