diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..a53efe0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..2da6745
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
new file mode 100644
index 0000000..0ab965c
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_opencsv_opencsv_4_1.xml b/.idea/libraries/Maven__com_opencsv_opencsv_4_1.xml
new file mode 100644
index 0000000..a58c50f
--- /dev/null
+++ b/.idea/libraries/Maven__com_opencsv_opencsv_4_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml b/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml
new file mode 100644
index 0000000..923a940
--- /dev/null
+++ b/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml b/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml
new file mode 100644
index 0000000..a5603ea
--- /dev/null
+++ b/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml
new file mode 100644
index 0000000..d6976a7
--- /dev/null
+++ b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_11.xml b/.idea/libraries/Maven__junit_junit_4_11.xml
new file mode 100644
index 0000000..c388252
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_11.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml b/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml
new file mode 100644
index 0000000..f60ef5f
--- /dev/null
+++ b/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_6.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_6.xml
new file mode 100644
index 0000000..8884a46
--- /dev/null
+++ b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_6.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_text_1_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_text_1_1.xml
new file mode 100644
index 0000000..686d8a9
--- /dev/null
+++ b/.idea/libraries/Maven__org_apache_commons_commons_text_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
new file mode 100644
index 0000000..e5d35d8
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..08c6a01
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..fce6030
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/sonarlint/issuestore/0/7/073972ab08e432737e5cbd2b9d728d3d6a72b8d7 b/.idea/sonarlint/issuestore/0/7/073972ab08e432737e5cbd2b9d728d3d6a72b8d7
new file mode 100644
index 0000000..2fc2ab2
--- /dev/null
+++ b/.idea/sonarlint/issuestore/0/7/073972ab08e432737e5cbd2b9d728d3d6a72b8d7
@@ -0,0 +1,2 @@
+
+[squid:UselessImportCheck"+Remove this unused import 'java.awt.Color'.(8.
\ No newline at end of file
diff --git a/.idea/sonarlint/issuestore/2/5/25754023f3c015aaf67e6a3109e048fca82fa6a7 b/.idea/sonarlint/issuestore/2/5/25754023f3c015aaf67e6a3109e048fca82fa6a7
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/sonarlint/issuestore/3/6/36a23ade6045cc81bf42bf76aecf1a0618d7c779 b/.idea/sonarlint/issuestore/3/6/36a23ade6045cc81bf42bf76aecf1a0618d7c779
new file mode 100644
index 0000000..728563a
--- /dev/null
+++ b/.idea/sonarlint/issuestore/3/6/36a23ade6045cc81bf42bf76aecf1a0618d7c779
@@ -0,0 +1,5 @@
+
+nsquid:CommentedOutCodeLine."
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..db3f670
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,360 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Borderlayo
+ status
+ getAccountList
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1569899713734
+
+
+ 1569899713734
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/auth0-csv.iml b/auth0-csv.iml
new file mode 100644
index 0000000..9b08898
--- /dev/null
+++ b/auth0-csv.iml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..2a35878
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,131 @@
+
+
+
+ 4.0.0
+
+ com.auth.trf
+ auth0-csv
+ 1.0-SNAPSHOT
+
+ auth0-csv
+
+ http://www.example.com
+
+
+ UTF-8
+ 1.7
+ 1.7
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+ com.opencsv
+ opencsv
+ 4.1
+
+
+
+ com.google.code.gson
+ gson
+ 2.8.5
+
+
+
+ org.apache.commons
+ commons-collections4
+ 4.4
+
+
+
+
+ auth0-csv
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+ maven-resources-plugin
+ 3.0.2
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+ utf8
+
+ 1.8
+
+
+
+ maven-surefire-plugin
+ 2.22.1
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ com.auth0.trf.Main
+
+
+
+
+
+ maven-assembly-plugin
+
+
+
+ com.auth0.trf.Main
+
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.5.1
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+
+ maven-site-plugin
+ 3.7.1
+
+
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+
+
diff --git a/src/main/java/com/auth0/trf/Main.java b/src/main/java/com/auth0/trf/Main.java
new file mode 100644
index 0000000..a50a843
--- /dev/null
+++ b/src/main/java/com/auth0/trf/Main.java
@@ -0,0 +1,25 @@
+package com.auth0.trf;
+
+import com.auth0.trf.swing.ui.MainFrame;
+
+import javax.swing.JFrame;
+import java.awt.Color;
+
+/**
+ * Hello world!
+ *
+ */
+public class Main
+{
+ public static void run(JFrame frame) {
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(500,165);
+ frame.setResizable(false);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ public static void main( String[] args ) {
+ run(new MainFrame());
+ }
+}
diff --git a/src/main/java/com/auth0/trf/model/dto/AppMetadataInfoDto.java b/src/main/java/com/auth0/trf/model/dto/AppMetadataInfoDto.java
new file mode 100644
index 0000000..69a676d
--- /dev/null
+++ b/src/main/java/com/auth0/trf/model/dto/AppMetadataInfoDto.java
@@ -0,0 +1,34 @@
+package com.auth0.trf.model.dto;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+public class AppMetadataInfoDto {
+
+ @SerializedName("organisation_id")
+ @Expose()
+ private int organisationId;
+
+ @SerializedName("roles")
+ @Expose()
+ private List roleDtoList;
+
+ public int getOrganisationId() {
+ return organisationId;
+ }
+
+ public void setOrganisationId(int organisationId) {
+ this.organisationId = organisationId;
+ }
+
+ public List getRoleDtoList() {
+ return roleDtoList;
+ }
+
+ public void setRoleDtoList(List roleDtoList) {
+ this.roleDtoList = roleDtoList;
+ }
+
+}
diff --git a/src/main/java/com/auth0/trf/model/dto/RoleDto.java b/src/main/java/com/auth0/trf/model/dto/RoleDto.java
new file mode 100644
index 0000000..2959c2d
--- /dev/null
+++ b/src/main/java/com/auth0/trf/model/dto/RoleDto.java
@@ -0,0 +1,19 @@
+package com.auth0.trf.model.dto;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class RoleDto {
+
+ @SerializedName("role_name")
+ @Expose()
+ private String roleName;
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+}
diff --git a/src/main/java/com/auth0/trf/model/dto/UserDto.java b/src/main/java/com/auth0/trf/model/dto/UserDto.java
new file mode 100644
index 0000000..323647c
--- /dev/null
+++ b/src/main/java/com/auth0/trf/model/dto/UserDto.java
@@ -0,0 +1,165 @@
+package com.auth0.trf.model.dto;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import java.sql.Timestamp;
+
+public class UserDto {
+
+ @SerializedName("sub")
+ @Expose(serialize = false)
+ private String sub;
+
+ @SerializedName("user_id")
+ @Expose(serialize = false)
+ private String userId;
+
+ @SerializedName("family_name")
+ @Expose()
+ private String familyName;
+
+ @SerializedName("given_name")
+ @Expose()
+ private String givenName;
+
+ @SerializedName("name")
+ @Expose()
+ private String name;
+
+ @SerializedName("password")
+ @Expose()
+ private String password;
+
+ @SerializedName("picture")
+ @Expose(serialize = false)
+ private String picture;
+
+ @SerializedName("email")
+ @Expose()
+ private String email;
+
+ @SerializedName("last_login")
+ @Expose(serialize = false)
+ private Timestamp lastLogin;
+
+ @SerializedName("user_metadata")
+ @Expose()
+ private UserMetadataInfoDto userMetadataInfoDto;
+
+ @SerializedName("app_metadata")
+ @Expose()
+ private AppMetadataInfoDto appMetadataInfoDto;
+
+ @SerializedName("connection")
+ @Expose()
+ private String connection;
+
+ @SerializedName("client_id")
+ @Expose()
+ private String clientId;
+
+ public String getSub() {
+ return sub;
+ }
+
+ public void setSub(String sub) {
+ this.sub = sub;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getFamilyName() {
+ return familyName;
+ }
+
+ public void setFamilyName(String familyName) {
+ this.familyName = familyName;
+ }
+
+ public String getGivenName() {
+ return givenName;
+ }
+
+ public void setGivenName(String givenName) {
+ this.givenName = givenName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getPicture() {
+ return picture;
+ }
+
+ public void setPicture(String picture) {
+ this.picture = picture;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Timestamp getLastLogin() {
+ return lastLogin;
+ }
+
+ public void setLastLogin(Timestamp lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
+ public UserMetadataInfoDto getUserMetadataInfoDto() {
+ return userMetadataInfoDto;
+ }
+
+ public void setUserMetadataInfoDto(UserMetadataInfoDto userMetadataInfoDto) {
+ this.userMetadataInfoDto = userMetadataInfoDto;
+ }
+
+ public AppMetadataInfoDto getAppMetadataInfoDto() {
+ return appMetadataInfoDto;
+ }
+
+ public void setAppMetadataInfoDto(AppMetadataInfoDto appMetadataInfoDto) {
+ this.appMetadataInfoDto = appMetadataInfoDto;
+ }
+
+ public String getConnection() {
+ return connection;
+ }
+
+ public void setConnection(String connection) {
+ this.connection = connection;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+}
diff --git a/src/main/java/com/auth0/trf/model/dto/UserMetadataInfoDto.java b/src/main/java/com/auth0/trf/model/dto/UserMetadataInfoDto.java
new file mode 100644
index 0000000..60acaca
--- /dev/null
+++ b/src/main/java/com/auth0/trf/model/dto/UserMetadataInfoDto.java
@@ -0,0 +1,44 @@
+package com.auth0.trf.model.dto;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class UserMetadataInfoDto {
+
+ @SerializedName("title")
+ @Expose()
+ private String title;
+
+ @SerializedName("phone_number")
+ @Expose()
+ private String phoneNumber;
+
+ @SerializedName("fax")
+ @Expose()
+ private String fax;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+
+ public String getFax() {
+ return fax;
+ }
+
+ public void setFax(String fax) {
+ this.fax = fax;
+ }
+
+}
diff --git a/src/main/java/com/auth0/trf/swing/ui/MainFrame.java b/src/main/java/com/auth0/trf/swing/ui/MainFrame.java
new file mode 100644
index 0000000..cf56093
--- /dev/null
+++ b/src/main/java/com/auth0/trf/swing/ui/MainFrame.java
@@ -0,0 +1,135 @@
+package com.auth0.trf.swing.ui;
+
+import com.auth0.trf.model.dto.UserDto;
+import com.auth0.trf.util.AuthUtil;
+import com.auth0.trf.util.CommonUtil;
+
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MainFrame extends JFrame {
+ JTextField fileName = new JTextField();
+ JLabel status = new JLabel("Please don't exit the application while in progress. This will take a few minutes.");
+ JTextField connectionName = new JTextField("IELTSDatabase-???");
+
+ public MainFrame() {
+ this.setTitle("Auth0-CSV Account Generator");
+ JPanel topPanel = new JPanel();
+ topPanel.setBackground(new Color(184,0,54));
+
+ JPanel centerPanel = new JPanel();
+ centerPanel.setBackground(Color.WHITE);
+
+ JPanel topCenter = new JPanel();
+ topCenter.setBackground(Color.WHITE);
+
+ JPanel bottomCenter = new JPanel();
+ bottomCenter.setBackground(Color.WHITE);
+ JPanel statusBar = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ statusBar.setBackground(new Color(184,0,54));
+// statusBar.setBorder(
+// new CompoundBorder(
+// new LineBorder(Color.DARK_GRAY),
+// new EmptyBorder(4, 4, 4, 4)));
+
+ JLabel title = new JLabel("This application will generate a folder containing accounts in your Desktop.");
+ title.setFont(new Font("Calibri", Font.BOLD, 13));
+ title.setForeground(Color.WHITE);
+ topPanel.add(title);
+
+ status.setForeground(Color.WHITE);
+ status.setFont(new Font("Calibri", Font.BOLD, 12));
+ statusBar.add(status);
+
+ fileName.setEditable(false);
+ fileName.setPreferredSize(new Dimension( 200, 24 ) );
+ topCenter.add(fileName);
+ JButton findFileButton = new JButton("Open");
+ findFileButton.setBackground(new Color(184, 0, 54));
+ findFileButton.setForeground(Color.WHITE);
+ findFileButton.setFocusPainted(false);
+ findFileButton.setFont(new Font("Calibri", Font.BOLD, 13));
+ findFileButton.addActionListener(new OpenFile());
+ topCenter.add(findFileButton);
+
+ JButton generateButton = new JButton("Generate");
+ generateButton.setBackground(new Color(184, 0, 54));
+ generateButton.setForeground(Color.WHITE);
+ generateButton.setFocusPainted(false);
+ generateButton.setFont(new Font("Calibri", Font.BOLD, 13));
+ generateButton.addActionListener(new GenerateFile());
+ topCenter.add(generateButton);
+
+ JLabel jLabel = new JLabel("Auth0 Connection:");
+ jLabel.setFont(new Font("Calibri", Font.BOLD, 14));
+
+ connectionName.setFont(new Font("Calibri", Font.BOLD, 12));
+ connectionName.setPreferredSize(new Dimension(253, 24));
+ bottomCenter.add(jLabel);
+ bottomCenter.add(connectionName);
+
+
+ centerPanel.add(BorderLayout.NORTH, topCenter);
+ centerPanel.add(BorderLayout.CENTER, bottomCenter);
+
+
+ this.add(BorderLayout.NORTH, topPanel);
+ this.add(BorderLayout.CENTER, centerPanel);
+ this.add(BorderLayout.SOUTH, statusBar);
+ this.pack();
+ }
+
+ private class GenerateFile implements ActionListener {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ status.setText("Reading CSV Document...");
+ AuthUtil authUtil = new AuthUtil();
+ List userDtoList = authUtil.getAccountList(fileName.getText(), connectionName.getText());
+ if (userDtoList != null && !userDtoList.isEmpty()) {
+ status.setText("Generating account list...");
+ List> partitionList = authUtil.partitionAccountList(userDtoList);
+ List accountList = new ArrayList<>();
+ for (List userDtos : partitionList) {
+ String jsonQuery = CommonUtil.toMinifyJson(userDtos);
+ accountList.add(jsonQuery);
+ }
+ int result = CommonUtil.generateFiles(accountList);
+ status.setText("Files generated: " + result);
+ } else {
+ status.setText("Unable to generate account list...");
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private class OpenFile implements ActionListener {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser jFileChooser = new JFileChooser();
+ int rVal = jFileChooser.showSaveDialog(MainFrame.this);
+ if (rVal == JFileChooser.APPROVE_OPTION) {
+ fileName.setText(jFileChooser.getCurrentDirectory().toString() + "/" + jFileChooser.getSelectedFile().getName());
+ }
+
+ if (rVal == JFileChooser.CANCEL_OPTION) {
+ fileName.setText("");
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/trf/util/AuthUtil.java b/src/main/java/com/auth0/trf/util/AuthUtil.java
new file mode 100644
index 0000000..5d6a6f4
--- /dev/null
+++ b/src/main/java/com/auth0/trf/util/AuthUtil.java
@@ -0,0 +1,82 @@
+package com.auth0.trf.util;
+
+import com.auth0.trf.model.dto.AppMetadataInfoDto;
+import com.auth0.trf.model.dto.RoleDto;
+import com.auth0.trf.model.dto.UserDto;
+import com.auth0.trf.model.dto.UserMetadataInfoDto;
+import com.opencsv.CSVReader;
+import org.apache.commons.collections4.ListUtils;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AuthUtil {
+ private static final int maxSize = 2000;
+ private static final String AUTH0_CONNECTION = "IELTSDatabase";
+ private static final String GENERAL_PASSWORD = "CH4NG3P4SSW0RD!";
+
+ public List getAccountList(String filename, String connection) {
+ try {
+ FileInputStream fis = new FileInputStream(filename);
+ InputStreamReader isr = new InputStreamReader(fis,
+ StandardCharsets.UTF_8);
+ CSVReader reader = new CSVReader(isr);
+
+ List rows = reader.readAll();
+ List userDtoList = new ArrayList<>();
+ rows.remove(0);
+ for (String[] row: rows) {
+ UserDto userDtoTest = userDtoList.stream()
+ .filter(user -> user.getUserId().equals(row[0]))
+ .findFirst().orElse(null);
+ if (userDtoTest != null) {
+ RoleDto roleDto = new RoleDto();
+ roleDto.setRoleName(row[10]);
+ userDtoTest.getAppMetadataInfoDto().getRoleDtoList().add(roleDto);
+ } else {
+ UserDto userDto = new UserDto();
+ userDto.setConnection(connection);
+ userDto.setPassword(GENERAL_PASSWORD);
+ userDto.setUserId(row[0]);
+ userDto.setGivenName(row[2]);
+ userDto.setFamilyName(row[3]);
+ userDto.setName(row[2] + " " + row[3]);
+ userDto.setEmail(row[4]);
+
+ List roleDtoList = new ArrayList<>();
+ RoleDto roleDto = new RoleDto();
+ roleDto.setRoleName(row[10]);
+ roleDtoList.add(roleDto);
+
+ AppMetadataInfoDto appMetadataInfoDto = new AppMetadataInfoDto();
+ appMetadataInfoDto.setRoleDtoList(roleDtoList);
+ appMetadataInfoDto.setOrganisationId(Integer.parseInt(row[8]));
+
+ UserMetadataInfoDto userMetadataInfoDto = new UserMetadataInfoDto();
+ userMetadataInfoDto.setTitle(row[1]);
+ userMetadataInfoDto.setPhoneNumber(row[5]);
+ userMetadataInfoDto.setFax(row[6]);
+
+ userDto.setAppMetadataInfoDto(appMetadataInfoDto);
+ userDto.setUserMetadataInfoDto(userMetadataInfoDto);
+
+ userDtoList.add(userDto);
+ }
+ }
+
+ System.out.println(userDtoList.size());
+ return userDtoList;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ public List> partitionAccountList(List userDtoList) {
+ List> partitionList = ListUtils.partition(userDtoList, this.maxSize);
+ return partitionList;
+ }
+}
diff --git a/src/main/java/com/auth0/trf/util/CommonUtil.java b/src/main/java/com/auth0/trf/util/CommonUtil.java
new file mode 100644
index 0000000..26cc2ac
--- /dev/null
+++ b/src/main/java/com/auth0/trf/util/CommonUtil.java
@@ -0,0 +1,45 @@
+package com.auth0.trf.util;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+
+public final class CommonUtil {
+ public static final Gson GSON_MINIFY_PRINT = new GsonBuilder()
+ .excludeFieldsWithoutExposeAnnotation()
+ .create();
+ public static final Gson GSON_BEAUTIFY_PRINT = new GsonBuilder()
+ .setPrettyPrinting()
+ .excludeFieldsWithoutExposeAnnotation()
+ .create();
+
+ public static final String PATH = System.getProperty("user.home") + "/Desktop";
+ public static final String DIRECTORY = "/accounts";
+
+ public static final String toMinifyJson(Object object) {
+ return GSON_MINIFY_PRINT.toJson(object);
+ }
+
+ public static final String toBeautifyJson(Object object) {
+ return GSON_BEAUTIFY_PRINT.toJson(object);
+ }
+
+ public static final int generateFiles(List jsonQueries) throws IOException {
+ new File(PATH + DIRECTORY).mkdir();
+ int size = 1;
+ for (String jsonQuery : jsonQueries) {
+ String fileName = "/accounts-" + size + ".json";
+ FileWriter file = new FileWriter(PATH + DIRECTORY + fileName);
+ file.write(jsonQuery);
+ file.close();
+ size++;
+ }
+
+ size--;
+ return size;
+ }
+}
diff --git a/src/test/java/com/auth0/trf/MainTest.java b/src/test/java/com/auth0/trf/MainTest.java
new file mode 100644
index 0000000..d6e0901
--- /dev/null
+++ b/src/test/java/com/auth0/trf/MainTest.java
@@ -0,0 +1,20 @@
+package com.auth0.trf;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple Main.
+ */
+public class MainTest
+{
+ /**
+ * Rigorous Test :-)
+ */
+ @Test
+ public void shouldAnswerWithTrue()
+ {
+ assertTrue( true );
+ }
+}
diff --git a/target/auth0-csv-jar-with-dependencies.jar b/target/auth0-csv-jar-with-dependencies.jar
new file mode 100644
index 0000000..b50f376
Binary files /dev/null and b/target/auth0-csv-jar-with-dependencies.jar differ
diff --git a/target/auth0-csv.jar b/target/auth0-csv.jar
new file mode 100644
index 0000000..dec1f27
Binary files /dev/null and b/target/auth0-csv.jar differ
diff --git a/target/classes/com/auth0/trf/Main.class b/target/classes/com/auth0/trf/Main.class
new file mode 100644
index 0000000..7721da6
Binary files /dev/null and b/target/classes/com/auth0/trf/Main.class differ
diff --git a/target/classes/com/auth0/trf/model/dto/AppMetadataInfoDto.class b/target/classes/com/auth0/trf/model/dto/AppMetadataInfoDto.class
new file mode 100644
index 0000000..c8ba917
Binary files /dev/null and b/target/classes/com/auth0/trf/model/dto/AppMetadataInfoDto.class differ
diff --git a/target/classes/com/auth0/trf/model/dto/RoleDto.class b/target/classes/com/auth0/trf/model/dto/RoleDto.class
new file mode 100644
index 0000000..17267b5
Binary files /dev/null and b/target/classes/com/auth0/trf/model/dto/RoleDto.class differ
diff --git a/target/classes/com/auth0/trf/model/dto/UserDto.class b/target/classes/com/auth0/trf/model/dto/UserDto.class
new file mode 100644
index 0000000..66fb07e
Binary files /dev/null and b/target/classes/com/auth0/trf/model/dto/UserDto.class differ
diff --git a/target/classes/com/auth0/trf/model/dto/UserMetadataInfoDto.class b/target/classes/com/auth0/trf/model/dto/UserMetadataInfoDto.class
new file mode 100644
index 0000000..40ece98
Binary files /dev/null and b/target/classes/com/auth0/trf/model/dto/UserMetadataInfoDto.class differ
diff --git a/target/classes/com/auth0/trf/swing/ui/MainFrame$1.class b/target/classes/com/auth0/trf/swing/ui/MainFrame$1.class
new file mode 100644
index 0000000..f787707
Binary files /dev/null and b/target/classes/com/auth0/trf/swing/ui/MainFrame$1.class differ
diff --git a/target/classes/com/auth0/trf/swing/ui/MainFrame$GenerateFile.class b/target/classes/com/auth0/trf/swing/ui/MainFrame$GenerateFile.class
new file mode 100644
index 0000000..f7800c7
Binary files /dev/null and b/target/classes/com/auth0/trf/swing/ui/MainFrame$GenerateFile.class differ
diff --git a/target/classes/com/auth0/trf/swing/ui/MainFrame$OpenFile.class b/target/classes/com/auth0/trf/swing/ui/MainFrame$OpenFile.class
new file mode 100644
index 0000000..2b35d3c
Binary files /dev/null and b/target/classes/com/auth0/trf/swing/ui/MainFrame$OpenFile.class differ
diff --git a/target/classes/com/auth0/trf/swing/ui/MainFrame.class b/target/classes/com/auth0/trf/swing/ui/MainFrame.class
new file mode 100644
index 0000000..503d634
Binary files /dev/null and b/target/classes/com/auth0/trf/swing/ui/MainFrame.class differ
diff --git a/target/classes/com/auth0/trf/util/AuthUtil.class b/target/classes/com/auth0/trf/util/AuthUtil.class
new file mode 100644
index 0000000..d6605dd
Binary files /dev/null and b/target/classes/com/auth0/trf/util/AuthUtil.class differ
diff --git a/target/classes/com/auth0/trf/util/CommonUtil.class b/target/classes/com/auth0/trf/util/CommonUtil.class
new file mode 100644
index 0000000..791de3c
Binary files /dev/null and b/target/classes/com/auth0/trf/util/CommonUtil.class differ
diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..c912792
--- /dev/null
+++ b/target/maven-archiver/pom.properties
@@ -0,0 +1,4 @@
+#Created by Apache Maven 3.6.0
+version=1.0-SNAPSHOT
+groupId=com.auth.trf
+artifactId=auth0-csv
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..f6ba9ab
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,11 @@
+com\auth0\trf\swing\ui\MainFrame$OpenFile.class
+com\auth0\trf\model\dto\UserMetadataInfoDto.class
+com\auth0\trf\swing\ui\MainFrame.class
+com\auth0\trf\util\AuthUtil.class
+com\auth0\trf\util\CommonUtil.class
+com\auth0\trf\swing\ui\MainFrame$1.class
+com\auth0\trf\swing\ui\MainFrame$GenerateFile.class
+com\auth0\trf\model\dto\RoleDto.class
+com\auth0\trf\model\dto\UserDto.class
+com\auth0\trf\model\dto\AppMetadataInfoDto.class
+com\auth0\trf\Main.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..2a462c4
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,8 @@
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\model\dto\RoleDto.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\swing\ui\MainFrame.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\Main.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\model\dto\AppMetadataInfoDto.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\model\dto\UserMetadataInfoDto.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\model\dto\UserDto.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\util\AuthUtil.java
+C:\Development\git\auth0-csv\src\main\java\com\auth0\trf\util\CommonUtil.java
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..f39e79f
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
@@ -0,0 +1 @@
+com\auth0\trf\MainTest.class
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..0da5f57
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -0,0 +1 @@
+C:\Development\git\auth0-csv\src\test\java\com\auth0\trf\MainTest.java
diff --git a/target/surefire-reports/TEST-com.auth0.trf.MainTest.xml b/target/surefire-reports/TEST-com.auth0.trf.MainTest.xml
new file mode 100644
index 0000000..e3144e8
--- /dev/null
+++ b/target/surefire-reports/TEST-com.auth0.trf.MainTest.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/target/surefire-reports/com.auth0.trf.MainTest.txt b/target/surefire-reports/com.auth0.trf.MainTest.txt
new file mode 100644
index 0000000..d9b2635
--- /dev/null
+++ b/target/surefire-reports/com.auth0.trf.MainTest.txt
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------------------
+Test set: com.auth0.trf.MainTest
+-------------------------------------------------------------------------------
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 s - in com.auth0.trf.MainTest
diff --git a/target/test-classes/com/auth0/trf/MainTest.class b/target/test-classes/com/auth0/trf/MainTest.class
new file mode 100644
index 0000000..2bd078c
Binary files /dev/null and b/target/test-classes/com/auth0/trf/MainTest.class differ