Commit c0a940cf authored by Romain Bioteau's avatar Romain Bioteau
Browse files

remove xtext.ui dependencies

parent 70a57843
......@@ -45,7 +45,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.codehaus.groovy;bundle-version="1.8.6",
org.eclipse.jdt.groovy.core,
org.codehaus.groovy.eclipse.codeassist.completion,
org.eclipse.xtext.ui,
org.eclipse.core.databinding.beans;bundle-version="1.2.200",
org.bonitasoft.studio.connectors.model;bundle-version="6.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
......
......@@ -6,7 +6,6 @@ Bundle-Version: 6.4.0.qualifier
Bundle-SymbolicName: org.bonitasoft.studio.condition.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.bonitasoft.studio.condition;visibility:=reexport,
org.eclipse.xtext.ui,
org.eclipse.ui.editors;bundle-version="3.5.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
org.eclipse.xtext.ui.shared,
......@@ -24,7 +23,9 @@ Require-Bundle: org.bonitasoft.studio.condition;visibility:=reexport,
org.bonitasoft.studio.common.repository;bundle-version="1.0.0",
org.eclipse.emf.databinding;bundle-version="1.2.0",
org.eclipse.jface.databinding;bundle-version="1.5.0",
org.bonitasoft.studio.pics;bundle-version="1.0.0"
org.bonitasoft.studio.pics;bundle-version="1.0.0",
org.eclipse.emf.edit,
org.eclipse.xtext.ui
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.bonitasoft.studio.condition.ui.contentassist,org.b
......
......@@ -27,7 +27,6 @@ import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ExpressionHelper;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.condition.conditionModel.ConditionModelPackage;
import org.bonitasoft.studio.condition.conditionModel.Expression_ProcessRef;
import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
......@@ -53,8 +52,8 @@ import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.diagnostics.Severity;
import org.eclipse.xtext.resource.SynchronizedXtextResourceSet;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.util.StringInputStream;
import org.eclipse.xtext.validation.CheckMode;
import org.eclipse.xtext.validation.IResourceValidator;
......@@ -83,8 +82,7 @@ public class ComparisonExpressionValidator implements IExpressionValidator {
}
final Injector injector = ConditionModelActivator.getInstance().getInjector(ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
final IResourceValidator xtextResourceChecker = injector.getInstance(IResourceValidator.class);
final XtextResourceSetProvider xtextResourceSetProvider = injector.getInstance(XtextResourceSetProvider.class);
final ResourceSet resourceSet = xtextResourceSetProvider.get(RepositoryManager.getInstance().getCurrentRepository().getProject());
final ResourceSet resourceSet = new SynchronizedXtextResourceSet();
final XtextResource resource = (XtextResource) resourceSet.createResource(URI.createURI("somefile.cmodel"));
final Map<String, String> options = new HashMap<String, String>();
options.put(XtextResource.OPTION_ENCODING, "UTF-8");
......
......@@ -31,7 +31,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.databinding.property;bundle-version="1.4.0",
org.eclipse.emf.databinding.edit,
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.4.2",
org.eclipse.xtext.ui,
org.eclipse.wst.xml.ui;bundle-version="1.1.202",
org.eclipse.wst.xml.core;bundle-version="1.1.602",
org.junit;bundle-version="4.11.0";resolution:=optional,
......
......@@ -19,7 +19,7 @@ package org.bonitasoft.studio.data.ui.property.section;
import static org.bonitasoft.studio.common.Messages.removalConfirmationDialogTitle;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -87,7 +87,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.eclipse.xtext.ui.XtextProjectHelper;
/**
*
......@@ -113,6 +112,8 @@ public abstract class AbstractDataSection extends AbstractBonitaDescriptionSecti
private boolean isOverviewContext = false;
private static final String XTEXT_BUILDER_ID = "org.eclipse.xtext.ui.shared.xtextBuilder";
/*
* (non-Javadoc)
* @see
......@@ -219,9 +220,6 @@ public abstract class AbstractDataSection extends AbstractBonitaDescriptionSecti
try {
if (op.canExecute()) {
service.run(true, false, op);
// if (!op.isCancelled()) {
// getEditingDomain().getCommandStack().execute(DeleteCommand.create(getEditingDomain(), d));
// }
}
} catch (final InvocationTargetException e) {
BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID);
......@@ -230,7 +228,7 @@ public abstract class AbstractDataSection extends AbstractBonitaDescriptionSecti
}
try {
RepositoryManager.getInstance().getCurrentRepository().getProject()
.build(IncrementalProjectBuilder.FULL_BUILD, XtextProjectHelper.BUILDER_ID, new HashMap<String, String>(), null);
.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String> emptyMap(), null);
} catch (final CoreException e) {
BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID);
}
......
......@@ -44,7 +44,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.xtext.ui.XtextProjectHelper;
/**
* @author Romain Bioteau
......@@ -75,6 +74,8 @@ public class DataWizard extends Wizard implements IBonitaVariableContext {
private boolean isOverviewContext = false;
private static final String XTEXT_BUILDER_ID = "org.eclipse.xtext.ui.shared.xtextBuilder";
public DataWizard(final TransactionalEditingDomain editingDomain, final EObject container, final EStructuralFeature dataContainmentFeature,
final Set<EStructuralFeature> featureToCheckForUniqueID,
final boolean showAutogenerateForm) {
......@@ -191,7 +192,7 @@ public class DataWizard extends Wizard implements IBonitaVariableContext {
protected void refreshXtextReferences() {
try {
RepositoryManager.getInstance().getCurrentRepository().getProject()
.build(IncrementalProjectBuilder.FULL_BUILD, XtextProjectHelper.BUILDER_ID, Collections.<String, String> emptyMap(), null);
.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String> emptyMap(), null);
} catch (final CoreException e) {
BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID);
}
......
......@@ -24,14 +24,12 @@ Require-Bundle: org.eclipse.ui,
org.bonitasoft.studio.data,
org.bonitasoft.studio.common,
org.bonitasoft.studio.common.repository,
org.eclipse.xtext.ui;bundle-version="2.3.1",
org.bonitasoft.studio.refactoring;bundle-version="6.4.0",
org.junit;bundle-version="4.11.0";resolution:=optional,
org.bonitasoft.studio.tests-utils;resolution:=optional,
assertj-core;bundle-version="1.5.0";resolution:=optional,
org.bonitasoft.studio.model.edit.custom,
org.bonitasoft.studio.model.edit;bundle-version="6.4.0",
org.fest-assert;bundle-version="1.4.2",
org.mockito;bundle-version="1.9.5";resolution:=optional
Bundle-Localization: plugin
Import-Package: org.bonitasoft.engine.bpm.document,
......
......@@ -14,7 +14,7 @@
*/
package org.bonitasoft.studio.document.ui;
import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
......
......@@ -39,7 +39,6 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.xtext.ui.XtextProjectHelper;
public class DocumentWizard extends Wizard {
......@@ -48,6 +47,8 @@ public class DocumentWizard extends Wizard {
private final boolean editMode;
private final EObject context;
private static final String XTEXT_BUILDER_ID = "org.eclipse.xtext.ui.shared.xtextBuilder";
public DocumentWizard(final EObject context) {
super();
this.context = context;
......@@ -146,7 +147,7 @@ public class DocumentWizard extends Wizard {
private void refreshProject() {
try {
RepositoryManager.getInstance().getCurrentRepository().getProject()
.build(IncrementalProjectBuilder.FULL_BUILD, XtextProjectHelper.BUILDER_ID, Collections.<String, String> emptyMap(), null);
.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, Collections.<String, String> emptyMap(), null);
} catch (final CoreException e1) {
BonitaStudioLog.error(e1, DocumentPlugin.PLUGIN_ID);
}
......
......@@ -17,31 +17,27 @@ Require-Bundle: org.bonitasoft.studio.model;bundle-version="1.0.0",
org.bonitasoft.studio.profiles;bundle-version="1.0.0",
org.bonitasoft.studio.diagram.custom;bundle-version="1.0.0",
org.bonitasoft.studio.decision.core;bundle-version="1.0.0",
org.eclipse.core.databinding;bundle-version="1.4.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
org.eclipse.jface.databinding;bundle-version="1.5.0",
org.eclipse.emf.edit.ui;bundle-version="2.7.0",
org.bonitasoft.studio.connectors.model.edit;bundle-version="1.0.0",
org.eclipse.wst.server.core;bundle-version="1.1.303",
org.eclipse.jst.server.tomcat.core;bundle-version="1.1.301",
org.eclipse.debug.ui;bundle-version="3.7.101",
org.eclipse.core.databinding.property;bundle-version="1.4.0",
org.eclipse.gmf.runtime.diagram.ui.render,
org.bonitasoft.studio.repository.themes;bundle-version="1.0.0",
org.eclipse.jdt.launching;bundle-version="3.6.1",
org.bonitasoft.studio.condition;bundle-version="1.0.0",
org.bonitasoft.studio.condition.ui;bundle-version="1.0.0",
org.eclipse.xtext.ui;bundle-version="2.3.1",
org.bonitasoft.studio.xml;bundle-version="6.0.0",
org.eclipse.ui.browser;bundle-version="3.3.101",
org.eclipse.core.expressions,
org.junit;bundle-version="4.11.0";resolution:=optional,
org.mockito;bundle-version="1.9.5";resolution:=optional,
assertj-core;bundle-version="1.5.0";resolution:=optional,
org.bonitasoft.studio.expression.editor,
org.bonitasoft.studio.groovy,
org.bonitasoft.studio.data,
org.bonitasoft.studio.tests-utils;bundle-version="6.4.0";resolution:=optional
org.bonitasoft.studio.tests-utils;bundle-version="6.4.0";resolution:=optional,
org.eclipse.core.databinding.property;bundle-version="1.4.200",
org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.7.0",
org.eclipse.emf.edit.ui,
org.eclipse.jdt.core
Export-Package: org.bonitasoft.studio.engine,
org.bonitasoft.studio.engine.command,
org.bonitasoft.studio.engine.config,
......@@ -69,6 +65,5 @@ Import-Package: org.bonitasoft.engine.api,
org.bonitasoft.engine.expression,
org.bonitasoft.engine.operation,
org.bonitasoft.engine.platform,
org.bonitasoft.engine.session,
org.bonitasoft.forms.server.accessor.impl.util
org.bonitasoft.engine.session
......@@ -27,7 +27,6 @@ import org.bonitasoft.engine.expression.InvalidExpressionException;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
import org.bonitasoft.studio.condition.conditionModel.Operation_NotUnary;
import org.bonitasoft.studio.condition.conditionModel.Unary_Operation;
......@@ -38,11 +37,12 @@ import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.parameter.Parameter;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.Data;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.resource.SynchronizedXtextResourceSet;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.util.StringInputStream;
import org.eclipse.xtext.validation.CheckMode;
import org.eclipse.xtext.validation.IResourceValidator;
......@@ -113,8 +113,7 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
final Injector injector = ConditionModelActivator.getInstance().getInjector(
ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
final IResourceValidator xtextResourceChecker = injector.getInstance(IResourceValidator.class);
final XtextResourceSetProvider xtextResourceSetProvider = injector.getInstance(XtextResourceSetProvider.class);
final ResourceSet resourceSet = xtextResourceSetProvider.get(RepositoryManager.getInstance().getCurrentRepository().getProject());
final XtextResourceSet resourceSet = new SynchronizedXtextResourceSet();
final XtextResource resource = (XtextResource) resourceSet.createResource(URI.createURI("somefile.cmodel"));
try {
resource.load(new StringInputStream(content, "UTF-8"), Collections.emptyMap());
......@@ -123,6 +122,10 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
} catch (final IOException e1) {
BonitaStudioLog.error(e1);
}
final EList<EObject> contents = resource.getContents();
if (contents.isEmpty()) {
return null;
}
final ConditionModelGlobalScopeProvider globalScopeProvider = injector.getInstance(ConditionModelGlobalScopeProvider.class);
final List<String> accessibleObjects = new ArrayList<String>();
for (final Data d : ModelHelper.getAccessibleData(context)) {
......
......@@ -80,24 +80,24 @@ public class DeployProcessOperation {
processIdsMap = new HashMap<AbstractProcess, Long>();
}
public void setObjectToExclude(Set<EObject> excludedObject) {
public void setObjectToExclude(final Set<EObject> excludedObject) {
this.excludedObject = excludedObject;
}
public void addProcessToDeploy(AbstractProcess process) {
public void addProcessToDeploy(final AbstractProcess process) {
Assert.isTrue(!(process instanceof MainProcess), "process can't be a MainProcess");
if (!processes.contains(process)) {
processes.add(process);
}
}
public void setConfigurationId(String configurationId) {
public void setConfigurationId(final String configurationId) {
this.configurationId = configurationId;
}
public URL getUrlFor(AbstractProcess process, IProgressMonitor monitor) throws MalformedURLException, UnsupportedEncodingException, URISyntaxException {
public URL getUrlFor(final AbstractProcess process, final IProgressMonitor monitor) throws MalformedURLException, UnsupportedEncodingException, URISyntaxException {
long pId = 0;
for (AbstractProcess p : processIdsMap.keySet()) {
for (final AbstractProcess p : processIdsMap.keySet()) {
if (p.getName().equals(process.getName()) && p.getVersion().equals(process.getVersion())) {
pId = processIdsMap.get(p);
}
......@@ -105,11 +105,11 @@ public class DeployProcessOperation {
return new ApplicationURLBuilder(process, pId, configurationId).toURL(monitor);
}
public IStatus run(IProgressMonitor monitor) {
public IStatus run(final IProgressMonitor monitor) {
Assert.isTrue(!processes.isEmpty());
try {
undeploy(monitor);
} catch (Exception e) {
} catch (final Exception e) {
BonitaStudioLog.error(e, EnginePlugin.PLUGIN_ID);
return new Status(Status.ERROR, EnginePlugin.PLUGIN_ID, Messages.undeploymentFailedMessage, e);
}
......@@ -119,18 +119,18 @@ public class DeployProcessOperation {
status = enable(monitor);
}
return status;
} catch (Exception e) {
} catch (final Exception e) {
BonitaStudioLog.error(e);
return new Status(Status.ERROR, EnginePlugin.PLUGIN_ID, Messages.deploymentFailedMessage, e);
}
}
protected APISession createSession(AbstractProcess process, IProgressMonitor monitor) throws Exception {
Configuration configuration = BarExporter.getInstance().getConfiguration(process, configurationId);
protected APISession createSession(final AbstractProcess process, final IProgressMonitor monitor) throws Exception {
final Configuration configuration = BarExporter.getInstance().getConfiguration(process, configurationId);
APISession session;
try {
session = BOSEngineManager.getInstance().loginTenant(configuration.getUsername(), configuration.getPassword(), monitor);
} catch (Exception e1) {
} catch (final Exception e1) {
throw new Exception(Messages.bind(Messages.loginFailed, new String[] { configuration.getUsername(), process.getName(), process.getVersion() }), e1);
}
if (session == null) {
......@@ -139,17 +139,17 @@ public class DeployProcessOperation {
return session;
}
private IStatus enable(IProgressMonitor monitor) {
private IStatus enable(final IProgressMonitor monitor) {
IStatus status = Status.CANCEL_STATUS;
for (Entry<AbstractProcess, Long> entry : processIdsMap.entrySet()) {
AbstractProcess process = entry.getKey();
for (final Entry<AbstractProcess, Long> entry : processIdsMap.entrySet()) {
final AbstractProcess process = entry.getKey();
monitor.subTask(Messages.bind(Messages.enablingProcess, getProcessLabel(process)));
try {
status = enableProcess(process, monitor);
if (!status.isOK()) {
return status;
}
} catch (Exception e) {
} catch (final Exception e) {
return new Status(IStatus.ERROR, EnginePlugin.PLUGIN_ID, e.getMessage(), e);
}
......@@ -157,16 +157,16 @@ public class DeployProcessOperation {
return status;
}
protected IStatus deploy(IProgressMonitor monitor) {
protected IStatus deploy(final IProgressMonitor monitor) {
try {
IStatus status = Status.OK_STATUS;
for (AbstractProcess process : processes) {
for (final AbstractProcess process : processes) {
status = deployProcess(process, monitor);
if (status.getSeverity() != IStatus.OK) {
return status;
}
}
} catch (Exception e) {
} catch (final Exception e) {
BonitaStudioLog.error(e);
if (e.getMessage() != null) {
return new Status(Status.ERROR, EnginePlugin.PLUGIN_ID, e.getMessage(), e);
......@@ -178,22 +178,22 @@ public class DeployProcessOperation {
return Status.OK_STATUS;
}
private IStatus deployProcess(AbstractProcess process, IProgressMonitor monitor) throws Exception {
private IStatus deployProcess(final AbstractProcess process, final IProgressMonitor monitor) throws Exception {
monitor.subTask(Messages.bind(Messages.deployingProcess, getProcessLabel(process)));
BusinessArchive bar = BarExporter.getInstance().createBusinessArchive(process, configurationId, excludedObject);
final BusinessArchive bar = BarExporter.getInstance().createBusinessArchive(process, configurationId, excludedObject);
ProcessDefinition def = null;
APISession session = null;
try {
session = createSession(process, monitor);
final ProcessAPI processApi = BOSEngineManager.getInstance().getProcessAPI(session);
def = processApi.deploy(bar);
} catch (ProcessDeployException e) {
} catch (final ProcessDeployException e) {
if (process != null) {
BonitaStudioLog.log("Error when trying to deploy the process named: " + process.getName());
BonitaStudioLog.error(e, EnginePlugin.PLUGIN_ID);
}
return new Status(IStatus.ERROR, EnginePlugin.PLUGIN_ID, e.getMessage(), e);
} catch (Exception e1) {
} catch (final Exception e1) {
if (process != null) {
BonitaStudioLog.error("Error when trying to deploy the process named: " + process.getName(), EnginePlugin.PLUGIN_ID);
}
......@@ -208,14 +208,14 @@ public class DeployProcessOperation {
return Status.OK_STATUS;
}
protected IStatus enableProcess(final AbstractProcess process, IProgressMonitor monitor) throws Exception {
APISession session = createSession(process, monitor);
protected IStatus enableProcess(final AbstractProcess process, final IProgressMonitor monitor) throws Exception {
final APISession session = createSession(process, monitor);
final ProcessAPI processApi = BOSEngineManager.getInstance().getProcessAPI(session);
Long processDefinitionId = processIdsMap.get(process);
final Long processDefinitionId = processIdsMap.get(process);
try {
processApi.enableProcess(processDefinitionId);
} catch (ProcessEnablementException e) {
List<Problem> processResolutionProblems = processApi.getProcessResolutionProblems(processDefinitionId);
} catch (final ProcessEnablementException e) {
final List<Problem> processResolutionProblems = processApi.getProcessResolutionProblems(processDefinitionId);
IStatus status = openProcessEnablementProblemsDialog(process, processResolutionProblems);
if (status.isOK()) {
undeployProcess(process, monitor);
......@@ -240,25 +240,25 @@ public class DeployProcessOperation {
* @throws DeletingEnabledProcessException
* @throws Exception
*/
protected void undeploy(IProgressMonitor monitor) throws Exception {
for (AbstractProcess process : processes) {
protected void undeploy(final IProgressMonitor monitor) throws Exception {
for (final AbstractProcess process : processes) {
undeployProcess(process, monitor);
}
}
protected void undeployProcess(AbstractProcess process, IProgressMonitor monitor) throws Exception {
protected void undeployProcess(final AbstractProcess process, final IProgressMonitor monitor) throws Exception {
final APISession session = createSession(process, monitor);
try {
final ProcessAPI processApi = BOSEngineManager.getInstance().getProcessAPI(session);
long nbDeployedProcesses = processApi.getNumberOfProcessDeploymentInfos();
final long nbDeployedProcesses = processApi.getNumberOfProcessDeploymentInfos();
if (nbDeployedProcesses > 0) {
long processDefinitionId = processApi.getProcessDefinitionId(process.getName(), process.getVersion());
final long processDefinitionId = processApi.getProcessDefinitionId(process.getName(), process.getVersion());
disableProcessDefinition(process, processApi, processDefinitionId, monitor);
deleteProcessInstances(process, processApi, processDefinitionId, monitor);
deleteArchivedProcessInstances(processApi, processDefinitionId);
deleteProcessDefinition(process, processApi, processDefinitionId, monitor);
}
} catch (ProcessDefinitionNotFoundException e) {
} catch (final ProcessDefinitionNotFoundException e) {
// Skip
} finally {
if (session != null) {
......@@ -267,31 +267,31 @@ public class DeployProcessOperation {
}
}
private void deleteProcessDefinition(AbstractProcess process, final ProcessAPI processApi, long processDefinitionId, IProgressMonitor monitor)
private void deleteProcessDefinition(final AbstractProcess process, final ProcessAPI processApi, final long processDefinitionId, final IProgressMonitor monitor)
throws DeletionException {
monitor.subTask(Messages.bind(Messages.deletingProcessDefinition, getProcessLabel(process)));
processApi.deleteProcessDefinition(processDefinitionId);
}
private void deleteArchivedProcessInstances(final ProcessAPI processApi, long processDefinitionId) throws DeletionException {
private void deleteArchivedProcessInstances(final ProcessAPI processApi, final long processDefinitionId) throws DeletionException {
boolean allInstancesDeleted = false;
while (!allInstancesDeleted) {
long nbDeletedProcessInstances = processApi.deleteArchivedProcessInstances(processDefinitionId, 0, MAX_RESULTS);
final long nbDeletedProcessInstances = processApi.deleteArchivedProcessInstances(processDefinitionId, 0, MAX_RESULTS);
allInstancesDeleted = nbDeletedProcessInstances < MAX_RESULTS;
}
}
private void deleteProcessInstances(AbstractProcess process, final ProcessAPI processApi, long processDefinitionId, IProgressMonitor monitor)
private void deleteProcessInstances(final AbstractProcess process, final ProcessAPI processApi, final long processDefinitionId, final IProgressMonitor monitor)
throws DeletionException {
boolean allInstancesDeleted = false;
monitor.subTask(Messages.bind(Messages.deletingProcessInstances, getProcessLabel(process)));
while (!allInstancesDeleted) {
try {
long nbDeletedProcessInstances = processApi.deleteProcessInstances(processDefinitionId, 0, MAX_RESULTS);
final long nbDeletedProcessInstances = processApi.deleteProcessInstances(processDefinitionId, 0, MAX_RESULTS);
allInstancesDeleted = nbDeletedProcessInstances < MAX_RESULTS;
} catch (DeletionException e) {
} catch (final DeletionException e) {
if (e instanceof ProcessInstanceHierarchicalDeletionException) {
long blockingProcessId = ((ProcessInstanceHierarchicalDeletionException) e).getProcessInstanceId();
final long blockingProcessId = ((ProcessInstanceHierarchicalDeletionException) e).getProcessInstanceId();
processApi.deleteProcessInstance(blockingProcessId);
} else {
throw e;
......@@ -300,18 +300,18 @@ public class DeployProcessOperation {
}
}
private void disableProcessDefinition(AbstractProcess process, final ProcessAPI processApi, long processDefinitionId, IProgressMonitor monitor)
private void disableProcessDefinition(final AbstractProcess process, final ProcessAPI processApi, final long processDefinitionId, final IProgressMonitor monitor)
throws ProcessDefinitionNotFoundException {
monitor.subTask(Messages.bind(Messages.undeploying, getProcessLabel(process)));
try {
monitor.subTask(Messages.bind(Messages.disablingProcessDefinition, getProcessLabel(process)));
processApi.disableProcess(processDefinitionId);
} catch (ProcessActivationException e) {
} catch (final ProcessActivationException e) {
}
}
private String getProcessLabel(AbstractProcess process) {
private String getProcessLabel(final AbstractProcess process) {
return process.getName() + " (" + process.getVersion() + ")";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment