-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 615be01f4d2884a20c462b5e3f7f8bf15d675459)
- Loading branch information
Showing
30 changed files
with
992 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,5 @@ hs_err_pid* | |
target | ||
|
||
.DS_Store | ||
|
||
_mess |
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
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
17 changes: 0 additions & 17 deletions
17
src/main/java/com/evolveum/midpoint/philosopher/GenerateAction.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/java/com/evolveum/midpoint/philosopher/GenerateOptions.java
This file was deleted.
Oops, something went wrong.
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
69 changes: 69 additions & 0 deletions
69
src/main/java/com/evolveum/midpoint/philosopher/generator/ConnectionOptions.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.evolveum.midpoint.philosopher.generator; | ||
|
||
import com.beust.jcommander.Parameter; | ||
import com.beust.jcommander.Parameters; | ||
import com.evolveum.midpoint.philosopher.util.URIConverter; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
@Parameters(resourceBundle = "messages") | ||
public class ConnectionOptions { | ||
|
||
public static final String P_URL = "-U"; | ||
public static final String P_URL_LONG = "--url"; | ||
|
||
public static final String P_USERNAME = "-u"; | ||
public static final String P_USERNAME_LONG = "--username"; | ||
|
||
public static final String P_PASSWORD = "-p"; | ||
public static final String P_PASSWORD_LONG = "--password"; | ||
|
||
public static final String P_ASK_PASSWORD = "-P"; | ||
public static final String P_ASK_PASSWORD_LONG = "--password-ask"; | ||
|
||
@Parameter(names = {P_URL, P_URL_LONG}, validateWith = URIConverter.class, descriptionKey = "connection.url") | ||
private String url; | ||
|
||
@Parameter(names = {P_USERNAME, P_USERNAME_LONG}, descriptionKey = "connection.username") | ||
private String username; | ||
|
||
@Parameter(names = {P_PASSWORD, P_PASSWORD_LONG}, descriptionKey = "connection.password") | ||
private String password; | ||
|
||
@Parameter(names = {P_ASK_PASSWORD, P_ASK_PASSWORD_LONG}, password = true, | ||
descriptionKey = "connection.askPassword") | ||
private String askPassword; | ||
|
||
public String getAskPassword() { | ||
return askPassword; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public void setAskPassword(String askPassword) { | ||
this.askPassword = askPassword; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/evolveum/midpoint/philosopher/generator/ExportFormat.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.evolveum.midpoint.philosopher.generator; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public enum ExportFormat { | ||
|
||
PDF, | ||
|
||
HTML; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/evolveum/midpoint/philosopher/generator/Exporter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.evolveum.midpoint.philosopher.generator; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public interface Exporter { | ||
|
||
void export(File adocFile, File output) throws IOException; | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/evolveum/midpoint/philosopher/generator/GenerateAction.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.evolveum.midpoint.philosopher.generator; | ||
|
||
import com.evolveum.midpoint.client.api.Service; | ||
import com.evolveum.midpoint.client.impl.restjaxb.AuthenticationType; | ||
import com.evolveum.midpoint.client.impl.restjaxb.RestJaxbServiceBuilder; | ||
import com.evolveum.midpoint.philosopher.Action; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class GenerateAction implements Action<GenerateOptions> { | ||
|
||
private GenerateOptions options; | ||
|
||
@Override | ||
public void init(GenerateOptions options) throws Exception { | ||
this.options = options; | ||
} | ||
|
||
@Override | ||
public void execute() throws Exception { | ||
ConnectionOptions con = options.getConnection(); | ||
|
||
String pwd = con.getPassword() != null ? con.getPassword() : con.getAskPassword(); | ||
|
||
Service client = new RestJaxbServiceBuilder() | ||
.url(con.getUrl()) | ||
.username(con.getUsername()) | ||
.password(pwd) | ||
.authentication(AuthenticationType.BASIC) | ||
.build(); | ||
|
||
Generator generator = new Generator(options, client); | ||
generator.generate(); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/com/evolveum/midpoint/philosopher/generator/GenerateOptions.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.evolveum.midpoint.philosopher.generator; | ||
|
||
import com.beust.jcommander.Parameter; | ||
import com.beust.jcommander.Parameters; | ||
import com.beust.jcommander.ParametersDelegate; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
@Parameters(resourceBundle = "messages", commandDescriptionKey = "generate") | ||
public class GenerateOptions { | ||
|
||
public static final String P_EXPORT_FORMAT = "-ef"; | ||
public static final String P_EXPORT_FORMAT_LONG = "--export-format"; | ||
|
||
public static final String P_TEMPLATE = "-t"; | ||
public static final String P_TEMPLATE_LONG = "--template"; | ||
|
||
public static final String P_OUTPUT = "-o"; | ||
public static final String P_OUTPUT_LONG = "--output"; | ||
|
||
@ParametersDelegate | ||
private ConnectionOptions connection; | ||
|
||
@Parameter(names = {P_EXPORT_FORMAT, P_EXPORT_FORMAT_LONG}, descriptionKey = "generate.exportFormat") | ||
private ExportFormat exportFormat; | ||
|
||
@Parameter(names = {P_TEMPLATE, P_TEMPLATE_LONG}, descriptionKey = "generate.template") | ||
private File template; | ||
|
||
@Parameter(names = {P_OUTPUT, P_OUTPUT_LONG}, descriptionKey = "generate.output") | ||
private File output; | ||
|
||
public ConnectionOptions getConnection() { | ||
return connection; | ||
} | ||
|
||
public File getTemplate() { | ||
return template; | ||
} | ||
|
||
public File getOutput() { | ||
return output; | ||
} | ||
|
||
public ExportFormat getExportFormat() { | ||
return exportFormat; | ||
} | ||
|
||
public void setExportFormat(ExportFormat exportFormat) { | ||
this.exportFormat = exportFormat; | ||
} | ||
|
||
public void setConnection(ConnectionOptions connection) { | ||
this.connection = connection; | ||
} | ||
|
||
public void setTemplate(File template) { | ||
this.template = template; | ||
} | ||
|
||
public void setOutput(File output) { | ||
this.output = output; | ||
} | ||
} |
Oops, something went wrong.