added publish-app goal
This commit is contained in:
parent
adb43d46b0
commit
17594dc520
@ -0,0 +1,40 @@
|
||||
package com.inteligr8.maven.aps.modeling.goal;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl;
|
||||
import com.inteligr8.alfresco.activiti.model.AppDefinitionPublishRepresentation;
|
||||
|
||||
@Mojo( name = "publish-app", threadSafe = true )
|
||||
@Component( role = org.apache.maven.plugin.Mojo.class )
|
||||
public class PublishAppGoal extends ApsAppAccessibleGoal {
|
||||
|
||||
@Parameter( property = "aps-model.publish.comment", required = true, defaultValue = "Automated by 'aps-model-maven-plugin'" )
|
||||
protected String comment;
|
||||
|
||||
@Override
|
||||
public void executeEnabled() throws MojoExecutionException, MojoFailureException {
|
||||
Long appId = this.findAppId(false);
|
||||
|
||||
try {
|
||||
this.publishApp(appId);
|
||||
} catch (IOException ie) {
|
||||
throw new MojoExecutionException("The APS App could not be published", ie);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishApp(Long appId) throws IOException, MojoExecutionException {
|
||||
ApsPublicRestApiJerseyImpl api = this.getApsApi();
|
||||
|
||||
AppDefinitionPublishRepresentation appDefPublish = new AppDefinitionPublishRepresentation();
|
||||
appDefPublish.setComment(this.comment);
|
||||
api.getAppDefinitionsApi().publish(appId, appDefPublish);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user