Commit 1f1654cb authored by Bonita CI's avatar Bonita CI

Merge branch 'master' into 'BS-9100_RESTAPISecurity_static'

parents 6a2ef4ae 91dc644f
......@@ -3107,6 +3107,15 @@
body="org.bonitasoft.studio.model.expression.Operation action = org.bonitasoft.studio.model.expression.ExpressionFactory.eINSTANCE.createOperation() ;
 org.bonitasoft.studio.model.expression.Operator op = org.bonitasoft.studio.model.expression.ExpressionFactory.eINSTANCE.createOperator() ;
 op.setType(org.bonitasoft.studio.common.ExpressionConstants.ASSIGNMENT_OPERATOR) ;
 op.setExpression("=") ;
 action.setOperator(op) ;

 org.bonitasoft.studio.model.expression.Expression variableExp = org.bonitasoft.studio.model.expression.ExpressionFactory.eINSTANCE.createExpression() ;
 org.bonitasoft.studio.model.expression.Expression actionExp = org.bonitasoft.studio.model.expression.ExpressionFactory.eINSTANCE.createExpression() ;
 action.setLeftOperand(variableExp) ;
 action.setRightOperand(actionExp) ;
return action;"
language="java"/>
</initializers>
<initializers
xsi:type="gmfmap:FeatureValueSpec">
<feature
xsi:type="ecore:EAttribute"
href="../form.ecore#//Widget/returnTypeModifier"/>
<value
body="return org.bonitasoft.studio.common.emf.tools.WidgetModifiersSwitch.ENGINE_DOCUMENT_QUALIFIED_NAME;"
language="java"/>
</initializers>
</domainInitializer>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
......
......@@ -191,14 +191,22 @@
<eClassifiers xsi:type="ecore:EClass" name="DataType" abstract="true" eSuperTypes="#//Element"/>
<eClassifiers xsi:type="ecore:EClass" name="DateType" eSuperTypes="#//StringType"/>
<eClassifiers xsi:type="ecore:EClass" name="Document" eSuperTypes="#//Element">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="A document can be simple or multiple:&#xD;&#xA;- if Simple, the documentType will refer to the inital content type:&#xD;&#xA; - NONE: no initial content&#xD;&#xA; - INTERNAL:&#xD;&#xA;&#x9;&#x9;- stored in Bonita,&#xD;&#xA;&#x9;&#x9;- use the defaultValueIdOfDocumentStore to retrieve the initial content file&#xD;&#xA;&#x9;&#x9;- MIME Type can be specified&#xD;&#xA; - EXTERNAL:&#xD;&#xA;&#x9;&#x9;- stored externally&#xD;&#xA;&#x9;&#x9;- use the url to specify the remote URL specifying th einitial content&#xD;&#xA;&#x9;&#x9;- MIME Type can be specified&#xD;&#xA;- if multiple&#xD;&#xA;&#x9;- Initial content can be provided using an Expression initialMultipleContent&#x9;&#xD;&#xA;&#x9;- MIME Type will be specified for each Document of the list created in the expression"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="mimeType" eType="ecore:EClass expression.ecore#//Expression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isInternal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="url" eType="ecore:EClass expression.ecore#//Expression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultValueIdOfDocumentStore"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="documentType" lowerBound="1"
eType="#//DocumentType" defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="multiple" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="initialMultipleContent"
eType="ecore:EClass expression.ecore#//Expression" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DoubleType" eSuperTypes="#//DataType"/>
<eClassifiers xsi:type="ecore:EClass" name="EndErrorEvent" eSuperTypes="#//Event #//ErrorEvent"/>
......@@ -567,6 +575,11 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XMLType" eSuperTypes="#//DataType"/>
<eClassifiers xsi:type="ecore:EClass" name="XORGateway" eSuperTypes="#//Gateway"/>
<eClassifiers xsi:type="ecore:EEnum" name="DocumentType">
<eLiterals name="NONE"/>
<eLiterals name="INTERNAL" value="1"/>
<eLiterals name="EXTERNAL" value="2"/>
</eClassifiers>
<eSubpackages name="decision" nsURI="http://www.bonitasoft.org/ns/studio/process/decision"
nsPrefix="decision">
<eClassifiers xsi:type="ecore:EClass" name="DecisionTable">
......
......@@ -463,6 +463,11 @@
<genEnumLiterals ecoreEnumLiteral="process.ecore#//StartTimerScriptType/MINUTELY"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//StartTimerScriptType/CONSTANT"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="process.ecore#//DocumentType">
<genEnumLiterals ecoreEnumLiteral="process.ecore#//DocumentType/NONE"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//DocumentType/INTERNAL"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//DocumentType/EXTERNAL"/>
</genEnums>
<genClasses image="false" ecoreClass="process.ecore#//AbstractCatchMessageEvent">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//AbstractCatchMessageEvent/event"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference process.ecore#//AbstractCatchMessageEvent/incomingMessag"/>
......@@ -574,9 +579,11 @@
<genClasses ecoreClass="process.ecore#//DateType"/>
<genClasses ecoreClass="process.ecore#//Document">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference process.ecore#//Document/mimeType"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Document/isInternal"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Document/url"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Document/defaultValueIdOfDocumentStore"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Document/documentType"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Document/multiple"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Document/initialMultipleContent"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//DoubleType"/>
<genClasses ecoreClass="process.ecore#//EndErrorEvent"/>
......
......@@ -461,12 +461,12 @@
referenceValue="process.ecore#//Element"/>
</changes>
<changes xsi:type="history:Create" target="process.ecore#//Document" referenceName="eStructuralFeatures"
element="process.ecore#//Document/isInternal">
<changes xsi:type="history:Set" element="process.ecore#//Document/isInternal"
element="#//@releases.17/@changes.0/@changes.2/@changes.0/@element">
<changes xsi:type="history:Set" element="#//@releases.17/@changes.0/@changes.2/@changes.0/@element"
featureName="name" dataValue="isInternal"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/isInternal"
<changes xsi:type="history:Set" element="#//@releases.17/@changes.0/@changes.2/@changes.0/@element"
featureName="defaultValueLiteral" dataValue="false"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/isInternal"
<changes xsi:type="history:Set" element="#//@releases.17/@changes.0/@changes.2/@changes.0/@element"
featureName="eType" referenceValue="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</changes>
<changes xsi:type="history:Create" target="process.ecore#//Document" referenceName="eStructuralFeatures"
......@@ -8097,7 +8097,7 @@
<releases date="2014-08-06T11:48:39.611+0200" label="6.3.4-001">
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.connector.UpdateAlfrescoMigrationConnectorVersionTo113"/>
</releases>
<releases date="2014-07-30T11:48:39.611+0200" label="6.4.0-001">
<releases date="2014-07-22T11:48:39.611+0200" label="6.4.0-001">
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.multiinstance.MultiInstanceCustomMigration">
<changes xsi:type="history:OperationChange">
<changes xsi:type="history:Create" target="process.ecore#/" referenceName="eClassifiers"
......@@ -8575,5 +8575,99 @@
featureName="defaultValueLiteral" dataValue="false" oldDataValue="true"/>
</changes>
</releases>
<releases date="2014-09-24T11:48:39.611+0200" label="6.4.0-002">
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.document.DocumentTypeMigration">
<changes xsi:type="history:OperationChange">
<changes xsi:type="history:Create" target="process.ecore#/" referenceName="eClassifiers"
element="process.ecore#//DocumentType"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType" featureName="name"
dataValue="DocumentType"/>
<operation name="createEnumeration">
<parameters name="ePackage">
<referenceValue element="process.ecore#/"/>
</parameters>
<parameters name="name">
<dataValue>DocumentType</dataValue>
</parameters>
<parameters name="literals"/>
</operation>
</changes>
<changes xsi:type="history:CompositeChange">
<changes xsi:type="history:Create" target="process.ecore#//DocumentType" referenceName="eLiterals"
element="process.ecore#//DocumentType/NONE"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType/NONE"
featureName="name" dataValue="NONE"/>
<changes xsi:type="history:Create" target="process.ecore#//DocumentType" referenceName="eLiterals"
element="process.ecore#//DocumentType/INTERNAL"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType/INTERNAL"
featureName="name" dataValue="INTERNAL"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType/INTERNAL"
featureName="value" dataValue="1" oldDataValue="0"/>
<changes xsi:type="history:Create" target="process.ecore#//DocumentType" referenceName="eLiterals"
element="process.ecore#//DocumentType/EXTERNAL"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType/EXTERNAL"
featureName="name" dataValue="EXTERNAL"/>
<changes xsi:type="history:Set" element="process.ecore#//DocumentType/EXTERNAL"
featureName="value" dataValue="2" oldDataValue="0"/>
</changes>
<changes xsi:type="history:OperationChange">
<changes xsi:type="history:Delete" target="process.ecore#//Document" referenceName="eStructuralFeatures">
<element xsi:type="ecore:EAttribute" name="isInternal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
</changes>
<operation name="deleteFeature2">
<parameters name="feature">
<referenceValue element="#//@releases.17/@changes.0/@changes.2/@changes.0/@element"/>
</parameters>
</operation>
</changes>
<changes xsi:type="history:OperationChange">
<changes xsi:type="history:Create" target="process.ecore#//Document" referenceName="eStructuralFeatures"
element="process.ecore#//Document/documentType">
<changes xsi:type="history:Set" element="process.ecore#//Document/documentType"
featureName="name" dataValue="documentType"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/documentType"
featureName="lowerBound" dataValue="1" oldDataValue="0"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/documentType"
featureName="defaultValueLiteral" dataValue="0"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/documentType"
featureName="eType" referenceValue="process.ecore#//DocumentType"/>
</changes>
<operation name="newAttribute">
<parameters name="eClass">
<referenceValue element="process.ecore#//Document"/>
</parameters>
<parameters name="name">
<dataValue>documentType</dataValue>
</parameters>
<parameters name="type">
<referenceValue element="process.ecore#//DocumentType"/>
</parameters>
<parameters name="lowerBound">
<dataValue>1</dataValue>
</parameters>
<parameters name="upperBound">
<dataValue>1</dataValue>
</parameters>
<parameters name="defaultValue">
<dataValue>0</dataValue>
</parameters>
</operation>
</changes>
</changes>
<changes xsi:type="history:CompositeChange" description="Add possibility of initial content for Multiple Document">
<changes xsi:type="history:Create" target="process.ecore#//Document" referenceName="eStructuralFeatures"
element="process.ecore#//Document/initialMultipleContent">
<changes xsi:type="history:Set" element="process.ecore#//Document/initialMultipleContent"
featureName="name" dataValue="initialMultipleContent"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/initialMultipleContent"
featureName="containment" dataValue="true" oldDataValue="false"/>
<changes xsi:type="history:Set" element="process.ecore#//Document/initialMultipleContent"
featureName="eType" referenceValue="expression.ecore#//Expression"/>
</changes>
</changes>
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.document.DocumentDefaultReturnTypeModifierMigration"/>
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.form.FileWidgetDocumentMigration"/>
</releases>
<releases/>
</history:History>
......@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
pluginName=Actors Plugin
providerName=BonitaSoft S.A.
providerName=Bonitasoft S.A.
actors_Label=Organization
export_Label=Export...
import_Label=Import...
......
......@@ -433,11 +433,6 @@
id="org.bonitasoft.studio.application.openEngineLog"
name="%openEngineLog_commandLabel">
</command>
<command
defaultHandler="org.bonitasoft.studio.application.actions.OpenEXchangeCommand"
id="org.bonitasoft.studio.application.openContributions"
name="%openContribution_commandLabel">
</command>
<command
defaultHandler="org.bonitasoft.studio.application.actions.RefreshConnectorHandler"
id="org.bonitasoft.studio.application.refreshconnectorcommand"
......
/**
* Copyright (C) 2010 BonitaSoft S.A.
* BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.application.actions;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Properties;
import java.util.zip.ZipFile;
import org.bonitasoft.studio.application.contribution.IPostImportContribution;
import org.bonitasoft.studio.application.contribution.IPreImportContribution;
import org.bonitasoft.studio.application.i18n.Messages;
import org.bonitasoft.studio.common.FileUtil;
import org.bonitasoft.studio.common.ProjectUtil;
import org.bonitasoft.studio.common.extension.BonitaStudioExtensionRegistryManager;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroSite;
import org.eclipse.ui.intro.config.IIntroAction;
import org.eclipse.ui.progress.IProgressService;
import static org.bonitasoft.studio.common.Messages.bonitaBPMCommunity;
/**
* @author Mickael Istria
*
*/
public class ImportFromEXchangeAction implements IIntroAction {
/**
* @author Mickael Istria
*
*/
private final class InstallRunnable implements IRunnableWithProgress {
/**
*
*/
private final String contributionFile;
/**
*
*/
private final String contributionURL;
/**
*
*/
private final IIntroSite site;
String message;
private String pemAuthCookie;
private String forumCookie;
/**
* @param contributionFile
* @param contributionURL
* @param site
*/
private InstallRunnable(String contributionFile, String contributionURL, String forumCookie, String pemAuthCookie, IIntroSite site) {
this.contributionFile = contributionFile;
this.contributionURL = contributionURL;
this.site = site;
this.pemAuthCookie = pemAuthCookie;
this.forumCookie = forumCookie;
}
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
message = installContribution(site, contributionURL, contributionFile, forumCookie, pemAuthCookie, monitor);
} catch (Exception ex) {
message = ex.getMessage();
}
}
}
protected Control control;
/* (non-Javadoc)
* @see org.eclipse.ui.intro.config.IIntroAction#run(org.eclipse.ui.intro.IIntroSite, java.util.Properties)
*/
public void run(final IIntroSite site, Properties params) {
final String contributionURL = params.getProperty("contributionURL");
final String contributionName = params.getProperty("contributionName");
final String contributionFile = params.getProperty("fileName");
final String forumCookie = params.getProperty("d1");
final String pemAuthCookie = params.getProperty("d2");
if (MessageDialog.openConfirm(site.getShell(), Messages.confirmContributionInstall_title, Messages.bind(Messages.confirmContributionInstall_message, contributionName))) {
IProgressService progressManager = PlatformUI.getWorkbench().getProgressService();
InstallRunnable runnable = new InstallRunnable(contributionFile, contributionURL, forumCookie, pemAuthCookie, site);
try {
progressManager.run(false, false, runnable);
if (runnable.message != null) {
MessageDialog.openError(site.getShell(), Messages.error, runnable.message);
} else {
MessageDialog.openInformation(site.getShell(), Messages.success, Messages.contributionSuccessfullyInstalled);
}
} catch (Exception ex) {
BonitaStudioLog.error(ex);
MessageDialog.openError(site.getShell(), "Error", "An error occured while importing, see log for details");
}
}
}
/**
* @param site
* @param contributionURL
* @param contributionFile
* @return the error that occured, or null
*/
private String installContribution(final IIntroSite site, final String contributionURL, final String contributionFile, String forumCookie, String pemAuthCookie, IProgressMonitor monitor) throws Exception {
InputStream contrib = null;
File testFile = null;
monitor.beginTask(Messages.installingFromContribution, 5);
monitor.subTask(Messages.downloading);
try {
URL url = new URL(contributionURL);
URLConnection connection = url.openConnection();
connection.setRequestProperty("Cookie", "forum_cookie_5eca4a=" + forumCookie + "; pem_auth_cookie=" + URLEncoder.encode(pemAuthCookie, "UTF-8"));
connection.connect();
contrib = connection.getInputStream();
testFile = File.createTempFile("testContrib", ".zip", ProjectUtil.getBonitaStudioWorkFolder());
FileOutputStream fos = new FileOutputStream(testFile);
FileUtil.copy(contrib, fos);
fos.close();
contrib.close();
} catch (Exception ex) {
BonitaStudioLog.error(ex);
return Messages.errorWhileDownloadingContrib;
}
monitor.worked(3);
monitor.subTask(Messages.installingContribution);
try {
new ZipFile(testFile);
} catch (Exception ex) {
return Messages.bind(Messages.notLoggedIn, new Object[]{bonitaBPMCommunity});
}
try {
IConfigurationElement[] elems = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements("org.bonitasoft.studio.application.preImport"); //$NON-NLS-1$
IPreImportContribution preImportcontrib = null;
for (IConfigurationElement elem : elems){
try {
preImportcontrib = (IPreImportContribution) elem.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
BonitaStudioLog.error(e);
}
preImportcontrib.execute();
}
//TODO Re make import
// IProgressMonitor progressMonitor = new NullProgressMonitor();
// if (contributionFile.endsWith(".jar")) {
// contrib = new FileInputStream(testFile);
// JarRepository.getInstance().importArtifact(contributionFile, contrib, progressMonitor);
// contrib.close();
// } else if (contributionFile.endsWith(".zip")) {
// RepositoryPlugin.getPlugin().importFromZip(testFile, monitor, progressMonitor);
// } else if (contributionFile.endsWith(".bar")) {
// contrib = new FileInputStream(testFile);
// final File tempFile = File.createTempFile("temp", ".bar");
// FileOutputStream out = new FileOutputStream(tempFile);
// FileUtil.copy(contrib, out);
// out.close();
// Display.getDefault().syncExec(new Runnable() {
// public void run() {
// Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
// try {
// ProcessRepository.ImportBARModule.importProcOrBar(shell, tempFile, new NullProgressMonitor());
// } catch (Exception e) {
// BonitaStudioLog.log(e);
// }
// }
// });
//
// tempFile.delete();
// contrib.close();
// }
// monitor.subTask(Messages.refresh);
// ExtensionProjectUtil.refresh(progressMonitor);
elems = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements("org.bonitasoft.studio.application.postImport"); //$NON-NLS-1$
IPostImportContribution postImportcontrib = null;
for (IConfigurationElement elem : elems){
try {
postImportcontrib = (IPostImportContribution) elem.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
BonitaStudioLog.error(e);
}