Skip to content

Commit

Permalink
make startIndex dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
mifrazmurthaja committed May 28, 2021
1 parent abee3be commit 95db69e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ read -p "Attributes to filter (Optional) (ex: id,username,emails) : " attributes
[ -z "$attributes" ] && { attributes=none; }
read -p "Attributes to exclude (Optional) (ex:groups,emails,name.givenName) : " excludedAttributes
[ -z "$excludedAttributes" ] && { excludedAttributes=none; }
read -p "Start Index(Optional) [1]: " startIndex
[ -z "$startIndex" ] && { startIndex=none; }
read -p "Batch Count (Optional) [100]: " batchCount
[ -z "$batchCount" ] && { batchCount=none; }
read -p "Maximum Count (Optional) [-1]: " maxCount
[ -z "$maxCount" ] && { maxCount=none; }

java -jar $(find . -name "*scim.bulk.user.export.tool*") $host $username $password $csv $attributes $excludedAttributes $batchCount $maxCount
java -jar $(find . -name "*scim.bulk.user.export.tool*") $host $username $password $csv $attributes $excludedAttributes $startIndex $batchCount $maxCount
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ public static void main(String args[]) throws IOException, KeyStoreException,
}

if (!NONE.equals(args[6])) {
count = Integer.parseInt(args[6]);
startIndex = Integer.parseInt(args[6]);
}

if (!NONE.equals(args[7])) {
maxCount = Integer.parseInt(args[7]);
count = Integer.parseInt(args[7]);
}

if (!NONE.equals(args[8])) {
maxCount = Integer.parseInt(args[8]);
}

// Create a get request to retrieve list users from SCIM 2.0
Expand Down Expand Up @@ -143,6 +147,10 @@ public static void main(String args[]) throws IOException, KeyStoreException,
usersArrayNode.add(JSONFlattener.generateFlatJSON(new ObjectMapper().createObjectNode(),
arrayElement, null, Collections.emptySet()));
}
if (arrayNode.size() < count) {
LOGGER.log(Level.INFO, "End of results reached.");
break;
}
} else {
LOGGER.log(Level.INFO, "End of results reached.");
break;
Expand Down

0 comments on commit 95db69e

Please sign in to comment.