Commit a10dd7e3 authored by Romain Bioteau's avatar Romain Bioteau

BS-12121

Move businessobject plugin
Refactor dependencies to avoid cycle
Fix mapping
Move tests and translation
parent 665b1d7c
......@@ -476,4 +476,11 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.bonitasoft.studio.businessobject"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-test/java"/>
<classpathentry kind="src" path="src-test/resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.bonitasoft.studio.businessobject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Business Object Plugin
Bundle-Localization: plugin
Bundle-SymbolicName: org.bonitasoft.studio.businessobject;singleton:=true
Bundle-Version: 6.5.0.qualifier
Bundle-Activator: org.bonitasoft.studio.businessobject.BusinessObjectPlugin
Bundle-Vendor: BonitaSoft S.A.
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Require-Bundle: org.bonitasoft.studio.engine;bundle-version="1.0.0",
org.bonitasoft.studio.model;bundle-version="1.0.0",
org.bonitasoft.studio.common;bundle-version="1.0.0",
org.bonitasoft.studio.pics;bundle-version="1.0.0",
org.eclipse.ui.ide;bundle-version="3.6.0",
org.bonitasoft.studio.xml;bundle-version="1.0.0",
org.eclipse.jdt.core;bundle-version="3.6.1",
org.eclipse.swt;bundle-version="3.6.0",
org.eclipse.jface;bundle-version="3.6.0",
org.eclipse.wst.xml.ui,
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.101",
org.bonitasoft.studio.common.diagram;bundle-version="1.0.0",
org.eclipse.core.databinding;bundle-version="1.3.100",
org.eclipse.core.databinding.observable;bundle-version="1.3.0",
org.eclipse.core.databinding.property;bundle-version="1.3.0",
org.eclipse.jface.databinding;bundle-version="1.4.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
org.bonitasoft.studio.common.repository;bundle-version="1.0.0",
org.bonitasoft.studio.dependencies;bundle-version="1.0.0",
org.bonitasoft.studio.configuration;bundle-version="1.0.0",
com.ibm.icu;bundle-version="50.1.1",
org.bonitasoft.studio.expression.editor;bundle-version="6.3.0",
org.bonitasoft.studio.preferences;bundle-version="6.3.0",
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.tests-utils;bundle-version="6.3.0";resolution:=optional,
org.bonitasoft.studio.refactoring;bundle-version="6.3.0",
org.eclipse.emf;bundle-version="2.6.0",
org.eclipse.emf.transaction,
org.eclipse.emf.databinding
Export-Package: org.bonitasoft.studio.businessobject.core.operation,or
g.bonitasoft.studio.businessobject.core.repository,org.bonitasoft.stu
dio.businessobject.ui,org.bonitasoft.studio.businessobject.ui.wizard
Import-Package: com.bonitasoft.engine.api,
com.bonitasoft.engine.bdm,
com.bonitasoft.engine.bdm.dao,
com.bonitasoft.engine.bdm.model,
com.bonitasoft.engine.bdm.model.field,
com.bonitasoft.engine.bdm.validator,
com.bonitasoft.engine.businessdata,
org.bonitasoft.engine.exception,
org.bonitasoft.engine.platform,
org.bonitasoft.engine.session
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
plugin.properties,\
messages.properties
src.excludes = src-test/resources/,\
src-test/java/
generatedJavaRepository=Generated Java types
name=Name
packageName=Package
error=Error
error_emptyName=Must have a name
type=Type
Remove=Remove
selectBusinessObjectWizardTitle=Select a Business Object
selectBusinessObjectWizardMessage=Select an existing Business Object to edit.
businessObjectRepositoryStoreName=Business Object
errorMessageSameDataTypeNames=An other data type with the same name already exists.
errorMessageNoWhitespaceInDataTypeNames=Whitespace is not allowed in a Business Object name.
noBusinessObjectSelected=Select a Business Object.
addBusinessObjectDataTitle=Add a new Business data to {0}
addBusinessObjectDataDescription=Create a new reference to a Business Object defined in Developement > Business Data Model menu
description=Description
businessObject=Business Object
dataWithSameNameAlreadyExists=A data with the same name already exists
editBusinessObjectDataTitle=Edit Business data
editBusinessObjectDataDescription=Edit an existing Business data
createNewBusinessObject=<A>Create a new Business Object...</A>
businessObjectNotFound=Business Object {0} not found
errorWhileDeployingBDR=An error occurred while publishing the Business Data Model
publish=Publish
publishBusinessObjectTitle=Publish Business Object
publishBusinessObjectDescription=Publish selected Business Object in engine
businessObjectPublishedMessage=Business Object published successfully.
businessObjectPublishedTitle=Business Object published
export=Export
exportBusinessDataModelTitle=Export Business Data Model
exportBusinessDataModelDescription= Export a Business Data Model to be deployed in the {0}.\nThe generated archive file name will be "bdm.zip"
exportBusinessDataModelSuccessFull=Business Data Model has successfully been exported to {0}
exportingBusinessDataModel=Exporting Business Data Model...
destinationPath=Destination path
invalidDestinationPath=Destination path is not a valid folder
browse=Browse...
deployingBusinessObjects=Deploying Business Data Model...
add=Add
delete=Delete
listOfBusinessObjects=List of Business Objects
selectABusinessObjectToEdit=Select a Business Object to edit
up=Up
down=Down
length=Length
mandatory=Mandatory
fieldNameAlreadyExists=Attribute name already exists
constraintNameAlreadyExists=Constraint name already exists
deleteBOConfirmTitle=Delete Business Object?
deleteBOConfirmMessage=Are you sure you want to delete Business Object "{0}" ?
attribute=attribute
error_emptyPackageName=Package name is empty
modelValidationFailedTitle=Validation failed
validatingBDM=Validating...
atLeastOneAttributeShouldExists={0} must have at least one attribute.
manageBusinessDataModelTitle=Manage Business Data Model
manageBusinessDataModelDesc=Add Business Objects to the list and edit their details in the right pane tabs.
reservedKeyWord={0} is a reserved keyword
saving=Saving...
constraints=Unique constraints
businessDataModel=Business data model
selectUniqueConstraintFieldsMessage=Select the combination of attributes to which the unique constraint will be applied.
selectUniqueConstraintFieldsTitle=Select attributes
attributes=Attributes
atLeastOneAttributeShouldBelongToConstraint=At least one attribute should be defined for unique constraint {0}
attributeInConstraintNotExists=Attribute {0} in unique constraint {1} doesn't exist
atLeastOneAttributeShouldBelongToIndex=At least one attribute should be defined for index {0}
attributeInIndexNotExists=Attribute {0} in index {1} doesn't exist
atLeastOneBusinessObjectShouldExists=At least one Business Object should be defined
invalidSQLIdentifier={0} is not a valid SQL identifier
queries=Queries
queryNameAlreadyExists=Query name already exists
query=Query
parameters=Parameters
parameter=param
queryParameterNameAlreadyExists=Parameter {0} already exists
newQuery=Create query on {0}
newQueryDescription=Type the query using JPQL. You may use or discard the example provided.\nThen adapt the default list of parameters. If needed, modify the result type.
editQuery=Edit {0} on {1}
editQueryDescription=Edit the query using JPQL. Then adapt the list of parameters.\nIf needed, modify the result type.
parameterNotUsedInQueryWarning={0} is defined in parameter's list but never used in query
undefinedParameter={0} is not defined in parameter's list
exportCompleted=Export completed
queryResultType=Result type
multipleReturnType=Multiple (java.util.List)
multiple=Multiple
single=Single ({0})
numeric=Numeric (java.util.Long)
queryLink=JPQL Query * <a>?</a>
jpqlParametersHint=Define parameters used in the above query
emptyQueryError=JPQL Query cannot be empty
queryNameReserved={0} is a reserved query name (query generated from unique constraint)
queryExpressionLabel=Query
queryContent=Query content
value=Value
returnType=Return type
dropBusinessDataDBOnExit=Clean Business Data Model database on exit
dropBusinessDataDBOnBDMChanges=Clean Business Data Model database on changes
queryExpressionGuidance=Select the Business Object and the corresponding query to execute. Set the value for each parameter required by the query.
bdmCompatibilityTitle=Warning: Impact of changes
bdmCompatibilityMsg=Changes made could cause incompatibilities between the Business Data Model and Business Data used in the pools.\nYou will need to Validate the diagrams to list impacts on Business Data.\n\nIf modifications to mandatory or unique constraints have been made, you must reset the Business Data Model to apply the changes. This will clear existing entries.
clearExistingBusinessData=Reset Business Data Model
businessObjectNameAlreadyExists=A Business Object already exists with the same name
installFailedTitle=Deploy failed
installFailedMessage=An error occurred while deploying the Business Data Model in engine
defaultQueriesOption=Default
customQueriesOption=Custom
defaultQueriesHint=3 default types of queries to select Business Objects: based on unique constraints, which returns\nsingle results, based on simple attributes (with equals criterion) which returns multiple\nresults, and a Select All, which returns all Business Data on the Business Object.
providedQuery=Provided query
providedQueryDescription=Display the content of this provided query
queryParameterNameReservedForPagination={0} is a reserved keyword for pagination
orderByMissingWarning=You have defined a query that returns a list of business objects. It's highly recommended to use an ORDER BY clause when returning a list.
paginationParameterHint=2 Pagination parameters are offered, to be used through the APIs.\nstartIndex is the index in the list of results to be displayed first, maxResults is the number of items to display in the page.\nNote: In application forms, widgets only display one page of elements.
newQueryTitle=Create query
editQueryTitle=Edit query
howToUseBusinessObjects=How to use Business Objects
howToUseBusinessObjectsContent=To use Business Objects (initialize or change values in forms), create Business Data in pools. To display Business Objects queries results in forms, create Transient Data in forms and set the default values with a Query expression. Then, create a Groovy script to transform business objects into display labels.
multipleBusinessData=Is multiple
composition=Composition
aggregation=Aggregation
relation=Relationship
indexes=Indexes
indexNameAlreadyExists=Index name already exists
indexedAttributes=Indexed attributes
availableAttributes=Available attributes
selectIndexFieldsTitle=Select attributes for {0}
selectIndexFieldsMessages=Select the attributes for this index. The performance of this query filter is significantly improved, depending on the attributes and order chosen.
businessObjectDAO=Business Object DAO
mandatoryColumnTooltip=If you check Multiple and Mandatory, at least one value is mandatory.
stringLengthTooltip=Maximum length allowed for a String value.
lengthCannotBeEmpty=Length must be a valid positive integer
noDetailsAvailable=No details available
details=Details
detailsFor=Details for {0}
realtionTooltip=- Aggregation means "is referenced by": the related object has its own life cycle;\nit cannot be modified when the parent object is saved to the database.\n- Composition means "is part of": the related object may be modified\nwhen the parent object is saved to the database.
errorMessageNoUnderscoreInBoNames='_' is not allowed in a Business Object name.
loadOnDemand=Only load related objects when needed
loadOnDemandHint=This option is recommended for objects which are rarely displayed or modified with the parent Business Object
alwaysLoad=Always load related objects
alwaysLoadHint=This option is recommended for objects which are often displayed or modified with the parent Business Object
createBusinessDataVariable=Create a Business data...
error_reservedPackagePrefix={0} is a reserved package prefix.
warning_reservedPackagePrefix={0} is a discouraged package prefix.
\ No newline at end of file
BusinessDataModel=Business Data Model
Export=Export...
manageBusinessObjects=Manage...
createBusinessDataLabel=<a>Create a Business data...</a>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.bonitasoft.studio.repositoryStore">
<repositoryStore
class="org.bonitasoft.studio.businessobject.core.repository.BusinessObjectModelRepositoryStore">
</repositoryStore>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="org.bonitasoft.studio.businessobject.ui.handler.ManageBusinessObjectHandler"
id="org.bonitasoft.studio.businessobject.manage"
name="%manageBusinessObjects">
</command>
<command
defaultHandler="org.bonitasoft.studio.businessobject.ui.handler.ExportBusinessDataModelHandler"
id="org.bonitasoft.studio.businessobject.exportCommand"
name="%Export">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.bonitasoft.studio.development?after=org.bonitasoft.studio.datacomplex.menu">
<menu
icon="icons/bdm.png"
id="org.bonitasoft.studio.businessobject.menu"
label="%BusinessDataModel">
<command
commandId="org.bonitasoft.studio.businessobject.manage"
icon="icons/manage-bdm.png"
id="org.bonitasoft.studio.businessobject.manage.menu"
style="push">
</command>
<separator
name="org.bonitasoft.studio.businessobject.separator"
visible="true">
</separator>
<command
commandId="org.bonitasoft.studio.businessobject.exportCommand"
icon="icons/export-bdm.png"
style="push">
</command>
</menu>
</menuContribution>
</extension>
<extension
point="org.bonitasoft.studio.bosArchiveProvider">
<bosArchiveProvider
providerClass="org.bonitasoft.studio.businessobject.core.repository.BusinessObjectBOSArchiveProvider">
</bosArchiveProvider>
</extension>
<extension
point="org.bonitasoft.studio.engine.postEngineAction">
<action
class="org.bonitasoft.studio.businessobject.core.operation.DeployBDMOnStartup">
</action>
</extension>
<extension
point="org.bonitasoft.studio.expression.expressionProvider">
<expressionProvider
providerClass="org.bonitasoft.studio.businessobject.core.expression.QueryExpressionProvider">
</expressionProvider>
<expressionProvider
providerClass="org.bonitasoft.studio.businessobject.core.expression.DAOExpressionProvider">
</expressionProvider>
</extension>
<extension
point="org.bonitasoft.studio.preferences.prefrenceFieldEditorContribution">
<fieldEditor
class="org.bonitasoft.studio.businessobject.ui.preference.DropBusinessDataDBFieldEditorContribution">
</fieldEditor>
</extension>
<extension
point="org.bonitasoft.studio.expression.proposalListener">
<proposalListner
name="%createBusinessDataLabel"
providerClass="org.bonitasoft.studio.businessobject.ui.expression.CreateBusinessDataProposalListener"
type="TYPE_VARIABLE">
</proposalListner>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>
<parent>
<groupId>org.bonitasoft.studio.bundles</groupId>
<artifactId>plugins</artifactId>
<version>6.5.0-SNAPSHOT</version>
</parent>
<groupId>org.bonitasoft.studio.bundles.plugins</groupId>
<artifactId>org.bonitasoft.studio.businessobject</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
/*******************************************************************************
* Copyright (C) 2009, 2014 BonitaSoft S.A.
* BonitaSoft is a trademark of BonitaSoft SA.
* This software file is BONITASOFT CONFIDENTIAL. Not For Distribution.
* For commercial licensing information, contact:
* BonitaSoft, 32 rue Gustave Eiffel – 38000 Grenoble
* or BonitaSoft US, 51 Federal Street, Suite 305, San Francisco, CA 94107
*******************************************************************************/
package org.bonitasoft.studio.businessobject.core.expression;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import java.util.List;
import org.bonitasoft.studio.businessobject.core.expression.model.BusinessObjectExpressionQuery;
import org.bonitasoft.studio.businessobject.core.expression.model.QueryExpressionModel;
import org.bonitasoft.studio.businessobject.ui.expression.QueryExpressionEditor;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.expression.assertions.ExpressionAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.bonitasoft.engine.bdm.model.BusinessObject;
import com.bonitasoft.engine.bdm.model.BusinessObjectModel;
import com.bonitasoft.engine.bdm.model.Query;
import com.bonitasoft.engine.bdm.model.field.FieldType;
import com.bonitasoft.engine.bdm.model.field.SimpleField;
/**
* @author Romain Bioteau
*/
public class QueryExpressionProviderTest {
private QueryExpressionProvider queryExpressionProvider;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
queryExpressionProvider = spy(new QueryExpressionProvider());
final BusinessObjectModel bom = new BusinessObjectModel();
final BusinessObject businessObject = new BusinessObject();
businessObject.setQualifiedName("org.bonita.Employee");
final SimpleField id = new SimpleField();
id.setName("employeeId");
id.setType(FieldType.STRING);
businessObject.addField(id);
bom.addBusinessObject(businessObject);
businessObject.addUniqueConstraint("UC_EMPLOYEE_ID", "employeeId");
final Query query = businessObject.addQuery("findByEmployeeId", "SELECT e FROM Employee e WHERE e.employeeId = :employeeId", List.class.getName());
query.addQueryParameter("employeeId", String.class.getName());
doReturn(bom).when(queryExpressionProvider).getBusinessObjectModel();
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
@Test
public void should_buildQueryExpressionModel_return_QueryExpressionModel_from_bom() throws Exception {
final QueryExpressionModel model = queryExpressionProvider.buildQueryExpressionModel();
assertThat(model).isNotNull();
assertThat(model.getBusinessObjects()).hasSize(1);
final BusinessObjectExpressionQuery businessObjectExpressionQuery = model.getBusinessObjects().get(0);
assertThat(businessObjectExpressionQuery.getQualifiedName()).isEqualTo("org.bonita.Employee");
assertThat(businessObjectExpressionQuery.getQueryExpressions()).hasSize(3);
for (final Expression exp : businessObjectExpressionQuery.getQueryExpressions()) {
ExpressionAssert.assertThat(exp).hasType(queryExpressionProvider.getExpressionType());
assertThat(exp.getName()).isNotEmpty();
assertThat(exp.getContent()).isNotEmpty();
assertThat(exp.getType()).isNotEmpty();
assertThat(exp.getReferencedElements()).isNotEmpty();
}
}
@Test
public void should_be_relevant_for_any_context() throws Exception {
assertThat(queryExpressionProvider.isRelevantFor(null)).isTrue();
}
@Test
public void should_getExpressionEditor_return_a_QueryExpressionEditor() throws Exception {
assertThat(queryExpressionProvider.getExpressionEditor(null, null)).isInstanceOf(QueryExpressionEditor.class);
}
@Test
public void should_have_valid_expression_type() throws Exception {
assertThat(queryExpressionProvider.getExpressionType()).isEqualTo(ExpressionConstants.QUERY_TYPE);
}
}
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 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.businessobject.core.operation;
import org.junit.After;
import org.junit.Before;
/**
* @author Romain Bioteau
*
*/
public class DeployBDMOnStartupTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
}
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 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.businessobject.core.operation;