Skip to content

Commit

Permalink
v22.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ithomas-veeva committed Sep 8, 2022
1 parent 09432fc commit 5717255
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 53 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ff3ffd56e996d20e5ece199126deee46
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01ecbcd8b35a6a0a2c7cb789629396c2bd3b2eae
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.veeva.vault.sdk</groupId>
<artifactId>vaultjavasdk-maven-plugin</artifactId>
<version>22.2.1</version>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9422b0ad20582240b06e11c5b7dce04a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6807a2c9129527fa2c3c28c8c3dda40a9709b355
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<groupId>com.veeva.vault.sdk</groupId>
<artifactId>vaultjavasdk-maven-plugin</artifactId>
<versioning>
<release>22.2.0</release>
<release>22.2.1</release>
<versions>
<version>2.0.0</version>
<version>22.2.0</version>
<version>22.2.1</version>
</versions>
<lastUpdated>20220808205458</lastUpdated>
<lastUpdated>20220908182223</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7bd144b7b58d72e0ee59054122812dff
17de451250a6de5ba7b5e108df0a03c4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1f02615d61bcf9f19520f89630467ab09db8c3e6
5f346ee98d64adfcb6be46d6e3e13bf9f602d6de
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.veeva.vault.sdk</groupId>
<artifactId>vaultjavasdk-maven-plugin</artifactId>
<version>22.2.0</version>
<version>22.2.1</version>
<packaging>maven-plugin</packaging>

<name>Vault Java SDK Maven Plugin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.veeva.vault.vapil.api.client.VaultClient;
import com.veeva.vault.vapil.api.client.VaultClientBuilder;
import com.veeva.vault.vapil.api.client.VaultClientId;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -30,10 +31,13 @@ public class BaseMojo extends AbstractMojo {
@Parameter( property = "source" )
protected Source source = new Source();

private static final Logger logger = Logger.getLogger(BaseMojo.class);


@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (vaultClientId == null) {
System.out.println("Initializing Vault Client ID");
logger.info("Initializing Vault Client ID");
vaultClientId = new VaultClientId(
"veeva",
"vault",
Expand All @@ -42,7 +46,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
"mavenPlugin");

if (vaultClient == null) {
System.out.println("Initializing Vault Client");
logger.info("Initializing Vault Client");
VaultClientBuilder vaultClientBuilder = null;
if (password != null && !password.isEmpty()) {
vaultClientBuilder = VaultClientBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.veeva.vault.sdk.vaultapi.vaultjavasdk;

import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.ErrorHandler;
import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.PackageManager;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -14,15 +16,17 @@

@Mojo( name = "clean", requiresProject = false)
public class CleanPlugin extends BaseMojo {
private static final Logger logger = Logger.getLogger(CleanPlugin.class);

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();

if (PackageManager.cleanPackageDirectory()) {
System.out.println("Deployment folder contents deleted.");
logger.info("Deployment folder contents deleted.");
}
else {
System.out.println("Deployment folder contents could not be deleted.");
logger.error("Deployment folder contents could not be deleted.");
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.veeva.vault.sdk.vaultapi.vaultjavasdk;

import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.PackageManager;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -11,7 +12,9 @@

@Mojo( name = "deploy", requiresProject = false)
public class DeployPlugin extends BaseMojo {


private static final Logger logger = Logger.getLogger(DeployPlugin.class);

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();
Expand All @@ -29,7 +32,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
PackageManager.deployPackage(vaultClient, PackageManager.getPackagePath());
}
else {
System.out.println("Cannot deploy package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
logger.error("Cannot deploy package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.veeva.vault.sdk.vaultapi.vaultjavasdk;

import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.PackageManager;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -12,6 +13,9 @@

@Mojo( name = "import", requiresProject = false)
public class ImportPlugin extends BaseMojo {

private static final Logger logger = Logger.getLogger(ImportPlugin.class);

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();
Expand All @@ -30,10 +34,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
PackageManager.importPackage(vaultClient, PackageManager.getPackagePath());
}
else {
System.out.println("Cannot import package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
logger.error("Cannot import package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
}
} else {
System.out.println("Not a valid session. Check the login details in the pom file.");
logger.error("Not a valid session. Check the login details in the pom file.");
}
} catch (SecurityException e) {
// TODO Auto-generated catch block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.veeva.vault.sdk.vaultapi.vaultjavasdk;

import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.PackageManager;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -22,7 +23,10 @@

@Mojo( name = "package", requiresProject = false)
public class PackagePlugin extends BaseMojo {


private static final Logger logger = Logger.getLogger(PackagePlugin.class);


@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();
Expand All @@ -47,15 +51,14 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

try {
System.out.println("");
PackageManager.createXMLFile(username, deploymentOption);
PackageManager.createZipFileArray(filePathArray, deploymentOption);
} catch (IOException e) {
System.out.println("Packaging error:" + e.toString());
logger.error("Packaging error:" + e.toString());
}
}
else {
System.out.println("Invalid Vault Java SDK source directory. The code must be in a top level of 'javasdk/src/main/java' " +
logger.error("Invalid Vault Java SDK source directory. The code must be in a top level of 'javasdk/src/main/java' " +
"or 'src/main/java' structure.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.ErrorHandler;
import com.veeva.vault.sdk.vaultapi.vaultjavasdk.utilities.PackageManager;
import com.veeva.vault.vapil.api.model.response.ValidatePackageResponse;
import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -14,15 +15,18 @@

@Mojo( name = "validate", requiresProject = false)
public class ValidatePlugin extends BaseMojo {


private static final Logger logger = Logger.getLogger(ValidatePlugin.class);


@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();
//Initializes an Authentication API connection.
try {
if (vaultClient.validateSession()) {
//Validates the defined VPK against the specified vault.
System.out.println("Session is valid");
logger.debug("Session is valid");
if (!packageName.equals("")) {
PackageManager.setPackagePath(packageName);
}
Expand All @@ -31,17 +35,17 @@ public void execute() throws MojoExecutionException, MojoFailureException {
ValidatePackageResponse response = PackageManager.validatePackage(vaultClient, PackageManager.getPackagePath());

if (response.isSuccessful()) {
System.out.println("Validation successful");
logger.debug("Validation successful");
} else {
ErrorHandler.logErrors(response);
}

}
else {
System.out.println("Cannot validate package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
logger.error("Cannot validate package. There is no VPK in '<PROJECT_DIRECTORY>/deployment/packages/'.");
}
} else {
System.out.println("Not a valid session. Check the login details in the pom file.");
logger.error("Not a valid session. Check the login details in the pom file.");
}
} catch (SecurityException e) {
// TODO Auto-generated catch block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,43 @@

import com.veeva.vault.vapil.api.model.response.ValidatePackageResponse;
import com.veeva.vault.vapil.api.model.response.VaultResponse;
import org.apache.log4j.Logger;

import java.util.List;
import java.util.Map;

public class ErrorHandler {


private static final Logger logger = Logger.getLogger(ErrorHandler.class);

public static void logErrors(VaultResponse response) throws SecurityException, IllegalArgumentException {

if (response != null) {
if (response.getResponseMessage() != null) {
System.out.println("Response Status: " + response.getResponseStatus());
System.out.println("Response Message: " + response.getResponseMessage());

logger.error("Response Status: " + response.getResponseStatus());
logger.error("Response Message: " + response.getResponseMessage());
} else {
System.out.println("Response Status: " + response.getResponseStatus());
logger.error("Response Status: " + response.getResponseStatus());
}

if (response instanceof ValidatePackageResponse) {
String packageErrors = ((ValidatePackageResponse) response).getResponseDetails().getPackageError();
if (packageErrors != null) {
System.out.println(packageErrors);
logger.error(packageErrors);
} else {
List<String> errors = ((List<Map<String, List<String>>>) ((ValidatePackageResponse) response)
.getResponseDetails().getPackageSteps().get(0).get("validation_errors")).get(0).get("message");
if (packageErrors != null) {
System.out.println("Errors: " + String.join("\n", errors));
logger.error("Errors: " + String.join("\n", errors));
}
}
} else {
if (response.getErrors() != null) {
if (response.getErrors().size() > 0) {
System.out.println("Errors: " + response.getErrors().toString());
logger.error("Errors: " + response.getErrors().toString());
}
} else {
System.out.println("Response: " + response.getResponse());
logger.error("Response: " + response.getResponse());
}
}
}
Expand Down
Loading

0 comments on commit 5717255

Please sign in to comment.