From 83cb3a6c2f75126eb8aed8490c62fc27bdef9d6b Mon Sep 17 00:00:00 2001 From: Neil McGlennon Date: Mon, 29 Apr 2024 11:32:46 -0500 Subject: [PATCH] RC 2 Changes --- .gitignore | 2 + LICENSE.txt | 2 +- build.gradle | 7 +++- gradle/wrapper/gradle-wrapper.properties | 7 ++++ .../sailpoint/utils/FileUploadUtility.java | 40 +++++++++---------- ...c8a53f71baf-file-test-entitlement-feed.csv | 1 + ...fbc0c8a53f71baf-file-test-account-feed.csv | 1 + 7 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 src/test/resources/entitlements/f1f3b747be924745afbc0c8a53f71baf-file-test-entitlement-feed.csv create mode 100644 src/test/resources/f1f3b747be924745afbc0c8a53f71baf-file-test-account-feed.csv diff --git a/.gitignore b/.gitignore index 2070218..ecada98 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ hs_err_pid* replay_pid* .DS_Store +/.idea +/.gradle diff --git a/LICENSE.txt b/LICENSE.txt index 3a42989..964635f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 SailPoint +Copyright (c) 2024 SailPoint Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.gradle b/build.gradle index 643a872..9c7ad0b 100644 --- a/build.gradle +++ b/build.gradle @@ -16,8 +16,11 @@ ext { junitVersion = '5.8.2' } -sourceCompatibility = '1.17' -targetCompatibility = '1.17' +sourceCompatibility = '1.11' +targetCompatibility = '1.11' + +compileJava.options.fork = true +compileJava.options.forkOptions.executable = '/opt/homebrew/Cellar/openjdk@11/11.0.23/bin/javac' tasks.withType(JavaCompile) { options.encoding = 'UTF-8' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..b82aa23 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/main/java/sailpoint/utils/FileUploadUtility.java b/src/main/java/sailpoint/utils/FileUploadUtility.java index db913aa..5016e54 100644 --- a/src/main/java/sailpoint/utils/FileUploadUtility.java +++ b/src/main/java/sailpoint/utils/FileUploadUtility.java @@ -38,8 +38,8 @@ public class FileUploadUtility implements Callable { /** * Metadata about the File Upload Utility */ - public static final String ABOUT_DATE = "2024-04-16 16:14 CST"; - public static final String ABOUT_VERSION = "4.0.0"; + public static final String ABOUT_DATE = "2024-04-29 11:07 CST"; + public static final String ABOUT_VERSION = "4.0.0 RC 2"; public static final String ABOUT_LINK = "https://developer.sailpoint.com/discuss/t/file-upload-utility/18181"; /** @@ -61,7 +61,7 @@ public class FileUploadUtility implements Callable { private boolean disableOptimization = false; @Option( names = { "-o", "--objectType" }, description = "File Type; Account or Entitlement Schema. Default: Account" ) - private String objectType = ACCOUNT_AGGREGATION; + private String objectType = DEFAULT_ACCOUNT_AGGREGATION; @Option( names = { "-R", "--recursive" }, description = "Recursively search directories" ) private boolean recursive = false; @@ -112,8 +112,7 @@ public class FileUploadUtility implements Callable { */ private Map sourceReferenceMap = null; - public static final String ACCOUNT_AGGREGATION = "Account"; - public static final String ENTITLEMENT_AGGREGATION = "Entitlement"; + public static final String DEFAULT_ACCOUNT_AGGREGATION = "account"; public FileUploadUtility() { super(); @@ -146,12 +145,7 @@ public static void main( String[] args ) throws Exception { } catch ( UnsupportedClassVersionError ue ) { - System.out.println(""" - Unsupported version of Java: - JVM: ${java.version} (${java.vendor} ${java.vm.name} ${java.vm.version}) - OS: ${os.name} ${os.version} ${os.arch} - - Please upgrade to JDK 17 or higher."""); + System.out.println( "Unsupported version of Java: Please upgrade to JDK 11 or higher." ); } catch ( Exception e ) { @@ -184,7 +178,7 @@ public Integer call() throws Exception { logger.info( String.format("%1$-20s %2$-30s ", " Files:", StringUtils.join( files, ", \n" ) ) ); logger.info( String.format("%1$-20s %2$-30s ", " ObjectType:", objectType ) ); - if ( ACCOUNT_AGGREGATION.equals( objectType ) ) + if ( DEFAULT_ACCOUNT_AGGREGATION.equals( objectType ) ) logger.info( String.format("%1$-20s %2$-30s ", " Optimization:", !disableOptimization ) ); logger.info( String.format("%1$-20s %2$-30s ", " Recursive:", recursive ) ); @@ -235,12 +229,12 @@ public Integer call() throws Exception { Iterator fileIterator = FileUtils.iterateFiles( file, fileExtensions.toArray(String[]::new), recursive ); while ( fileIterator.hasNext() ) { - processFile( fileIterator.next(), objectType ); + processFile( fileIterator.next() ); } } else { logger.info("Analyzing " + objectType + " file: " + file); - processFile( file, objectType ); + processFile( file ); } } } @@ -303,9 +297,9 @@ private void validateParameters() { * Helper Methods */ - private void processFile( File file, String fileType ) { + private void processFile( File file ) { - logger.info( "Analyzing " + fileType + " file: " + file.getName() ); + logger.info( "Analyzing " + objectType + " file: " + file.getName() ); final String sourceId = getSourceReferenceFromFile( file ); @@ -320,15 +314,21 @@ private void processFile( File file, String fileType ) { try { - if ( ACCOUNT_AGGREGATION.equals( fileType ) ) { + /* + * If the objectType is 'account' then we'll aggregate it as an account. This is the default behavior. + */ + if ( DEFAULT_ACCOUNT_AGGREGATION.equalsIgnoreCase( objectType ) ) { logger.debug( "\tFile [" + file.getName() + "]: Submitting Account Aggregation: Source ID[" + sourceId + "], Disable Optimization[" + disableOptimization + "]" ); response = sailPointService.aggregateAccounts(sourceId, disableOptimization, file); - } else if ( ENTITLEMENT_AGGREGATION.equals( fileType ) ) { + /* + * If the objectType is something else then we'll aggregate it as an entitlement. Entitlement aggregations can be many different objectTypes. + */ + } else { - logger.debug( "\tFile [" + file.getName() + "]: Submitting Entitlement Aggregation: Source ID[" + sourceId + "]" ); - response = sailPointService.aggregateEntitlements(sourceId, fileType, file); + logger.debug( "\tFile [" + file.getName() + "]: Submitting Entitlement Aggregation: Source ID[" + sourceId + "], Object Type[" + objectType + "]" ); + response = sailPointService.aggregateEntitlements(sourceId, objectType, file); } diff --git a/src/test/resources/entitlements/f1f3b747be924745afbc0c8a53f71baf-file-test-entitlement-feed.csv b/src/test/resources/entitlements/f1f3b747be924745afbc0c8a53f71baf-file-test-entitlement-feed.csv new file mode 100644 index 0000000..702f09a --- /dev/null +++ b/src/test/resources/entitlements/f1f3b747be924745afbc0c8a53f71baf-file-test-entitlement-feed.csv @@ -0,0 +1 @@ +id,name,displayName,created,description,modified,entitlements,groups,permissions \ No newline at end of file diff --git a/src/test/resources/f1f3b747be924745afbc0c8a53f71baf-file-test-account-feed.csv b/src/test/resources/f1f3b747be924745afbc0c8a53f71baf-file-test-account-feed.csv new file mode 100644 index 0000000..3dcb827 --- /dev/null +++ b/src/test/resources/f1f3b747be924745afbc0c8a53f71baf-file-test-account-feed.csv @@ -0,0 +1 @@ +id,name,givenName,familyName,e-mail,location,manager,groups \ No newline at end of file