Merge branch 'develop' into stable

This commit is contained in:
Brian Long 2024-03-13 10:44:38 -04:00
commit 997fe3d286
3 changed files with 16 additions and 5 deletions

View File

@ -117,7 +117,8 @@ public abstract class ApsAddressibleGoal extends DisablableGoal {
this.getLog().debug("OAuth Client ID: " + clientCreds.getUsername()); this.getLog().debug("OAuth Client ID: " + clientCreds.getUsername());
config.setOAuthClientId(clientCreds.getUsername()); config.setOAuthClientId(clientCreds.getUsername());
config.setOAuthClientSecret(clientCreds.getPassword()); if (clientCreds.getPassword() != null && clientCreds.getPassword().length() > 0)
config.setOAuthClientSecret(clientCreds.getPassword());
} }
if (oauthCreds != null) { if (oauthCreds != null) {
@ -126,7 +127,8 @@ public abstract class ApsAddressibleGoal extends DisablableGoal {
this.getLog().debug("OAuth Username: " + oauthCreds.getUsername()); this.getLog().debug("OAuth Username: " + oauthCreds.getUsername());
config.setOAuthUsername(oauthCreds.getUsername()); config.setOAuthUsername(oauthCreds.getUsername());
config.setOAuthPassword(oauthCreds.getPassword()); if (oauthCreds.getPassword() != null && oauthCreds.getPassword().length() > 0)
config.setOAuthPassword(oauthCreds.getPassword());
} }
config.setOAuthTokenUrl(this.oauthTokenUrl); config.setOAuthTokenUrl(this.oauthTokenUrl);

View File

@ -16,6 +16,9 @@ package com.inteligr8.maven.aps.modeling.goal;
import java.io.IOException; import java.io.IOException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
@ -24,6 +27,7 @@ import org.codehaus.plexus.component.annotations.Component;
import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl; import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl;
import com.inteligr8.alfresco.activiti.model.AppDefinitionPublishRepresentation; import com.inteligr8.alfresco.activiti.model.AppDefinitionPublishRepresentation;
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
/** /**
* A class that implements an APS Service publish goal. * A class that implements an APS Service publish goal.
@ -63,7 +67,9 @@ public class PublishAppGoal extends ApsAppAddressibleGoal {
this.getLog().info("[DRYRUN]: Publishing app: " + appId); this.getLog().info("[DRYRUN]: Publishing app: " + appId);
} else { } else {
this.getLog().info("Publishing app: " + appId); this.getLog().info("Publishing app: " + appId);
api.getAppDefinitionsApi().publish(appId, appDefPublish); AppDefinitionUpdateResultRepresentation response = api.getAppDefinitionsApi().publish(appId, appDefPublish);
if (Boolean.TRUE.equals(response.getError()))
throw new WebApplicationException(response.getErrorDescription(), Response.Status.PRECONDITION_FAILED);
} }
} }

View File

@ -20,6 +20,9 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
@ -103,7 +106,7 @@ public class UploadAppGoal extends ApsAppAddressibleGoal {
this.getLog().info("Uploading & publishing new APS App: " + this.apsAppName); this.getLog().info("Uploading & publishing new APS App: " + this.apsAppName);
AppDefinitionUpdateResultRepresentation appDefUpdate = api.getAppDefinitionsJerseyApi().publishApp(multipart); AppDefinitionUpdateResultRepresentation appDefUpdate = api.getAppDefinitionsJerseyApi().publishApp(multipart);
if (Boolean.TRUE.equals(appDefUpdate.getError())) if (Boolean.TRUE.equals(appDefUpdate.getError()))
throw new MojoFailureException(appDefUpdate.getErrorDescription()); throw new WebApplicationException(appDefUpdate.getErrorDescription(), Response.Status.PRECONDITION_FAILED);
} }
} else { } else {
if (this.dryRun) { if (this.dryRun) {
@ -121,7 +124,7 @@ public class UploadAppGoal extends ApsAppAddressibleGoal {
this.getLog().info("Uploading, versioning, & publishing APS App: " + this.apsAppName + " (" + appModel.getId() + ")"); this.getLog().info("Uploading, versioning, & publishing APS App: " + this.apsAppName + " (" + appModel.getId() + ")");
AppDefinitionUpdateResultRepresentation appDefUpdate = api.getAppDefinitionsJerseyApi().publishApp(appModel.getId(), multipart); AppDefinitionUpdateResultRepresentation appDefUpdate = api.getAppDefinitionsJerseyApi().publishApp(appModel.getId(), multipart);
if (Boolean.TRUE.equals(appDefUpdate.getError())) if (Boolean.TRUE.equals(appDefUpdate.getError()))
throw new MojoFailureException(appDefUpdate.getErrorDescription()); throw new WebApplicationException(appDefUpdate.getErrorDescription(), Response.Status.PRECONDITION_FAILED);
} }
} else { } else {
if (this.dryRun) { if (this.dryRun) {