catch up with development
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a7071f --- /dev/null +++ b/.gitignore
@@ -0,0 +1,53 @@ +bin/ +.*.jar +**/resources/VAADIN/widgetsets +**/resources/VAADIN/gwt-unitCache +**/WebContent/VAADIN/widgetsets +**/localTarget +**/build +**/WebContent/WEB-INF/lib +.DS_Store +**/target +*.java._trace +/build.runtime-web.kepler.latest.log.properties +**/log +**/org.eclipse.osbp.runtime.web.doc/contents/ +**/org.eclipse.osbp.runtime.web.doc/website/ +**/org.eclipse.osbp.runtime.web.vaadin.components/resources/ +**/org.eclipse.osbp.runtime.web.vaadin.components/gwt-unitCache/ +**/git.properties +git.properties + +**/target/ +**/.metadata/ + +**/emf-gen/**/.gitignore +**/src-gen/**/.gitignore +**/git.properties +**/*.java._trace +**/*.log +**/*.log.properties + +**/bin/ +**/build/ +*.class +*.ctrl +**/Debug/ +.DS_Store +*.ear +*.war + +**/*.actionbin +**/*.blipbin +**/*.chartbin +**/*.cubebin +**/*.datatypebin +**/*.dtobin +**/*.entitybin +**/*.servicebin +**/*.tablebin +**/*.uibin +**/*.uisemanticbin +**/*.xtendbin +**/*.xtextbin +
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/README.md b/README.md deleted file mode 100644 index 692c4de..0000000 --- a/README.md +++ /dev/null
@@ -1,4 +0,0 @@ -lunifera-web -============ - -Bundles for runtime web. \ No newline at end of file
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch deleted file mode 100644 index 1dabfc2..0000000 --- a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch +++ /dev/null
@@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType"> -<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/> -<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.build.uses.local.composite.p2 -Dlunifera.build.uses.remote.composite.p2 -Dlunifera.deploy.to.local.composit"/> -<booleanAttribute key="M2_NON_RECURSIVE" value="false"/> -<booleanAttribute key="M2_OFFLINE" value="false"/> -<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/> -<listAttribute key="M2_PROPERTIES"/> -<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/> -<booleanAttribute key="M2_SKIP_TESTS" value="false"/> -<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/> -<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/> -<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> -</listAttribute> -<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/> -<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/> -</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch deleted file mode 100644 index bf264fb..0000000 --- a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch +++ /dev/null
@@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType"> -<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/> -<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.deploy.to.local.composite.p2"/> -<booleanAttribute key="M2_NON_RECURSIVE" value="false"/> -<booleanAttribute key="M2_OFFLINE" value="false"/> -<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/> -<listAttribute key="M2_PROPERTIES"/> -<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/> -<booleanAttribute key="M2_SKIP_TESTS" value="false"/> -<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/> -<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/> -<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> -</listAttribute> -<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/> -<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/> -</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch deleted file mode 100644 index cfc8a21..0000000 --- a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch +++ /dev/null
@@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType"> -<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/> -<stringAttribute key="M2_GOALS" value="clean verify -fn"/> -<booleanAttribute key="M2_NON_RECURSIVE" value="false"/> -<booleanAttribute key="M2_OFFLINE" value="false"/> -<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/> -<listAttribute key="M2_PROPERTIES"/> -<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/> -<booleanAttribute key="M2_SKIP_TESTS" value="true"/> -<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/> -<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/> -<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/> -<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> -</listAttribute> -<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/> -<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/> -</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch deleted file mode 100644 index bf264fb..0000000 --- a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch +++ /dev/null
@@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType"> -<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/> -<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.deploy.to.local.composite.p2"/> -<booleanAttribute key="M2_NON_RECURSIVE" value="false"/> -<booleanAttribute key="M2_OFFLINE" value="false"/> -<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/> -<listAttribute key="M2_PROPERTIES"/> -<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/> -<booleanAttribute key="M2_SKIP_TESTS" value="false"/> -<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/> -<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/> -<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> -</listAttribute> -<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/> -<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/> -</launchConfiguration>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml index 02ff6a1..925d886 100644 --- a/jenkins.build.config.xml +++ b/jenkins.build.config.xml
@@ -16,8 +16,11 @@ <!-- DO NOT EDIT BELOW THIS LINE --> <jenkins.build.dependencies> + <jenkins.build.dependency>org.eclipse.osbp.blob</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.ecview.core</jenkins.build.dependency> + <jenkins.build.dependency>org.eclipse.osbp.ecview.extension.api</jenkins.build.dependency> + <jenkins.build.dependency>org.eclipse.osbp.jpa.services</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency> </jenkins.build.dependencies> </jenkins>
diff --git a/org.eclipse.osbp.runtime.tests/.classpath b/org.eclipse.osbp.runtime.tests/.classpath new file mode 100644 index 0000000..4ff52d4 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.classpath
@@ -0,0 +1,8 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="src-gen"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.tests/.project b/org.eclipse.osbp.runtime.tests/.project new file mode 100644 index 0000000..4724223 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.project
@@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osbp.runtime.tests</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.osbp.ide.core.ui.shared.OSBPModelEnhancingBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.osbp.ide.core.ui.shared.OSBPI18nBuilder</name> + <arguments> + </arguments> + </buildCommand> + <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> + <buildCommand> + <name>org.eclipse.pde.ds.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.babel.editor.rbeNature</nature> + <nature>org.eclipse.osbp.ide.core.ui.shared.OSBPNature</nature> + </natures> +</projectDescription>
diff --git a/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.target/LICENSE.txt b/org.eclipse.osbp.runtime.tests/LICENSE.txt similarity index 100% rename from org.eclipse.osbp.runtime.web.target/LICENSE.txt rename to org.eclipse.osbp.runtime.tests/LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.tests/META-INF/MANIFEST.MF new file mode 100644 index 0000000..05b9546 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,53 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: org.eclipse.osbp.runtime.tests +Bundle-SymbolicName: org.eclipse.osbp.runtime.tests;singleton:=true +Bundle-Version: 0.9.0.qualifier +Bundle-ClassPath: . +Require-Bundle: org.junit;bundle-version="4.10.0", + org.knowhowlab.osgi.testing.assertions;bundle-version="[1.3.0,1.3.1)", + org.knowhowlab.osgi.testing.utils;bundle-version="[1.2.2,1.2.3)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)", + org.eclipse.emf.databinding;bundle-version="1.3.0", + org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.databinding.beans;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)", + org.jsoup;bundle-version="1.7.2", + org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)", + org.slf4j.api;bundle-version="1.7.2", + org.eclipse.osbp.runtime.designer.api;bundle-version="[0.9.0,0.10.0)", + org.eclipse.equinox.ds;bundle-version="1.4.200", + javax.persistence, + javax.validation.api;bundle-version="1.1.0", + org.eclipse.osbp.dsl.dto.lib;bundle-version="0.9.0", + org.eclipse.xtext.xbase.lib;bundle-version="2.11.0", + org.eclipse.osbp.dsl.datatype.lib;bundle-version="0.9.0", + org.eclipse.persistence.core, + org.eclipse.persistence.jpa;bundle-version="2.6.1", + org.apache.derby;bundle-version="10.11.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Vendor: Eclipse OSBP +Bundle-Localization: plugin +Import-Package: javax.servlet;version="2.6.0", + javax.servlet.http;version="2.6.0", + org.osgi.framework;version="1.7.0", + org.osgi.service.cm;version="1.4.0", + org.osgi.service.component;version="1.2.0", + org.osgi.service.http;version="1.2.1" +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.osbp.runtime.tests.Activator +Service-Component: OSGI-INF/*.xml +
diff --git a/org.eclipse.osbp.runtime.tests/META-INF/persistence.xml b/org.eclipse.osbp.runtime.tests/META-INF/persistence.xml new file mode 100644 index 0000000..0b31730 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/META-INF/persistence.xml
@@ -0,0 +1,27 @@ +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" + version="1.0"> + <persistence-unit name="DEFAULT" + transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + <class>org.osbp.tests.entities.BaseID</class> + <class>org.osbp.tests.entities.BaseUUID</class> + <class>org.osbp.tests.entities.DtoTestParent</class> + <class>org.osbp.tests.entities.DtoTestChildContainment</class> + <class>org.osbp.tests.entities.DtoTestChildCrossRef</class> + <class>org.osbp.tests.entities.Mcustomer</class> + <class>org.osbp.tests.entities.CashRegister</class> + <class>org.osbp.tests.entities.CashSlip</class> + <class>org.osbp.tests.entities.CashPosition</class> + <class>org.osbp.tests.entities.CashPayment</class> + <class>org.osbp.tests.entities.CashPaymentMethod</class> + <class>org.osbp.tests.entities.CompanyRelationType</class> + <class>org.osbp.tests.entities.CompanyGroup</class> + <class>org.osbp.tests.entities.Company</class> + <class>org.osbp.tests.entities.Address</class> + <class>org.osbp.tests.entities.Department</class> + + <exclude-unlisted-classes>true</exclude-unlisted-classes> + </persistence-unit> +</persistence>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.AddressDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.AddressDtoMapper.xml new file mode 100644 index 0000000..4f1004a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.AddressDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.addressdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.AddressDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.Address"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.AddressDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.AddressDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.Address + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.addressdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseIDDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseIDDtoMapper.xml new file mode 100644 index 0000000..88dcd7a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseIDDtoMapper.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.baseiddtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.BaseIDDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.BaseID"/> + <property name="fordto.to.dto" type="String" value="org.osbp.tests.dtos.BaseIDDto"/> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.BaseIDDto"/> + <property name="forentity.to.entity" type="String" value="org.osbp.tests.entities.BaseID"/> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.baseiddtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper.xml new file mode 100644 index 0000000..9d43636 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.baseuuiddtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.BaseUUID"/> + <property name="fordto.to.dto" type="String" value="org.osbp.tests.dtos.BaseUUIDDto"/> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.BaseUUIDDto"/> + <property name="forentity.to.entity" type="String" value="org.osbp.tests.entities.BaseUUID"/> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.baseuuiddtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentDtoMapper.xml new file mode 100644 index 0000000..625230f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.cashpaymentdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CashPaymentDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CashPayment"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CashPaymentDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CashPaymentDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CashPayment + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.cashpaymentdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentMethodDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentMethodDtoMapper.xml new file mode 100644 index 0000000..1ea8910 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPaymentMethodDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.cashpaymentmethoddtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CashPaymentMethodDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CashPaymentMethod"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CashPaymentMethodDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CashPaymentMethodDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CashPaymentMethod + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.cashpaymentmethoddtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPositionDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPositionDtoMapper.xml new file mode 100644 index 0000000..0ff4670 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashPositionDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.cashpositiondtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CashPositionDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CashPosition"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CashPositionDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CashPositionDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CashPosition + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.cashpositiondtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashRegisterDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashRegisterDtoMapper.xml new file mode 100644 index 0000000..966e897 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashRegisterDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.cashregisterdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CashRegisterDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CashRegister"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CashRegisterDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CashRegisterDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CashRegister + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.cashregisterdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashSlipDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashSlipDtoMapper.xml new file mode 100644 index 0000000..541e8cf --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CashSlipDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.cashslipdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CashSlipDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CashSlip"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CashSlipDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CashSlipDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CashSlip + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.cashslipdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyDtoMapper.xml new file mode 100644 index 0000000..50ef61d --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.companydtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CompanyDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.Company"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CompanyDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CompanyDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.Company + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.companydtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyGroupDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyGroupDtoMapper.xml new file mode 100644 index 0000000..5c55a8a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyGroupDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.companygroupdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CompanyGroupDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CompanyGroup"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CompanyGroupDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CompanyGroupDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CompanyGroup + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.companygroupdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyRelationTypeDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyRelationTypeDtoMapper.xml new file mode 100644 index 0000000..6d56e74 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.CompanyRelationTypeDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.companyrelationtypedtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.CompanyRelationTypeDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.CompanyRelationType"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.CompanyRelationTypeDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.CompanyRelationTypeDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.CompanyRelationType + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.companyrelationtypedtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DepartmentDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DepartmentDtoMapper.xml new file mode 100644 index 0000000..41a1eab --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DepartmentDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.departmentdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.DepartmentDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.Department"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.DepartmentDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.DepartmentDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.Department + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.departmentdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestBeanDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestBeanDtoMapper.xml new file mode 100644 index 0000000..4970e9f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestBeanDtoMapper.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.dtotestbeandtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.DtoTestBeanDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.DtoTestBean"/> + <property name="fordto.to.dto" type="String" value="org.osbp.tests.dtos.DtoTestBeanDto"/> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.DtoTestBeanDto"/> + <property name="forentity.to.entity" type="String" value="org.osbp.tests.entities.DtoTestBean"/> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.dtotestbeandtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildContainmentDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildContainmentDtoMapper.xml new file mode 100644 index 0000000..9157456 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildContainmentDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.dtotestchildcontainmentdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.DtoTestChildContainmentDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.DtoTestChildContainment"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.DtoTestChildContainmentDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.DtoTestChildContainmentDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.DtoTestChildContainment + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.dtotestchildcontainmentdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildCrossRefDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildCrossRefDtoMapper.xml new file mode 100644 index 0000000..5ef89fc --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestChildCrossRefDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.dtotestchildcrossrefdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.DtoTestChildCrossRefDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.DtoTestChildCrossRef"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.DtoTestChildCrossRefDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.DtoTestChildCrossRefDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.DtoTestChildCrossRef + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.dtotestchildcrossrefdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestParentDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestParentDtoMapper.xml new file mode 100644 index 0000000..43f1a01 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.DtoTestParentDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.dtotestparentdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.DtoTestParentDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.DtoTestParent"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.DtoTestParentDto + org.osbp.tests.dtos.BaseUUIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.DtoTestParentDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.DtoTestParent + org.osbp.tests.entities.BaseUUID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.dtotestparentdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.McustomerDtoMapper.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.McustomerDtoMapper.xml new file mode 100644 index 0000000..b3a5e12 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.mapper.McustomerDtoMapper.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.mapper.mcustomerdtomapper"> + <implementation class="org.osbp.tests.dtos.mapper.McustomerDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.osbp.tests.entities.Mcustomer"/> + <property name="fordto.to.dto" type="String">org.osbp.tests.dtos.McustomerDto + org.osbp.tests.dtos.BaseIDDto + </property> + + <property name="forentity.from.dto" type="String" value="org.osbp.tests.dtos.McustomerDto"/> + <property name="forentity.to.entity" type="String">org.osbp.tests.entities.Mcustomer + org.osbp.tests.entities.BaseID + </property> + + <property name="service.pid" type="String" value="org.osbp.tests.dtos.mapper.mcustomerdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.AddressDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.AddressDtoService.xml new file mode 100644 index 0000000..3651507 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.AddressDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.addressdtoservice"> + <implementation class="org.osbp.tests.dtos.service.AddressDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.AddressDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.addressdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseIDDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseIDDtoService.xml new file mode 100644 index 0000000..5d1f611 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseIDDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.baseiddtoservice"> + <implementation class="org.osbp.tests.dtos.service.BaseIDDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.BaseIDDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.baseiddtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseUUIDDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseUUIDDtoService.xml new file mode 100644 index 0000000..77002af --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.BaseUUIDDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.baseuuiddtoservice"> + <implementation class="org.osbp.tests.dtos.service.BaseUUIDDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.BaseUUIDDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.baseuuiddtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentDtoService.xml new file mode 100644 index 0000000..fd323f0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.cashpaymentdtoservice"> + <implementation class="org.osbp.tests.dtos.service.CashPaymentDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CashPaymentDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.cashpaymentdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentMethodDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentMethodDtoService.xml new file mode 100644 index 0000000..c86e181 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPaymentMethodDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.cashpaymentmethoddtoservice"> + <implementation class="org.osbp.tests.dtos.service.CashPaymentMethodDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CashPaymentMethodDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.cashpaymentmethoddtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPositionDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPositionDtoService.xml new file mode 100644 index 0000000..a29ee10 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashPositionDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.cashpositiondtoservice"> + <implementation class="org.osbp.tests.dtos.service.CashPositionDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CashPositionDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.cashpositiondtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashRegisterDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashRegisterDtoService.xml new file mode 100644 index 0000000..b82f938 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashRegisterDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.cashregisterdtoservice"> + <implementation class="org.osbp.tests.dtos.service.CashRegisterDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CashRegisterDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.cashregisterdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashSlipDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashSlipDtoService.xml new file mode 100644 index 0000000..910fa01 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CashSlipDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.cashslipdtoservice"> + <implementation class="org.osbp.tests.dtos.service.CashSlipDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CashSlipDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.cashslipdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyDtoService.xml new file mode 100644 index 0000000..0a54b09 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.companydtoservice"> + <implementation class="org.osbp.tests.dtos.service.CompanyDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CompanyDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.companydtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyGroupDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyGroupDtoService.xml new file mode 100644 index 0000000..494d99a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyGroupDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.companygroupdtoservice"> + <implementation class="org.osbp.tests.dtos.service.CompanyGroupDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CompanyGroupDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.companygroupdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyRelationTypeDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyRelationTypeDtoService.xml new file mode 100644 index 0000000..fe0be54 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.CompanyRelationTypeDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.companyrelationtypedtoservice"> + <implementation class="org.osbp.tests.dtos.service.CompanyRelationTypeDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.CompanyRelationTypeDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.companyrelationtypedtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DepartmentDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DepartmentDtoService.xml new file mode 100644 index 0000000..005bf31 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DepartmentDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.departmentdtoservice"> + <implementation class="org.osbp.tests.dtos.service.DepartmentDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.DepartmentDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.departmentdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildContainmentDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildContainmentDtoService.xml new file mode 100644 index 0000000..2ea45ec --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildContainmentDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.dtotestchildcontainmentdtoservice"> + <implementation class="org.osbp.tests.dtos.service.DtoTestChildContainmentDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.DtoTestChildContainmentDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.dtotestchildcontainmentdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildCrossRefDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildCrossRefDtoService.xml new file mode 100644 index 0000000..595518f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestChildCrossRefDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.dtotestchildcrossrefdtoservice"> + <implementation class="org.osbp.tests.dtos.service.DtoTestChildCrossRefDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.DtoTestChildCrossRefDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.dtotestchildcrossrefdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestParentDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestParentDtoService.xml new file mode 100644 index 0000000..a67affe --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.DtoTestParentDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.dtotestparentdtoservice"> + <implementation class="org.osbp.tests.dtos.service.DtoTestParentDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.DtoTestParentDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.dtotestparentdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.McustomerDtoService.xml b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.McustomerDtoService.xml new file mode 100644 index 0000000..6201431 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/OSGI-INF/org.osbp.tests.dtos.service.McustomerDtoService.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.osbp.tests.dtos.service.mcustomerdtoservice"> + <implementation class="org.osbp.tests.dtos.service.McustomerDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.osbp.tests.dtos.McustomerDto"/> + <property name="service.pid" type="String" value="org.osbp.tests.dtos.service.mcustomerdtoservice"/> +<reference name="emf" interface="javax.persistence.EntityManagerFactory" cardinality="1..1" + policy="dynamic" bind="bindEmf" unbind="unbindEmf" /> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +</scr:component>
diff --git a/org.eclipse.osbp.runtime.tests/build.properties b/org.eclipse.osbp.runtime.tests/build.properties new file mode 100644 index 0000000..5bef6ac --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/build.properties
@@ -0,0 +1,9 @@ +output.. = target/classes/ +bin.includes = .,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + LICENSE.txt +jars.compile.order = . +source.. = src/ +src.includes = LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.tests/createDDL_ddlGeneration.jdbc b/org.eclipse.osbp.runtime.tests/createDDL_ddlGeneration.jdbc new file mode 100644 index 0000000..313f3cd --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/createDDL_ddlGeneration.jdbc
@@ -0,0 +1,29 @@ +CREATE TABLE MCUSTOMER (ID INTEGER NOT NULL, ACCOUNT_NUM BIGINT, ADDRESS1 VARCHAR(255), ADDRESS2 VARCHAR(255), ADDRESS3 VARCHAR(255), ADDRESS4 VARCHAR(255), BIRTHDATE DATE, CITY VARCHAR(255), COUNTRY VARCHAR(255), DATE_ACCNT_OPENED VARCHAR(255), EDUCATION VARCHAR(255), FNAME VARCHAR(255), FULLNAME VARCHAR(255), GENDER VARCHAR(255), HOUSEOWNER VARCHAR(255), LNAME VARCHAR(255), MARITAL_STATUS VARCHAR(255), MEMBER_CARD VARCHAR(255), MI VARCHAR(255), NUM_CARS_OWNED INTEGER, NUM_CHILDREN_AT_HOME INTEGER, OCCUPATION VARCHAR(255), PHONE1 VARCHAR(255), PHONE2 VARCHAR(255), POSTAL_CODE VARCHAR(255), STATE_PROVINCE VARCHAR(255), TEST VARCHAR(255), TOTAL_CHILDREN INTEGER, YEARLY_INCOME VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE CASH_REGISTER (ID VARCHAR(255) NOT NULL, CURRENT_DAY VARCHAR(255), IP VARCHAR(255), LOCATION VARCHAR(255), NUM VARCHAR(255), PRIMARY KEY (ID)) +CREATE UNIQUE INDEX cashIpIndex ON CASH_REGISTER (ip) +CREATE UNIQUE INDEX cashNumIndex ON CASH_REGISTER (num) +CREATE TABLE CASH_SLIP (ID VARCHAR(255) NOT NULL, CASHIER VARCHAR(255), CURRENT_DAY VARCHAR(255), NOW TIMESTAMP, PAYED SMALLINT DEFAULT 0, SERIAL BIGINT, TOTAL FLOAT, CUSTOMER_ID INTEGER, REGISTER_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE INDEX currentDay_index ON CASH_SLIP (currentDay) +CREATE INDEX serial_index ON CASH_SLIP (currentDay, serial) +CREATE TABLE CASH_POSITION (ID VARCHAR(255) NOT NULL, AMOUNT FLOAT, NOW TIMESTAMP, PRICE FLOAT, QUANTITY FLOAT, SLIP_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE CASH_PAYMENT (ID VARCHAR(255) NOT NULL, NOW TIMESTAMP, PAYED FLOAT, METHOD_OF_PAYMENT_ID VARCHAR(255), SLIP_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE CASH_PAYMENT_METHOD (ID VARCHAR(255) NOT NULL, CREDIT SMALLINT DEFAULT 0, IMAGE_NAME VARCHAR(255), LOWER_LIMIT FLOAT, NAME VARCHAR(255), NUM VARCHAR(255), PRIMARY KEY (ID)) +CREATE UNIQUE INDEX paymentNumIndex ON CASH_PAYMENT_METHOD (num) +CREATE TABLE COMPANY_RELATION_TYPE (ID VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), NAME VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE COMPANY_GROUP (ID VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), NAME VARCHAR(255), MAIN_COMPANY_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE COMPANY (ID VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), NAME VARCHAR(255), COMPANY_GROUP_ID VARCHAR(255), RELATION_TYPE_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE ADDRESS (ID VARCHAR(255) NOT NULL, ADDRESS1 VARCHAR(255), ADDRESS2 VARCHAR(255), CITY VARCHAR(255), COUNTRY VARCHAR(255), EMAIL VARCHAR(255), LANDLINE VARCHAR(255), MOBILE VARCHAR(255), POSTAL_CODE VARCHAR(255), STATE_PROVINCE VARCHAR(255), COMPANY_ID VARCHAR(255), DEPARTMENT_ID VARCHAR(255), PRIMARY KEY (ID)) +CREATE TABLE DEPARTMENT (ID VARCHAR(255) NOT NULL, DEFAULT_YEARLY_INCOME FLOAT, DESCRIPTION VARCHAR(255), NAME VARCHAR(255), COMPANY_ID VARCHAR(255), PRIMARY KEY (ID)) +ALTER TABLE CASH_SLIP ADD CONSTRAINT CASHSLIPREGISTERID FOREIGN KEY (REGISTER_ID) REFERENCES CASH_REGISTER (ID) +ALTER TABLE CASH_SLIP ADD CONSTRAINT CASHSLIPCUSTOMERID FOREIGN KEY (CUSTOMER_ID) REFERENCES MCUSTOMER (ID) +ALTER TABLE CASH_POSITION ADD CONSTRAINT CASHPOSITIONSLIPID FOREIGN KEY (SLIP_ID) REFERENCES CASH_SLIP (ID) +ALTER TABLE CASH_PAYMENT ADD CONSTRAINT CSHPYMNMTHDFPYMNTD FOREIGN KEY (METHOD_OF_PAYMENT_ID) REFERENCES CASH_PAYMENT_METHOD (ID) +ALTER TABLE CASH_PAYMENT ADD CONSTRAINT CASHPAYMENTSLIP_ID FOREIGN KEY (SLIP_ID) REFERENCES CASH_SLIP (ID) +ALTER TABLE COMPANY_GROUP ADD CONSTRAINT CMPNYGRUPMNCMPNYID FOREIGN KEY (MAIN_COMPANY_ID) REFERENCES COMPANY (ID) +ALTER TABLE COMPANY ADD CONSTRAINT CMPNYCMPANYGROUPID FOREIGN KEY (COMPANY_GROUP_ID) REFERENCES COMPANY_GROUP (ID) +ALTER TABLE COMPANY ADD CONSTRAINT CMPANYRLTIONTYPEID FOREIGN KEY (RELATION_TYPE_ID) REFERENCES COMPANY_RELATION_TYPE (ID) +ALTER TABLE ADDRESS ADD CONSTRAINT ADDRESS_COMPANY_ID FOREIGN KEY (COMPANY_ID) REFERENCES COMPANY (ID) +ALTER TABLE ADDRESS ADD CONSTRAINT DDRESSDEPARTMENTID FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (ID) +ALTER TABLE DEPARTMENT ADD CONSTRAINT DPARTMENTCOMPANYID FOREIGN KEY (COMPANY_ID) REFERENCES COMPANY (ID) +CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME)) +INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)
diff --git a/org.eclipse.osbp.runtime.tests/dropDDL_ddlGeneration.jdbc b/org.eclipse.osbp.runtime.tests/dropDDL_ddlGeneration.jdbc new file mode 100644 index 0000000..d6290be --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/dropDDL_ddlGeneration.jdbc
@@ -0,0 +1,28 @@ +ALTER TABLE CASH_SLIP DROP CONSTRAINT CASHSLIPREGISTERID +ALTER TABLE CASH_SLIP DROP CONSTRAINT CASHSLIPCUSTOMERID +ALTER TABLE CASH_POSITION DROP CONSTRAINT CASHPOSITIONSLIPID +ALTER TABLE CASH_PAYMENT DROP CONSTRAINT CSHPYMNMTHDFPYMNTD +ALTER TABLE CASH_PAYMENT DROP CONSTRAINT CASHPAYMENTSLIP_ID +ALTER TABLE COMPANY_GROUP DROP CONSTRAINT CMPNYGRUPMNCMPNYID +ALTER TABLE COMPANY DROP CONSTRAINT CMPNYCMPANYGROUPID +ALTER TABLE COMPANY DROP CONSTRAINT CMPANYRLTIONTYPEID +ALTER TABLE ADDRESS DROP CONSTRAINT ADDRESS_COMPANY_ID +ALTER TABLE ADDRESS DROP CONSTRAINT DDRESSDEPARTMENTID +ALTER TABLE DEPARTMENT DROP CONSTRAINT DPARTMENTCOMPANYID +DROP TABLE MCUSTOMER +DROP INDEX cashIpIndex +DROP INDEX cashNumIndex +DROP TABLE CASH_REGISTER +DROP INDEX currentDay_index +DROP INDEX serial_index +DROP TABLE CASH_SLIP +DROP TABLE CASH_POSITION +DROP TABLE CASH_PAYMENT +DROP INDEX paymentNumIndex +DROP TABLE CASH_PAYMENT_METHOD +DROP TABLE COMPANY_RELATION_TYPE +DROP TABLE COMPANY_GROUP +DROP TABLE COMPANY +DROP TABLE ADDRESS +DROP TABLE DEPARTMENT +DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'
diff --git a/org.eclipse.osbp.runtime.tests/emfmodel/model.ecore b/org.eclipse.osbp.runtime.tests/emfmodel/model.ecore new file mode 100644 index 0000000..8c8a081 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/emfmodel/model.ecore
@@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.osbp.org/vaadin/presentation/tests" + nsPrefix="model"> + <eClassifiers xsi:type="ecore:EClass" name="EmfFoo"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EmfBar"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="myfoo" eType="#//EmfFoo" + containment="true"/> + </eClassifiers> +</ecore:EPackage>
diff --git a/org.eclipse.osbp.runtime.tests/emfmodel/model.genmodel b/org.eclipse.osbp.runtime.tests/emfmodel/model.genmodel new file mode 100644 index 0000000..9681efe --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/emfmodel/model.genmodel
@@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src" + modelPluginID="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests" modelName="Model" + rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" importerID="org.eclipse.emf.importer.ecore" + complianceLevel="6.0" copyrightFields="false" operationReflection="true" importOrganizing="true"> + <foreignModel>model.ecore</foreignModel> + <genPackages prefix="Model" basePackage="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf" + disposableProviderFactory="true" ecorePackage="model.ecore#/"> + <genClasses ecoreClass="model.ecore#//Foo"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//Foo/name"/> + </genClasses> + <genClasses ecoreClass="model.ecore#//Bar"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//Bar/name"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference model.ecore#//Bar/myfoos"/> + </genClasses> + </genPackages> +</genmodel:GenModel>
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N.properties new file mode 100644 index 0000000..4996311 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N.properties
@@ -0,0 +1,117 @@ +#default +account_num=account_num +activation_time=activation_time +actual_owner=actual_owner +addon=addon +addons=addons +address=address +address1=address1 +address2=address2 +address3=address3 +address4=address4 +amount=amount +beanx=beanx +birthdate=birthdate +car=car +cash_payment=cash_payment +cash_payment_method=cash_payment_method +cash_position=cash_position +cash_register=cash_register +cash_slip=cash_slip +cashier=cashier +city=city +companies=companies +company=company +company_group=company_group +company_relation_type=company_relation_type +container=container +containment_childs=containment_childs +country=country +created_by=created_by +created_on=created_on +credit=credit +cross_ref_child=cross_ref_child +cross_ref_childs=cross_ref_childs +current_day=current_day +customer=customer +cycles1=cycles1 +cycles2=cycles2 +date_accnt_opened=date_accnt_opened +default_yearly_income=default_yearly_income +department=department +departments=departments +description=description +dto_test_bean=dto_test_bean +dto_test_child_containment=dto_test_child_containment +dto_test_child_cross_ref=dto_test_child_cross_ref +dto_test_parent=dto_test_parent +education=education +email=email +expiration_time=expiration_time +finishing_date=finishing_date +firstname=firstname +fname=fname +foo=foo +fullname=fullname +gender=gender +home_address=home_address +houseowner=houseowner +id=id +image_name=image_name +ip=ip +landline=landline +lastname=lastname +lname=lname +location=location +lower_limit=lower_limit +main_company=main_company +marital_status=marital_status +mcustomer=mcustomer +member_card=member_card +method_of_payment=method_of_payment +mi=mi +mobile=mobile +name=name +now=now +num=num +num_cars_owned=num_cars_owned +num_children_at_home=num_children_at_home +number=number +occupation=occupation +owner=owner +owns_cars=owns_cars +parent=parent +payed=payed +payments=payments +person=person +phone1=phone1 +phone2=phone2 +positions=positions +postal_code=postal_code +postalcode=postalcode +price=price +priority=priority +process_id=process_id +process_instance_id=process_instance_id +process_session_id=process_session_id +quantity=quantity +register=register +relation_type=relation_type +serial=serial +slip=slip +slips=slips +state_province=state_province +status=status +streetname=streetname +string=string +subject=subject +task_id=task_id +test=test +to_cycle1=to_cycle1 +to_cycle2=to_cycle2 +total=total +total_children=total_children +uuid=uuid +when=when +work_address=work_address +yearly_income=yearly_income
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N_de.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N_de.properties new file mode 100644 index 0000000..647739a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N_de.properties
@@ -0,0 +1,117 @@ +#de +account_num=Account number +activation_time=Activation time +actual_owner=Actual owner +addon=Addon +addons=Addons +address=Address +address1=Address1 +address2=Address2 +address3=Address3 +address4=Address4 +amount=Amount +beanx=Beanx +birthdate=Birthdate +car=Car +cash_payment=Cash payment +cash_payment_method=Cash payment method +cash_position=Cash position +cash_register=Cash register +cash_slip=Cash slip +cashier=Cashier +city=City +companies=Companies +company=Company +company_group=Company group +company_relation_type=Company relation type +container=Container +containment_childs=Containment childs +country=Country +created_by=Created by +created_on=Created on +credit=Credit +cross_ref_child=Cross reference child +cross_ref_childs=Cross reference childs +current_day=Current day +customer=Customer +cycles1=Cycles1 +cycles2=Cycles2 +date_accnt_opened=Date account opened +default_yearly_income=Default yearly income +department=Department +departments=Departments +description=Description +dto_test_bean=Dto test bean +dto_test_child_containment=Dto test child containment +dto_test_child_cross_ref=Dto test child cross reference +dto_test_parent=Dto test parent +education=Education +email=Email +expiration_time=Expiration time +finishing_date=Finishing date +firstname=Firstname +fname=Fname +foo=Foo +fullname=Fullname +gender=Gender +home_address=Home address +houseowner=Houseowner +id=Identifier +image_name=Image name +ip=Ip +landline=Landline +lastname=Lastname +lname=Lname +location=Location +lower_limit=Lower limit +main_company=Main company +marital_status=Marital status +mcustomer=Mcustomer +member_card=Member card +method_of_payment=Method of payment +mi=Mi +mobile=Mobile +name=Name +now=Now +num=Number +num_cars_owned=Number cars owned +num_children_at_home=Number children at home +number=Number +occupation=Occupation +owner=Owner +owns_cars=Owns cars +parent=Parent +payed=Payed +payments=Payments +person=Person +phone1=Phone1 +phone2=Phone2 +positions=Positions +postal_code=Postal code +postalcode=Postalcode +price=Price +priority=Priority +process_id=Process identifier +process_instance_id=Process instance identifier +process_session_id=Process session identifier +quantity=Quantity +register=Register +relation_type=Relation type +serial=Serial +slip=Slip +slips=Slips +state_province=State province +status=Status +streetname=Streetname +string=String +subject=Subject +task_id=Task identifier +test=Test +to_cycle1=To cycle1 +to_cycle2=To cycle2 +total=Total +total_children=Total children +uuid=Uuid +when=When +work_address=Work address +yearly_income=Yearly income
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N_de_AT.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N_de_AT.properties new file mode 100644 index 0000000..6c73e1d --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N_de_AT.properties
@@ -0,0 +1 @@ +#de_AT
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N_en.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N_en.properties new file mode 100644 index 0000000..2d6e363 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N_en.properties
@@ -0,0 +1,117 @@ +#en +account_num=Account number +activation_time=Activation time +actual_owner=Actual owner +addon=Addon +addons=Addons +address=Address +address1=Address1 +address2=Address2 +address3=Address3 +address4=Address4 +amount=Amount +beanx=Beanx +birthdate=Birthdate +car=Car +cash_payment=Cash payment +cash_payment_method=Cash payment method +cash_position=Cash position +cash_register=Cash register +cash_slip=Cash slip +cashier=Cashier +city=City +companies=Companies +company=Company +company_group=Company group +company_relation_type=Company relation type +container=Container +containment_childs=Containment childs +country=Country +created_by=Created by +created_on=Created on +credit=Credit +cross_ref_child=Cross reference child +cross_ref_childs=Cross reference childs +current_day=Current day +customer=Customer +cycles1=Cycles1 +cycles2=Cycles2 +date_accnt_opened=Date account opened +default_yearly_income=Default yearly income +department=Department +departments=Departments +description=Description +dto_test_bean=Dto test bean +dto_test_child_containment=Dto test child containment +dto_test_child_cross_ref=Dto test child cross reference +dto_test_parent=Dto test parent +education=Education +email=Email +expiration_time=Expiration time +finishing_date=Finishing date +firstname=Firstname +fname=Fname +foo=Foo +fullname=Fullname +gender=Gender +home_address=Home address +houseowner=Houseowner +id=Identifier +image_name=Image name +ip=Ip +landline=Landline +lastname=Lastname +lname=Lname +location=Location +lower_limit=Lower limit +main_company=Main company +marital_status=Marital status +mcustomer=Mcustomer +member_card=Member card +method_of_payment=Method of payment +mi=Mi +mobile=Mobile +name=Name +now=Now +num=Number +num_cars_owned=Number cars owned +num_children_at_home=Number children at home +number=Number +occupation=Occupation +owner=Owner +owns_cars=Owns cars +parent=Parent +payed=Payed +payments=Payments +person=Person +phone1=Phone1 +phone2=Phone2 +positions=Positions +postal_code=Postal code +postalcode=Postalcode +price=Price +priority=Priority +process_id=Process identifier +process_instance_id=Process instance identifier +process_session_id=Process session identifier +quantity=Quantity +register=Register +relation_type=Relation type +serial=Serial +slip=Slip +slips=Slips +state_province=State province +status=Status +streetname=Streetname +string=String +subject=Subject +task_id=Task identifier +test=Test +to_cycle1=To cycle1 +to_cycle2=To cycle2 +total=Total +total_children=Total children +uuid=Uuid +when=When +work_address=Work address +yearly_income=Yearly income
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N_en_US.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N_en_US.properties new file mode 100644 index 0000000..d89e21c --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N_en_US.properties
@@ -0,0 +1 @@ +#en_US
diff --git a/org.eclipse.osbp.runtime.tests/i18n/I18N_fr.properties b/org.eclipse.osbp.runtime.tests/i18n/I18N_fr.properties new file mode 100644 index 0000000..a84da83 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/i18n/I18N_fr.properties
@@ -0,0 +1 @@ +#fr
diff --git a/org.eclipse.osbp.runtime.tests/models/mysmartshop.datatype b/org.eclipse.osbp.runtime.tests/models/mysmartshop.datatype new file mode 100644 index 0000000..1ef90d2 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/models/mysmartshop.datatype
@@ -0,0 +1,162 @@ +/****************************************************************** + * * + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * * + * This source was created by OSBP Softwarefactory Wizard! * + * * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany * + * * + *================================================================* + * * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + * * + ******************************************************************/ + +/** + * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ + +package org.osbp.mysmartshop.datatypes { + + datatype Timestamp dateType timestamp + datatype PaymentMethod jvmType String + datatype boolean jvmType java.lang.Boolean as primitive; + datatype short jvmType java.lang.Short as primitive; + datatype int jvmType java.lang.Integer as primitive; + datatype long jvmType java.lang.Long as primitive; + datatype double jvmType java.lang.Double as primitive; + datatype float jvmType java.lang.Float as primitive; + datatype character jvmType java.lang.Character as primitive; + datatype byte jvmType java.lang.Byte as primitive; + + datatype Boolean jvmType java.lang.Boolean; + datatype Short jvmType java.lang.Short; + datatype Int jvmType java.lang.Integer; + datatype Long jvmType java.lang.Long; + datatype Double jvmType java.lang.Double; + datatype Float jvmType java.lang.Float; + datatype Character jvmType java.lang.Character; + datatype Byte jvmType java.lang.Byte; + datatype BigDecimal jvmType java.math.BigDecimal; + + datatype String jvmType java.lang.String; + datatype BlobMapping jvmType java.lang.String + properties ( + key="Blob" value="2" + /** + * value="0" name="unnormalized" resolution="unknown" + * value="1" name="small" resolution="16x16" + * value="2" name="mid" resolution="64x64" + * value="3" name="portrait" resolution="64x128" + * value="4" name="landscape" resolution="128x64" + * value="5" name="big" resolution="200x-1" + * + */ + ); + + datatype notnullString jvmType String isNotNull [severity=error] + datatype Date dateType date; + datatype Price jvmType Double properties(key="decimalformat" value="###,##0.00 ¤"); + datatype DateOnly dateType date properties(key = "Date" value = "Day"); + datatype BirthDate dateType date isNotNull isPast [severity=error] properties(key = "Date" value = "Day"); + datatype Time dateType time; + datatype blobtype as blob; + datatype clobtype as blob; + datatype NumberToUomo jvmType java.lang.Double; + datatype TextArea jvmType java.lang.String properties(key = "TextArea" value = "5"); // used for TextArea + + /** + * The RichText_Short datatype represents the attribute as a RichTextArea. + * The max length of the input depends on the underlying database. + * If you need to hold bigger data, then use the #RichText_Long. + */ + datatype RichText_Short jvmType String + properties(key = "type" value = "richTextArea"); + /** + * The RichText datatype represents the attribute as a RichTextArea. + * The type in the data model will be a Blob. + */ + datatype RichText_Long as blob + properties(key = "type" value = "richTextArea"); + /** + * The Password datatype represents the attribute as a PasswordField. + * The type in the data model will be a String. + */ + datatype Password jvmType String + properties(key = "type" value = "password"); + + /** + * The MaskedText datatype represents the attribute as a MaskedTextField. + * The type in the data model will be a String.<br> + * If you are using this datatype, then you need to add a map property to the entity / dto attiribute.<br> + * Eg: <br> + * <code>var MaskedText text properties (key="mask" value="UUU-###")</code> + */ + datatype MaskedText jvmType String + properties(key = "type" value = "maskedText"); + + /** + * The MaskedDecimal datatype represents the attribute as a MaskedDecimalField. + * The type in the data model will be a Number.<br> + * If you are using this datatype, then you need to add a map property to the entity / dto attiribute.<br> + * Eg: <br> + * <code>var MaskedDecimal dec properties (key="mask" value="#,#00.000")</code> + */ + datatype MaskedText jvmType String + properties(key = "type" value = "maskedDecimal"); + + /** + * The MaskedText datatype represents the attribute as a MaskedTextField. + * The type in the data model will be a String. + */ + datatype MaskedDecimal jvmType String + properties(key = "type" value = "maskedDecimal"); + + datatype PriceCustomDecimal jvmType java.lang.Double as primitive + properties ( + key="functionCss" value="org.osbp.mysmartshop.functionlibrary.CssStyler.priceEndCss99", + key="functionConverter" value="org.osbp.mysmartshop.functionlibrary.Formatter.currencyFormatter" + ); + + datatype LengthCustomDecimal jvmType java.lang.Double as primitive + properties ( + key="functionCss" value="org.osbp.mysmartshop.functionlibrary.CssStyler.priceEndCss95", + key="functionConverter" value="org.osbp.mysmartshop.functionlibrary.UomoConverter" + ); + + datatype LengthMetricCustomDecimal jvmType java.lang.Double as primitive + properties ( + key="functionCss" value="org.osbp.mysmartshop.functionlibrary.CssStyler.priceEndCss95", + key="functionConverter" value="org.osbp.mysmartshop.functionlibrary.UomoCMConverter" + ); + + datatype LengthCMMetricCustomDecimal jvmType java.lang.Double as primitive + properties ( + key="functionConverter" value="org.osbp.mysmartshop.functionlibrary.UomoCMMetricConverter" + ); + + datatype MassGRAMMetricCustomDecimal jvmType java.lang.Double as primitive + properties ( + key="functionConverter" value="org.osbp.mysmartshop.functionlibrary.UomoGRAMMetricConverter" + ); + +// // UOMo data types, which are available through de.compex.utils.uomo +// datatype Length jvmType org.eclipse.uomo.units.impl.BaseAmount<org.unitsofmeasurement.quantity.Length>; +// datatype Area jvmType org.eclipse.uomo.units.impl.BaseAmount<org.unitsofmeasurement.quantity.Area>; +// datatype Volume jvmType org.eclipse.uomo.units.impl.BaseAmount<org.unitsofmeasurement.quantity.Volume>; +// datatype Mass jvmType org.eclipse.uomo.units.impl.BaseAmount<org.unitsofmeasurement.quantity.Mass>; +// // joda money types +// datatype Money jvmType org.joda.money.Money; +// datatype BigMoney jvmType org.joda.money.BigMoney; + +} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.tests/models/mysmartshop.dto b/org.eclipse.osbp.runtime.tests/models/mysmartshop.dto new file mode 100644 index 0000000..4a26227 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/models/mysmartshop.dto
@@ -0,0 +1,186 @@ +import ns org.osbp.tests.entities.BaseID +import ns org.osbp.tests.entities.BaseUUID +import ns org.osbp.tests.entities.DtoTestParent +import ns org.osbp.tests.entities.DtoTestChildContainment +import ns org.osbp.tests.entities.DtoTestChildCrossRef +import ns org.osbp.tests.entities.DtoTestBean +import ns org.osbp.tests.entities.Mcustomer +import ns org.osbp.tests.entities.CashRegister +import ns org.osbp.tests.entities.CashSlip +import ns org.osbp.tests.entities.CashPosition +import ns org.osbp.tests.entities.CashPayment +import ns org.osbp.tests.entities.CashPaymentMethod +import ns org.osbp.tests.entities.CompanyRelationType +import ns org.osbp.tests.entities.CompanyGroup +import ns org.osbp.tests.entities.Company +import ns org.osbp.tests.entities.Address +import ns org.osbp.tests.entities.Department +package org.osbp.tests.dtos { + autoDto BaseIDDto wraps BaseID { + + inherit var ^id + } + + autoDto BaseUUIDDto wraps BaseUUID { + + inherit var ^id + } + + autoDto DtoTestParentDto extends BaseUUIDDto wraps DtoTestParent { + + inherit var string + inherit ref containmentChilds mapto DtoTestChildContainmentDto + inherit ref crossRefChilds mapto DtoTestChildCrossRefDto + inherit ref crossRefChild mapto DtoTestChildCrossRefDto + inherit var beanx mapto DtoTestBeanDto + } + + autoDto DtoTestChildContainmentDto extends BaseUUIDDto wraps DtoTestChildContainment { + + inherit ref container mapto DtoTestParentDto + } + + autoDto DtoTestChildCrossRefDto extends BaseUUIDDto wraps DtoTestChildCrossRef { + + inherit ref container mapto DtoTestParentDto + } + + autoDto DtoTestBeanDto wraps DtoTestBean { + + inherit var foo + inherit ref crossRefChild mapto DtoTestChildCrossRefDto + } + + autoDto McustomerDto extends BaseIDDto wraps Mcustomer { + + inherit var account_num + inherit var lname + inherit var fname + inherit var mi + inherit var address1 + inherit var address2 + inherit var address3 + inherit var address4 + inherit var city + inherit var state_province + inherit var postal_code + inherit var country + inherit var phone1 + inherit var phone2 + inherit var birthdate + inherit var marital_status + inherit var yearly_income + inherit var gender + inherit var total_children + inherit var num_children_at_home + inherit var education + inherit var date_accnt_opened + inherit var member_card + inherit var occupation + inherit var houseowner + inherit var num_cars_owned + inherit var fullname + inherit var test + inherit ref slips mapto CashSlipDto + inherit var foo + } + + autoDto CashRegisterDto extends BaseUUIDDto wraps CashRegister { + + inherit var num + inherit var ip + inherit var location + inherit var currentDay + inherit ref slips mapto CashSlipDto + } + + autoDto CashSlipDto extends BaseUUIDDto wraps CashSlip { + + inherit var currentDay + inherit var now + inherit var cashier + inherit var total + inherit var serial + inherit var payed + inherit ref positions mapto CashPositionDto + inherit ref customer mapto McustomerDto + inherit ref register mapto CashRegisterDto + inherit ref payments mapto CashPaymentDto + } + + autoDto CashPositionDto extends BaseUUIDDto wraps CashPosition { + + inherit var now + inherit var quantity + inherit var price + inherit var amount + inherit ref slip mapto CashSlipDto + } + + autoDto CashPaymentDto extends BaseUUIDDto wraps CashPayment { + + inherit var now + inherit var payed + inherit ref slip mapto CashSlipDto + inherit ref methodOfPayment mapto CashPaymentMethodDto + } + + autoDto CashPaymentMethodDto extends BaseUUIDDto wraps CashPaymentMethod { + + inherit var num + inherit var name + inherit var credit + inherit var imageName + inherit var lowerLimit + inherit ref payments mapto CashPaymentDto + } + + autoDto CompanyRelationTypeDto extends BaseUUIDDto wraps CompanyRelationType { + + inherit var name + inherit var description + } + + autoDto CompanyGroupDto extends BaseUUIDDto wraps CompanyGroup { + + inherit var name + inherit var description + inherit ref main_company mapto CompanyDto + inherit ref companies mapto CompanyDto + } + + autoDto CompanyDto extends BaseUUIDDto wraps Company { + + inherit ref company_group mapto CompanyGroupDto + inherit var name + inherit var description + inherit ref relation_type mapto CompanyRelationTypeDto + inherit ref address mapto AddressDto + inherit ref departments mapto DepartmentDto + } + + autoDto AddressDto extends BaseUUIDDto wraps Address { + + inherit ref company mapto CompanyDto + inherit ref department mapto DepartmentDto + inherit var address1 + inherit var address2 + inherit var city + inherit var state_province + inherit var postal_code + inherit var country + inherit var email + inherit var landline + inherit var mobile + } + + autoDto DepartmentDto extends BaseUUIDDto wraps Department { + + inherit ref company mapto CompanyDto + inherit var name + inherit var description + inherit ref address mapto AddressDto + inherit var default_yearly_income + } + + } \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.tests/models/mysmartshop.entity b/org.eclipse.osbp.runtime.tests/models/mysmartshop.entity new file mode 100644 index 0000000..f197dc7 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/models/mysmartshop.entity
@@ -0,0 +1,257 @@ +import java.text.DateFormat +import java.text.SimpleDateFormat +import javax.persistence.GeneratedValue +import ns org.osbp.mysmartshop.datatypes.Boolean +import ns org.osbp.mysmartshop.datatypes.Date +import ns org.osbp.mysmartshop.datatypes.PaymentMethod +import ns org.osbp.mysmartshop.datatypes.Price +import ns org.osbp.mysmartshop.datatypes.String +import ns org.osbp.mysmartshop.datatypes.Timestamp +import ns org.osbp.mysmartshop.datatypes.boolean +import ns org.osbp.mysmartshop.datatypes.double +import ns org.osbp.mysmartshop.datatypes.int +import ns org.osbp.mysmartshop.datatypes.long + +/****************************************************************** + * * + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * * + * This source was created by OSBP Softwarefactory Wizard! * + * * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany * + * * + *================================================================* + * * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + * * + ******************************************************************/ +package org.osbp.tests.entities { + + mapped superclass BaseID { + id int id; + } + + mapped superclass BaseUUID { + uuid String id; + } + + entity DtoTestParent extends BaseUUID { + + var String string; + + ref cascade DtoTestChildContainment [*] containmentChilds opposite container + + ref DtoTestChildCrossRef [*] crossRefChilds opposite container + ref DtoTestChildCrossRef crossRefChild + + var DtoTestBean beanx; + } + + entity DtoTestChildContainment extends BaseUUID { + ref DtoTestParent container opposite containmentChilds + } + + entity DtoTestChildCrossRef extends BaseUUID { + ref DtoTestParent container opposite crossRefChilds + } + + bean DtoTestBean { + var String foo; + ref DtoTestChildCrossRef crossRefChild; + } + + entity Mcustomer extends BaseID { + var long account_num + var String lname + var String fname + var String mi + var String address1 + var String address2 + var String address3 + var String address4 + var String city + var String state_province + var String postal_code + var String country + var String phone1 + var String phone2 + var Date birthdate + var String marital_status + var String yearly_income + var String gender + var int total_children + var int num_children_at_home + var String education + var String date_accnt_opened + var String member_card + var String occupation + var String houseowner + var int num_cars_owned + domainKey String fullname + var String test + ref CashSlip [*] slips opposite customer + + derived String foo { + return country + "_" + city + } + } + + cacheable entity CashRegister extends BaseUUID { + domainKey String num + var String ip + var String location + var String currentDay + ref CashSlip [*] slips opposite register + + unique index cashIpIndex { + ip + } + + unique index cashNumIndex { + num + } + + } + + entity CashSlip extends BaseUUID { + var String currentDay + var Timestamp now + var String cashier + var Price total + @javax.persistence.GeneratedValue + var long serial + var boolean payed + ref cascade CashPosition [*] positions opposite slip + ref Mcustomer customer opposite slips + ref CashRegister register opposite slips + ref cascade CashPayment [*] payments opposite slip + def String when() { + if(now !== null) + { + return java.text.SimpleDateFormat.getDateInstance(java.text.DateFormat.SHORT).format(now) + } return "" + } + + index currentDay_index { + currentDay + } + + index serial_index { + currentDay , serial + } + + } + + entity CashPosition extends BaseUUID { + var Timestamp now + var double quantity + var Price price + var Price amount + ref CashSlip slip opposite positions + } + + entity CashPayment extends BaseUUID { + var Timestamp now + var Price payed + ref CashSlip slip opposite payments + ref CashPaymentMethod methodOfPayment opposite payments + } + + entity CashPaymentMethod extends BaseUUID { + domainKey String num + domainDescription String name + var Boolean credit + var PaymentMethod imageName + var double lowerLimit + ref CashPayment [*] payments opposite methodOfPayment + + unique index paymentNumIndex { + num + } + + } + + /** relation of the company to the owner - not the user - of this personal information manager */ + entity CompanyRelationType extends BaseUUID { + /** short name for this relation type */ + domainKey String name; + /** more detailed description */ + var String description; + } + + /** a company group consisting of a group of companies, from one is defined as the main company */ + entity CompanyGroup extends BaseUUID { + /** name of the company group */ + domainKey String name; + /** more detailed description with usable information for the PIM owner */ + var String description; + /** the main company */ + ref Company main_company; + /** group of companies */ + ref Company [*] companies opposite company_group; + } + + /** a company */ + entity Company extends BaseUUID { + /** the company group if any */ + ref CompanyGroup company_group opposite companies; + /** name of the company */ + domainKey String name; + /** more detailed description with usable information for the PIM owner */ + var String description; + /** relation of the company to the PIM owner */ + ref CompanyRelationType relation_type; + /** any number of addresses */ + ref cascade Address [*] address opposite company; + /** departments of this company */ + ref cascade Department [*] departments opposite company; + } + + /** an address */ + entity Address extends BaseUUID { + /** if address for a company, the company is given */ + ref Company company opposite address; + /** if address for a department, the address is given */ + ref Department department opposite address; + /** if address for a person, the person is given */ + // ref cascade PostalAddress[*] postal_adresses opposite address; + /** address field 1 */ + var String address1; + /** address field 2 */ + var String address2; + /** city */ + var String city; + /** state province */ + var String state_province; + /** postal code */ + var String postal_code; + /** country */ + var String country; + // ref cascade Email[*] emails opposite address; + /** email */ + var String email; + // ref cascade Phone[*] phones opposite address; + /** landline (Festnetznummer) */ + var String landline; + /** mobile */ + var String mobile; + } + + /** a companies department */ + entity Department extends BaseUUID { + /** the company */ + ref Company company opposite departments; + /** name of the department */ + domainKey String name; + /** more detailed description with usable information for the PIM owner */ + var String description; + /** any number of addresses */ + ref cascade Address [*] address opposite department; + /** any number of employees */ + var double default_yearly_income; + } + + } \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.tests/models/mysmartshop.service b/org.eclipse.osbp.runtime.tests/models/mysmartshop.service new file mode 100644 index 0000000..8e97139 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/models/mysmartshop.service
@@ -0,0 +1,34 @@ +import ns org.osbp.tests.dtos.BaseIDDto +import ns org.osbp.tests.dtos.BaseUUIDDto +import ns org.osbp.tests.dtos.DtoTestParentDto +import ns org.osbp.tests.dtos.DtoTestChildContainmentDto +import ns org.osbp.tests.dtos.DtoTestChildCrossRefDto +import ns org.osbp.tests.dtos.McustomerDto +import ns org.osbp.tests.dtos.CashRegisterDto +import ns org.osbp.tests.dtos.CashSlipDto +import ns org.osbp.tests.dtos.CashPositionDto +import ns org.osbp.tests.dtos.CashPaymentDto +import ns org.osbp.tests.dtos.CashPaymentMethodDto +import ns org.osbp.tests.dtos.CompanyRelationTypeDto +import ns org.osbp.tests.dtos.CompanyGroupDto +import ns org.osbp.tests.dtos.CompanyDto +import ns org.osbp.tests.dtos.AddressDto +import ns org.osbp.tests.dtos.DepartmentDto +package org.osbp.tests.dtos.service { + dtoservice BaseIDDtoService provides BaseIDDto { + } dtoservice BaseUUIDDtoService provides BaseUUIDDto { + } dtoservice DtoTestParentDtoService provides DtoTestParentDto { + } dtoservice DtoTestChildContainmentDtoService provides DtoTestChildContainmentDto { + } dtoservice DtoTestChildCrossRefDtoService provides DtoTestChildCrossRefDto { + } dtoservice McustomerDtoService provides McustomerDto { + } dtoservice CashRegisterDtoService provides CashRegisterDto { + } dtoservice CashSlipDtoService provides CashSlipDto { + } dtoservice CashPositionDtoService provides CashPositionDto { + } dtoservice CashPaymentDtoService provides CashPaymentDto { + } dtoservice CashPaymentMethodDtoService provides CashPaymentMethodDto { + } dtoservice CompanyRelationTypeDtoService provides CompanyRelationTypeDto { + } dtoservice CompanyGroupDtoService provides CompanyGroupDto { + } dtoservice CompanyDtoService provides CompanyDto { + } dtoservice AddressDtoService provides AddressDto { + } dtoservice DepartmentDtoService provides DepartmentDto { + } } \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.tests/plugin.properties b/org.eclipse.osbp.runtime.tests/plugin.properties new file mode 100644 index 0000000..24680b9 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/plugin.properties
@@ -0,0 +1,4 @@ +# + +pluginName = Model Model +providerName = www.example.org
diff --git a/org.eclipse.osbp.runtime.tests/plugin.xml b/org.eclipse.osbp.runtime.tests/plugin.xml new file mode 100644 index 0000000..36f8abb --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/plugin.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- +--> + +<plugin> + + <extension point="org.eclipse.emf.ecore.generated_package"> + <!-- @generated model --> + <package + uri="http://www.osbp.org/vaadin/presentation/tests" + class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage" + genModel="emfmodel/model.genmodel"/> + </extension> + +</plugin>
diff --git a/org.eclipse.osbp.runtime.tests/pom.xml b/org.eclipse.osbp.runtime.tests/pom.xml new file mode 100644 index 0000000..db127a4 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/pom.xml
@@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--#======================================================================= --> +<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany). --> +<!--# All rights reserved. This program and the accompanying materials --> +<!--# are made available under the terms of the Eclipse Public License v1.0 --> +<!--# which accompanies this distribution, and is available at --> +<!--# http://www.eclipse.org/legal/epl-v10.html --> +<!--# --> +<!--# Contributors: --> +<!--# Florian Pirchner - initial API and implementation --> +<!--#======================================================================= --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.eclipse.osbp.runtime.web</groupId> + <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId> + <version>0.9.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <artifactId>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</artifactId> + <packaging>eclipse-test-plugin</packaging> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </reporting> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/*Test.class</include> + <include>**/*Tests.class</include> + </includes> + <failIfNoTests>false</failIfNoTests> + <showEclipseLog>true</showEclipseLog> + <!-- <argLine>${ui.test.vmargs}</argLine> --> + <bundleStartLevel> + <bundle> + <id>org.eclipse.osgi</id> + <level>-1</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.equinox.common</id> + <level>1</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.equinox.ds</id> + <level>2</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.equinox.log</id> + <level>1</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.osgi.services</id> + <level>1</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.osbp.ecview.core.common.editparts.emf</id> + <level>4</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.osbp.ecview.core.extension.editparts.emf</id> + <level>4</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</id> + <level>4</level> + <autoStart>true</autoStart> + </bundle> + <bundle> + <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</id> + <level>4</level> + <autoStart>true</autoStart> + </bundle> + </bundleStartLevel> + + <dependencies> + <!-- Plugins --> + <dependency> + <type>eclipse-plugin</type> + <artifactId>org.eclipse.equinox.ds</artifactId> + <version>0.0.0</version> + </dependency> + <dependency> + <type>eclipse-plugin</type> + <artifactId>org.eclipse.equinox.util</artifactId> + <version>0.0.0</version> + </dependency> + </dependencies> + + <useUIHarness>false</useUIHarness> + <useUIThread>false</useUIThread> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <osbp.skip.javadoc>true</osbp.skip.javadoc> + </properties> +</project>
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/AddressDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/AddressDto.java new file mode 100644 index 0000000..ec42bee --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/AddressDto.java
@@ -0,0 +1,322 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.dtos.DepartmentDto; + +@SuppressWarnings("all") +public class AddressDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainReference + private CompanyDto company; + + @DomainReference + private DepartmentDto department; + + private String address1; + + private String address2; + + private String city; + + private String state_province; + + private String postal_code; + + private String country; + + private String email; + + private String landline; + + private String mobile; + + public AddressDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link Address} to the dto {@link AddressDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the company property or <code>null</code> if not present. + */ + public CompanyDto getCompany() { + return this.company; + } + + /** + * Sets the <code>company</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CompanyDto# + * address</code> of the <code>company</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CompanyDto#setAddress(CompanyDto) + * + * @param company - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCompany(final CompanyDto company) { + checkDisposed(); + if (this.company != null) { + this.company.internalRemoveFromAddress(this); + } + + internalSetCompany(company); + + if (this.company != null) { + this.company.internalAddToAddress(this); + } + } + + /** + * For internal use only! + */ + public void internalSetCompany(final CompanyDto company) { + firePropertyChange("company", this.company, this.company = company); + } + + /** + * Returns the department property or <code>null</code> if not present. + */ + public DepartmentDto getDepartment() { + return this.department; + } + + /** + * Sets the <code>department</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DepartmentDto# + * address</code> of the <code>department</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DepartmentDto#setAddress(DepartmentDto) + * + * @param department - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDepartment(final DepartmentDto department) { + checkDisposed(); + if (this.department != null) { + this.department.internalRemoveFromAddress(this); + } + + internalSetDepartment(department); + + if (this.department != null) { + this.department.internalAddToAddress(this); + } + } + + /** + * For internal use only! + */ + public void internalSetDepartment(final DepartmentDto department) { + firePropertyChange("department", this.department, this.department = department); + } + + /** + * Returns the address1 property or <code>null</code> if not present. + */ + public String getAddress1() { + return this.address1; + } + + /** + * Sets the <code>address1</code> property to this instance. + * + * @param address1 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress1(final String address1) { + firePropertyChange("address1", this.address1, this.address1 = address1 ); + } + + /** + * Returns the address2 property or <code>null</code> if not present. + */ + public String getAddress2() { + return this.address2; + } + + /** + * Sets the <code>address2</code> property to this instance. + * + * @param address2 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress2(final String address2) { + firePropertyChange("address2", this.address2, this.address2 = address2 ); + } + + /** + * Returns the city property or <code>null</code> if not present. + */ + public String getCity() { + return this.city; + } + + /** + * Sets the <code>city</code> property to this instance. + * + * @param city - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCity(final String city) { + firePropertyChange("city", this.city, this.city = city ); + } + + /** + * Returns the state_province property or <code>null</code> if not present. + */ + public String getState_province() { + return this.state_province; + } + + /** + * Sets the <code>state_province</code> property to this instance. + * + * @param state_province - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setState_province(final String state_province) { + firePropertyChange("state_province", this.state_province, this.state_province = state_province ); + } + + /** + * Returns the postal_code property or <code>null</code> if not present. + */ + public String getPostal_code() { + return this.postal_code; + } + + /** + * Sets the <code>postal_code</code> property to this instance. + * + * @param postal_code - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPostal_code(final String postal_code) { + firePropertyChange("postal_code", this.postal_code, this.postal_code = postal_code ); + } + + /** + * Returns the country property or <code>null</code> if not present. + */ + public String getCountry() { + return this.country; + } + + /** + * Sets the <code>country</code> property to this instance. + * + * @param country - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCountry(final String country) { + firePropertyChange("country", this.country, this.country = country ); + } + + /** + * Returns the email property or <code>null</code> if not present. + */ + public String getEmail() { + return this.email; + } + + /** + * Sets the <code>email</code> property to this instance. + * + * @param email - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setEmail(final String email) { + firePropertyChange("email", this.email, this.email = email ); + } + + /** + * Returns the landline property or <code>null</code> if not present. + */ + public String getLandline() { + return this.landline; + } + + /** + * Sets the <code>landline</code> property to this instance. + * + * @param landline - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setLandline(final String landline) { + firePropertyChange("landline", this.landline, this.landline = landline ); + } + + /** + * Returns the mobile property or <code>null</code> if not present. + */ + public String getMobile() { + return this.mobile; + } + + /** + * Sets the <code>mobile</code> property to this instance. + * + * @param mobile - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMobile(final String mobile) { + firePropertyChange("mobile", this.mobile, this.mobile = mobile ); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseIDDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseIDDto.java new file mode 100644 index 0000000..579d44c --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseIDDto.java
@@ -0,0 +1,152 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.Id; + +@SuppressWarnings("all") +public class BaseIDDto implements IDto, Serializable, PropertyChangeListener { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + @Dispose + private boolean disposed; + + @Id + private int id; + + public BaseIDDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link BaseID} to the dto {@link BaseIDDto}. + * + */ + protected void installLazyCollections() { + + } + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + firePropertyChange("disposed", this.disposed, this.disposed = true); + } + + /** + * Returns the id property or <code>null</code> if not present. + */ + public int getId() { + return this.id; + } + + /** + * Sets the <code>id</code> property to this instance. + * + * @param id - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setId(final int id) { + firePropertyChange("id", this.id, this.id = id ); + installLazyCollections(); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BaseIDDto other = (BaseIDDto) obj; + if (other.id != this.id) + return false; + return true; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + this.id; + return result; + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + // no super class available to forward event + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseUUIDDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseUUIDDto.java new file mode 100644 index 0000000..6375c28 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/BaseUUIDDto.java
@@ -0,0 +1,155 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.Id; + +@SuppressWarnings("all") +public class BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + @Dispose + private boolean disposed; + + @Id + private String id = java.util.UUID.randomUUID().toString(); + + public BaseUUIDDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link BaseUUID} to the dto {@link BaseUUIDDto}. + * + */ + protected void installLazyCollections() { + + } + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + firePropertyChange("disposed", this.disposed, this.disposed = true); + } + + /** + * Returns the id property or <code>null</code> if not present. + */ + public String getId() { + return this.id; + } + + /** + * Sets the <code>id</code> property to this instance. + * + * @param id - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setId(final String id) { + firePropertyChange("id", this.id, this.id = id ); + installLazyCollections(); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BaseUUIDDto other = (BaseUUIDDto) obj; + if (this.id == null) { + if (other.id != null) + return false; + } else if (!this.id.equals(other.id)) + return false; + return true; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((this.id== null) ? 0 : this.id.hashCode()); + return result; + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + // no super class available to forward event + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentDto.java new file mode 100644 index 0000000..2034c58 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentDto.java
@@ -0,0 +1,188 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Date; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CashPaymentMethodDto; +import org.osbp.tests.dtos.CashSlipDto; + +@SuppressWarnings("all") +public class CashPaymentDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @Valid + private Date now; + + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double payed; + + @DomainReference + private CashSlipDto slip; + + @DomainReference + private CashPaymentMethodDto methodOfPayment; + + public CashPaymentDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CashPayment} to the dto {@link CashPaymentDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + return this.now; + } + + /** + * Sets the <code>now</code> property to this instance. + * + * @param now - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNow(final Date now) { + firePropertyChange("now", this.now, this.now = now ); + } + + /** + * Returns the payed property or <code>null</code> if not present. + */ + public Double getPayed() { + return this.payed; + } + + /** + * Sets the <code>payed</code> property to this instance. + * + * @param payed - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPayed(final Double payed) { + firePropertyChange("payed", this.payed, this.payed = payed ); + } + + /** + * Returns the slip property or <code>null</code> if not present. + */ + public CashSlipDto getSlip() { + return this.slip; + } + + /** + * Sets the <code>slip</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashSlipDto# + * payments</code> of the <code>slip</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setPayments(CashSlipDto) + * + * @param slip - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setSlip(final CashSlipDto slip) { + checkDisposed(); + if (this.slip != null) { + this.slip.internalRemoveFromPayments(this); + } + + internalSetSlip(slip); + + if (this.slip != null) { + this.slip.internalAddToPayments(this); + } + } + + /** + * For internal use only! + */ + public void internalSetSlip(final CashSlipDto slip) { + firePropertyChange("slip", this.slip, this.slip = slip); + } + + /** + * Returns the methodOfPayment property or <code>null</code> if not present. + */ + public CashPaymentMethodDto getMethodOfPayment() { + return this.methodOfPayment; + } + + /** + * Sets the <code>methodOfPayment</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashPaymentMethodDto# + * payments</code> of the <code>methodOfPayment</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashPaymentMethodDto#setPayments(CashPaymentMethodDto) + * + * @param methodOfPayment - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMethodOfPayment(final CashPaymentMethodDto methodOfPayment) { + checkDisposed(); + if (this.methodOfPayment != null) { + this.methodOfPayment.internalRemoveFromPayments(this); + } + + internalSetMethodOfPayment(methodOfPayment); + + if (this.methodOfPayment != null) { + this.methodOfPayment.internalAddToPayments(this); + } + } + + /** + * For internal use only! + */ + public void internalSetMethodOfPayment(final CashPaymentMethodDto methodOfPayment) { + firePropertyChange("methodOfPayment", this.methodOfPayment, this.methodOfPayment = methodOfPayment); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentMethodDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentMethodDto.java new file mode 100644 index 0000000..6cc6158 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPaymentMethodDto.java
@@ -0,0 +1,279 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainDescription; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CashPaymentDto; + +@SuppressWarnings("all") +public class CashPaymentMethodDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainKey + private String num; + + @DomainDescription + private String name; + + private Boolean credit; + + private String imageName; + + private double lowerLimit; + + @DomainReference + private List<CashPaymentDto> payments; + + public CashPaymentMethodDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CashPaymentMethod} to the dto {@link CashPaymentMethodDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + payments = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CashPaymentDto.class, "methodOfPayment.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the num property or <code>null</code> if not present. + */ + public String getNum() { + return this.num; + } + + /** + * Sets the <code>num</code> property to this instance. + * + * @param num - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNum(final String num) { + firePropertyChange("num", this.num, this.num = num ); + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name ); + } + + /** + * Returns the credit property or <code>null</code> if not present. + */ + public Boolean getCredit() { + return this.credit; + } + + /** + * Sets the <code>credit</code> property to this instance. + * + * @param credit - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCredit(final Boolean credit) { + firePropertyChange("credit", this.credit, this.credit = credit ); + } + + /** + * Returns the imageName property or <code>null</code> if not present. + */ + public String getImageName() { + return this.imageName; + } + + /** + * Sets the <code>imageName</code> property to this instance. + * + * @param imageName - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setImageName(final String imageName) { + firePropertyChange("imageName", this.imageName, this.imageName = imageName ); + } + + /** + * Returns the lowerLimit property or <code>null</code> if not present. + */ + public double getLowerLimit() { + return this.lowerLimit; + } + + /** + * Sets the <code>lowerLimit</code> property to this instance. + * + * @param lowerLimit - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setLowerLimit(final double lowerLimit) { + firePropertyChange("lowerLimit", this.lowerLimit, this.lowerLimit = lowerLimit ); + } + + /** + * Returns an unmodifiable list of payments. + */ + public List<CashPaymentDto> getPayments() { + return Collections.unmodifiableList(internalGetPayments()); + } + + /** + * Returns the list of <code>CashPaymentDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CashPaymentDto> internalGetPayments() { + if (this.payments == null) { + this.payments = new java.util.ArrayList<CashPaymentDto>(); + } + return this.payments; + } + + /** + * Adds the given cashPaymentDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CashPaymentDto#methodOfPayment</code> of the <code>cashPaymentDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CashPaymentDto#setMethodOfPayment(CashPaymentDto)}. + * + * @param cashPaymentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToPayments(final CashPaymentDto cashPaymentDto) { + checkDisposed(); + + cashPaymentDto.setMethodOfPayment(this); + } + + /** + * Removes the given cashPaymentDto from this object. <p> + * + * @param cashPaymentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromPayments(final CashPaymentDto cashPaymentDto) { + checkDisposed(); + + cashPaymentDto.setMethodOfPayment(null); + } + + /** + * For internal use only! + */ + public void internalAddToPayments(final CashPaymentDto cashPaymentDto) { + + if(!internalGetPayments().contains(cashPaymentDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPaymentDto> oldList = new java.util.ArrayList<>(internalGetPayments()); + internalGetPayments().add(cashPaymentDto); + firePropertyChange("payments", oldList, internalGetPayments()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetPayments().add(cashPaymentDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPayments(final CashPaymentDto cashPaymentDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPaymentDto> oldList = new java.util.ArrayList<>(internalGetPayments()); + internalGetPayments().remove(cashPaymentDto); + firePropertyChange("payments", oldList, internalGetPayments()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetPayments().remove(cashPaymentDto); + } + } + + /** + * Sets the <code>payments</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashPaymentDto# + * methodOfPayment</code> of the <code>payments</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashPaymentDto#setMethodOfPayment(CashPaymentDto) + * + * @param payments - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPayments(final List<CashPaymentDto> payments) { + checkDisposed(); + for (CashPaymentDto dto : internalGetPayments().toArray(new CashPaymentDto[this.payments.size()])) { + removeFromPayments(dto); + } + + if(payments == null) { + return; + } + + for (CashPaymentDto dto : payments) { + addToPayments(dto); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPositionDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPositionDto.java new file mode 100644 index 0000000..3ff1e17 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashPositionDto.java
@@ -0,0 +1,187 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Date; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CashSlipDto; + +@SuppressWarnings("all") +public class CashPositionDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @Valid + private Date now; + + private double quantity; + + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double price; + + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double amount; + + @DomainReference + private CashSlipDto slip; + + public CashPositionDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CashPosition} to the dto {@link CashPositionDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + return this.now; + } + + /** + * Sets the <code>now</code> property to this instance. + * + * @param now - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNow(final Date now) { + firePropertyChange("now", this.now, this.now = now ); + } + + /** + * Returns the quantity property or <code>null</code> if not present. + */ + public double getQuantity() { + return this.quantity; + } + + /** + * Sets the <code>quantity</code> property to this instance. + * + * @param quantity - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setQuantity(final double quantity) { + firePropertyChange("quantity", this.quantity, this.quantity = quantity ); + } + + /** + * Returns the price property or <code>null</code> if not present. + */ + public Double getPrice() { + return this.price; + } + + /** + * Sets the <code>price</code> property to this instance. + * + * @param price - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPrice(final Double price) { + firePropertyChange("price", this.price, this.price = price ); + } + + /** + * Returns the amount property or <code>null</code> if not present. + */ + public Double getAmount() { + return this.amount; + } + + /** + * Sets the <code>amount</code> property to this instance. + * + * @param amount - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAmount(final Double amount) { + firePropertyChange("amount", this.amount, this.amount = amount ); + } + + /** + * Returns the slip property or <code>null</code> if not present. + */ + public CashSlipDto getSlip() { + return this.slip; + } + + /** + * Sets the <code>slip</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashSlipDto# + * positions</code> of the <code>slip</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setPositions(CashSlipDto) + * + * @param slip - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setSlip(final CashSlipDto slip) { + checkDisposed(); + if (this.slip != null) { + this.slip.internalRemoveFromPositions(this); + } + + internalSetSlip(slip); + + if (this.slip != null) { + this.slip.internalAddToPositions(this); + } + } + + /** + * For internal use only! + */ + public void internalSetSlip(final CashSlipDto slip) { + firePropertyChange("slip", this.slip, this.slip = slip); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashRegisterDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashRegisterDto.java new file mode 100644 index 0000000..121c83a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashRegisterDto.java
@@ -0,0 +1,257 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CashSlipDto; + +@SuppressWarnings("all") +public class CashRegisterDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainKey + private String num; + + private String ip; + + private String location; + + private String currentDay; + + @DomainReference + private List<CashSlipDto> slips; + + public CashRegisterDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CashRegister} to the dto {@link CashRegisterDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + slips = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CashSlipDto.class, "register.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the num property or <code>null</code> if not present. + */ + public String getNum() { + return this.num; + } + + /** + * Sets the <code>num</code> property to this instance. + * + * @param num - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNum(final String num) { + firePropertyChange("num", this.num, this.num = num ); + } + + /** + * Returns the ip property or <code>null</code> if not present. + */ + public String getIp() { + return this.ip; + } + + /** + * Sets the <code>ip</code> property to this instance. + * + * @param ip - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setIp(final String ip) { + firePropertyChange("ip", this.ip, this.ip = ip ); + } + + /** + * Returns the location property or <code>null</code> if not present. + */ + public String getLocation() { + return this.location; + } + + /** + * Sets the <code>location</code> property to this instance. + * + * @param location - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setLocation(final String location) { + firePropertyChange("location", this.location, this.location = location ); + } + + /** + * Returns the currentDay property or <code>null</code> if not present. + */ + public String getCurrentDay() { + return this.currentDay; + } + + /** + * Sets the <code>currentDay</code> property to this instance. + * + * @param currentDay - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCurrentDay(final String currentDay) { + firePropertyChange("currentDay", this.currentDay, this.currentDay = currentDay ); + } + + /** + * Returns an unmodifiable list of slips. + */ + public List<CashSlipDto> getSlips() { + return Collections.unmodifiableList(internalGetSlips()); + } + + /** + * Returns the list of <code>CashSlipDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CashSlipDto> internalGetSlips() { + if (this.slips == null) { + this.slips = new java.util.ArrayList<CashSlipDto>(); + } + return this.slips; + } + + /** + * Adds the given cashSlipDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CashSlipDto#register</code> of the <code>cashSlipDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setRegister(CashSlipDto)}. + * + * @param cashSlipDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToSlips(final CashSlipDto cashSlipDto) { + checkDisposed(); + + cashSlipDto.setRegister(this); + } + + /** + * Removes the given cashSlipDto from this object. <p> + * + * @param cashSlipDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromSlips(final CashSlipDto cashSlipDto) { + checkDisposed(); + + cashSlipDto.setRegister(null); + } + + /** + * For internal use only! + */ + public void internalAddToSlips(final CashSlipDto cashSlipDto) { + + if(!internalGetSlips().contains(cashSlipDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashSlipDto> oldList = new java.util.ArrayList<>(internalGetSlips()); + internalGetSlips().add(cashSlipDto); + firePropertyChange("slips", oldList, internalGetSlips()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetSlips().add(cashSlipDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromSlips(final CashSlipDto cashSlipDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashSlipDto> oldList = new java.util.ArrayList<>(internalGetSlips()); + internalGetSlips().remove(cashSlipDto); + firePropertyChange("slips", oldList, internalGetSlips()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetSlips().remove(cashSlipDto); + } + } + + /** + * Sets the <code>slips</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashSlipDto# + * register</code> of the <code>slips</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setRegister(CashSlipDto) + * + * @param slips - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setSlips(final List<CashSlipDto> slips) { + checkDisposed(); + for (CashSlipDto dto : internalGetSlips().toArray(new CashSlipDto[this.slips.size()])) { + removeFromSlips(dto); + } + + if(slips == null) { + return; + } + + for (CashSlipDto dto : slips) { + addToSlips(dto); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashSlipDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashSlipDto.java new file mode 100644 index 0000000..90c5911 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CashSlipDto.java
@@ -0,0 +1,521 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CashPaymentDto; +import org.osbp.tests.dtos.CashPositionDto; +import org.osbp.tests.dtos.CashRegisterDto; +import org.osbp.tests.dtos.McustomerDto; + +@SuppressWarnings("all") +public class CashSlipDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + private String currentDay; + + @Valid + private Date now; + + private String cashier; + + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double total; + + private long serial; + + private boolean payed; + + @DomainReference + @Valid + private List<CashPositionDto> positions; + + @DomainReference + private McustomerDto customer; + + @DomainReference + private CashRegisterDto register; + + @DomainReference + @Valid + private List<CashPaymentDto> payments; + + public CashSlipDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CashSlip} to the dto {@link CashSlipDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + positions = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CashPositionDto.class, "slip.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + payments = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CashPaymentDto.class, "slip.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.positions != null) { + for (CashPositionDto cashPositionDto : this.positions) { + cashPositionDto.dispose(); + } + this.positions = null; + } + if (this.payments != null) { + for (CashPaymentDto cashPaymentDto : this.payments) { + cashPaymentDto.dispose(); + } + this.payments = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * Returns the currentDay property or <code>null</code> if not present. + */ + public String getCurrentDay() { + return this.currentDay; + } + + /** + * Sets the <code>currentDay</code> property to this instance. + * + * @param currentDay - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCurrentDay(final String currentDay) { + firePropertyChange("currentDay", this.currentDay, this.currentDay = currentDay ); + } + + /** + * Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + return this.now; + } + + /** + * Sets the <code>now</code> property to this instance. + * + * @param now - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNow(final Date now) { + firePropertyChange("now", this.now, this.now = now ); + } + + /** + * Returns the cashier property or <code>null</code> if not present. + */ + public String getCashier() { + return this.cashier; + } + + /** + * Sets the <code>cashier</code> property to this instance. + * + * @param cashier - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCashier(final String cashier) { + firePropertyChange("cashier", this.cashier, this.cashier = cashier ); + } + + /** + * Returns the total property or <code>null</code> if not present. + */ + public Double getTotal() { + return this.total; + } + + /** + * Sets the <code>total</code> property to this instance. + * + * @param total - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setTotal(final Double total) { + firePropertyChange("total", this.total, this.total = total ); + } + + /** + * Returns the serial property or <code>null</code> if not present. + */ + public long getSerial() { + return this.serial; + } + + /** + * Sets the <code>serial</code> property to this instance. + * + * @param serial - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setSerial(final long serial) { + firePropertyChange("serial", this.serial, this.serial = serial ); + } + + /** + * Returns the payed property or <code>null</code> if not present. + */ + public boolean getPayed() { + return this.payed; + } + + /** + * Sets the <code>payed</code> property to this instance. + * + * @param payed - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPayed(final boolean payed) { + firePropertyChange("payed", this.payed, this.payed = payed ); + } + + /** + * Returns an unmodifiable list of positions. + */ + public List<CashPositionDto> getPositions() { + return Collections.unmodifiableList(internalGetPositions()); + } + + /** + * Returns the list of <code>CashPositionDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CashPositionDto> internalGetPositions() { + if (this.positions == null) { + this.positions = new java.util.ArrayList<CashPositionDto>(); + } + return this.positions; + } + + /** + * Adds the given cashPositionDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CashPositionDto#slip</code> of the <code>cashPositionDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CashPositionDto#setSlip(CashPositionDto)}. + * + * @param cashPositionDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToPositions(final CashPositionDto cashPositionDto) { + checkDisposed(); + + cashPositionDto.setSlip(this); + } + + /** + * Removes the given cashPositionDto from this object. <p> + * + * @param cashPositionDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromPositions(final CashPositionDto cashPositionDto) { + checkDisposed(); + + cashPositionDto.setSlip(null); + } + + /** + * For internal use only! + */ + public void internalAddToPositions(final CashPositionDto cashPositionDto) { + + if(!internalGetPositions().contains(cashPositionDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPositionDto> oldList = new java.util.ArrayList<>(internalGetPositions()); + internalGetPositions().add(cashPositionDto); + firePropertyChange("positions", oldList, internalGetPositions()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetPositions().add(cashPositionDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPositions(final CashPositionDto cashPositionDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPositionDto> oldList = new java.util.ArrayList<>(internalGetPositions()); + internalGetPositions().remove(cashPositionDto); + firePropertyChange("positions", oldList, internalGetPositions()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetPositions().remove(cashPositionDto); + } + } + + /** + * Sets the <code>positions</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashPositionDto# + * slip</code> of the <code>positions</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashPositionDto#setSlip(CashPositionDto) + * + * @param positions - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPositions(final List<CashPositionDto> positions) { + checkDisposed(); + for (CashPositionDto dto : internalGetPositions().toArray(new CashPositionDto[this.positions.size()])) { + removeFromPositions(dto); + } + + if(positions == null) { + return; + } + + for (CashPositionDto dto : positions) { + addToPositions(dto); + } + } + + /** + * Returns the customer property or <code>null</code> if not present. + */ + public McustomerDto getCustomer() { + return this.customer; + } + + /** + * Sets the <code>customer</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>McustomerDto# + * slips</code> of the <code>customer</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link McustomerDto#setSlips(McustomerDto) + * + * @param customer - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCustomer(final McustomerDto customer) { + checkDisposed(); + if (this.customer != null) { + this.customer.internalRemoveFromSlips(this); + } + + internalSetCustomer(customer); + + if (this.customer != null) { + this.customer.internalAddToSlips(this); + } + } + + /** + * For internal use only! + */ + public void internalSetCustomer(final McustomerDto customer) { + firePropertyChange("customer", this.customer, this.customer = customer); + } + + /** + * Returns the register property or <code>null</code> if not present. + */ + public CashRegisterDto getRegister() { + return this.register; + } + + /** + * Sets the <code>register</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashRegisterDto# + * slips</code> of the <code>register</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashRegisterDto#setSlips(CashRegisterDto) + * + * @param register - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setRegister(final CashRegisterDto register) { + checkDisposed(); + if (this.register != null) { + this.register.internalRemoveFromSlips(this); + } + + internalSetRegister(register); + + if (this.register != null) { + this.register.internalAddToSlips(this); + } + } + + /** + * For internal use only! + */ + public void internalSetRegister(final CashRegisterDto register) { + firePropertyChange("register", this.register, this.register = register); + } + + /** + * Returns an unmodifiable list of payments. + */ + public List<CashPaymentDto> getPayments() { + return Collections.unmodifiableList(internalGetPayments()); + } + + /** + * Returns the list of <code>CashPaymentDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CashPaymentDto> internalGetPayments() { + if (this.payments == null) { + this.payments = new java.util.ArrayList<CashPaymentDto>(); + } + return this.payments; + } + + /** + * Adds the given cashPaymentDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CashPaymentDto#slip</code> of the <code>cashPaymentDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CashPaymentDto#setSlip(CashPaymentDto)}. + * + * @param cashPaymentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToPayments(final CashPaymentDto cashPaymentDto) { + checkDisposed(); + + cashPaymentDto.setSlip(this); + } + + /** + * Removes the given cashPaymentDto from this object. <p> + * + * @param cashPaymentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromPayments(final CashPaymentDto cashPaymentDto) { + checkDisposed(); + + cashPaymentDto.setSlip(null); + } + + /** + * For internal use only! + */ + public void internalAddToPayments(final CashPaymentDto cashPaymentDto) { + + if(!internalGetPayments().contains(cashPaymentDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPaymentDto> oldList = new java.util.ArrayList<>(internalGetPayments()); + internalGetPayments().add(cashPaymentDto); + firePropertyChange("payments", oldList, internalGetPayments()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetPayments().add(cashPaymentDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPayments(final CashPaymentDto cashPaymentDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashPaymentDto> oldList = new java.util.ArrayList<>(internalGetPayments()); + internalGetPayments().remove(cashPaymentDto); + firePropertyChange("payments", oldList, internalGetPayments()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetPayments().remove(cashPaymentDto); + } + } + + /** + * Sets the <code>payments</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashPaymentDto# + * slip</code> of the <code>payments</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashPaymentDto#setSlip(CashPaymentDto) + * + * @param payments - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPayments(final List<CashPaymentDto> payments) { + checkDisposed(); + for (CashPaymentDto dto : internalGetPayments().toArray(new CashPaymentDto[this.payments.size()])) { + removeFromPayments(dto); + } + + if(payments == null) { + return; + } + + for (CashPaymentDto dto : payments) { + addToPayments(dto); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyDto.java new file mode 100644 index 0000000..6ab9c97 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyDto.java
@@ -0,0 +1,419 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CompanyGroupDto; +import org.osbp.tests.dtos.CompanyRelationTypeDto; +import org.osbp.tests.dtos.DepartmentDto; + +@SuppressWarnings("all") +public class CompanyDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainReference + private CompanyGroupDto company_group; + + @DomainKey + private String name; + + private String description; + + @DomainReference + private CompanyRelationTypeDto relation_type; + + @DomainReference + @Valid + private List<AddressDto> address; + + @DomainReference + @Valid + private List<DepartmentDto> departments; + + public CompanyDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link Company} to the dto {@link CompanyDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + address = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + AddressDto.class, "company.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + departments = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + DepartmentDto.class, "company.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.address != null) { + for (AddressDto addressDto : this.address) { + addressDto.dispose(); + } + this.address = null; + } + if (this.departments != null) { + for (DepartmentDto departmentDto : this.departments) { + departmentDto.dispose(); + } + this.departments = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * Returns the company_group property or <code>null</code> if not present. + */ + public CompanyGroupDto getCompany_group() { + return this.company_group; + } + + /** + * Sets the <code>company_group</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CompanyGroupDto# + * companies</code> of the <code>company_group</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CompanyGroupDto#setCompanies(CompanyGroupDto) + * + * @param company_group - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCompany_group(final CompanyGroupDto company_group) { + checkDisposed(); + if (this.company_group != null) { + this.company_group.internalRemoveFromCompanies(this); + } + + internalSetCompany_group(company_group); + + if (this.company_group != null) { + this.company_group.internalAddToCompanies(this); + } + } + + /** + * For internal use only! + */ + public void internalSetCompany_group(final CompanyGroupDto company_group) { + firePropertyChange("company_group", this.company_group, this.company_group = company_group); + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name ); + } + + /** + * Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the <code>description</code> property to this instance. + * + * @param description - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDescription(final String description) { + firePropertyChange("description", this.description, this.description = description ); + } + + /** + * Returns the relation_type property or <code>null</code> if not present. + */ + public CompanyRelationTypeDto getRelation_type() { + return this.relation_type; + } + + /** + * Sets the <code>relation_type</code> property to this instance. + * + * @param relation_type - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setRelation_type(final CompanyRelationTypeDto relation_type) { + checkDisposed(); + firePropertyChange("relation_type", this.relation_type, this.relation_type = relation_type); + } + + /** + * Returns an unmodifiable list of address. + */ + public List<AddressDto> getAddress() { + return Collections.unmodifiableList(internalGetAddress()); + } + + /** + * Returns the list of <code>AddressDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<AddressDto> internalGetAddress() { + if (this.address == null) { + this.address = new java.util.ArrayList<AddressDto>(); + } + return this.address; + } + + /** + * Adds the given addressDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>AddressDto#company</code> of the <code>addressDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link AddressDto#setCompany(AddressDto)}. + * + * @param addressDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToAddress(final AddressDto addressDto) { + checkDisposed(); + + addressDto.setCompany(this); + } + + /** + * Removes the given addressDto from this object. <p> + * + * @param addressDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromAddress(final AddressDto addressDto) { + checkDisposed(); + + addressDto.setCompany(null); + } + + /** + * For internal use only! + */ + public void internalAddToAddress(final AddressDto addressDto) { + + if(!internalGetAddress().contains(addressDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<AddressDto> oldList = new java.util.ArrayList<>(internalGetAddress()); + internalGetAddress().add(addressDto); + firePropertyChange("address", oldList, internalGetAddress()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetAddress().add(addressDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromAddress(final AddressDto addressDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<AddressDto> oldList = new java.util.ArrayList<>(internalGetAddress()); + internalGetAddress().remove(addressDto); + firePropertyChange("address", oldList, internalGetAddress()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetAddress().remove(addressDto); + } + } + + /** + * Sets the <code>address</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>AddressDto# + * company</code> of the <code>address</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link AddressDto#setCompany(AddressDto) + * + * @param address - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress(final List<AddressDto> address) { + checkDisposed(); + for (AddressDto dto : internalGetAddress().toArray(new AddressDto[this.address.size()])) { + removeFromAddress(dto); + } + + if(address == null) { + return; + } + + for (AddressDto dto : address) { + addToAddress(dto); + } + } + + /** + * Returns an unmodifiable list of departments. + */ + public List<DepartmentDto> getDepartments() { + return Collections.unmodifiableList(internalGetDepartments()); + } + + /** + * Returns the list of <code>DepartmentDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<DepartmentDto> internalGetDepartments() { + if (this.departments == null) { + this.departments = new java.util.ArrayList<DepartmentDto>(); + } + return this.departments; + } + + /** + * Adds the given departmentDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>DepartmentDto#company</code> of the <code>departmentDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link DepartmentDto#setCompany(DepartmentDto)}. + * + * @param departmentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToDepartments(final DepartmentDto departmentDto) { + checkDisposed(); + + departmentDto.setCompany(this); + } + + /** + * Removes the given departmentDto from this object. <p> + * + * @param departmentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromDepartments(final DepartmentDto departmentDto) { + checkDisposed(); + + departmentDto.setCompany(null); + } + + /** + * For internal use only! + */ + public void internalAddToDepartments(final DepartmentDto departmentDto) { + + if(!internalGetDepartments().contains(departmentDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DepartmentDto> oldList = new java.util.ArrayList<>(internalGetDepartments()); + internalGetDepartments().add(departmentDto); + firePropertyChange("departments", oldList, internalGetDepartments()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetDepartments().add(departmentDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromDepartments(final DepartmentDto departmentDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DepartmentDto> oldList = new java.util.ArrayList<>(internalGetDepartments()); + internalGetDepartments().remove(departmentDto); + firePropertyChange("departments", oldList, internalGetDepartments()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetDepartments().remove(departmentDto); + } + } + + /** + * Sets the <code>departments</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DepartmentDto# + * company</code> of the <code>departments</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DepartmentDto#setCompany(DepartmentDto) + * + * @param departments - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDepartments(final List<DepartmentDto> departments) { + checkDisposed(); + for (DepartmentDto dto : internalGetDepartments().toArray(new DepartmentDto[this.departments.size()])) { + removeFromDepartments(dto); + } + + if(departments == null) { + return; + } + + for (DepartmentDto dto : departments) { + addToDepartments(dto); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyGroupDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyGroupDto.java new file mode 100644 index 0000000..a126cc1 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyGroupDto.java
@@ -0,0 +1,239 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CompanyDto; + +@SuppressWarnings("all") +public class CompanyGroupDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainKey + private String name; + + private String description; + + @DomainReference + private CompanyDto main_company; + + @DomainReference + private List<CompanyDto> companies; + + public CompanyGroupDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CompanyGroup} to the dto {@link CompanyGroupDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + companies = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CompanyDto.class, "company_group.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name ); + } + + /** + * Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the <code>description</code> property to this instance. + * + * @param description - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDescription(final String description) { + firePropertyChange("description", this.description, this.description = description ); + } + + /** + * Returns the main_company property or <code>null</code> if not present. + */ + public CompanyDto getMain_company() { + return this.main_company; + } + + /** + * Sets the <code>main_company</code> property to this instance. + * + * @param main_company - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMain_company(final CompanyDto main_company) { + checkDisposed(); + firePropertyChange("main_company", this.main_company, this.main_company = main_company); + } + + /** + * Returns an unmodifiable list of companies. + */ + public List<CompanyDto> getCompanies() { + return Collections.unmodifiableList(internalGetCompanies()); + } + + /** + * Returns the list of <code>CompanyDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CompanyDto> internalGetCompanies() { + if (this.companies == null) { + this.companies = new java.util.ArrayList<CompanyDto>(); + } + return this.companies; + } + + /** + * Adds the given companyDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CompanyDto#company_group</code> of the <code>companyDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CompanyDto#setCompany_group(CompanyDto)}. + * + * @param companyDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToCompanies(final CompanyDto companyDto) { + checkDisposed(); + + companyDto.setCompany_group(this); + } + + /** + * Removes the given companyDto from this object. <p> + * + * @param companyDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromCompanies(final CompanyDto companyDto) { + checkDisposed(); + + companyDto.setCompany_group(null); + } + + /** + * For internal use only! + */ + public void internalAddToCompanies(final CompanyDto companyDto) { + + if(!internalGetCompanies().contains(companyDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CompanyDto> oldList = new java.util.ArrayList<>(internalGetCompanies()); + internalGetCompanies().add(companyDto); + firePropertyChange("companies", oldList, internalGetCompanies()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetCompanies().add(companyDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromCompanies(final CompanyDto companyDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CompanyDto> oldList = new java.util.ArrayList<>(internalGetCompanies()); + internalGetCompanies().remove(companyDto); + firePropertyChange("companies", oldList, internalGetCompanies()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetCompanies().remove(companyDto); + } + } + + /** + * Sets the <code>companies</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CompanyDto# + * company_group</code> of the <code>companies</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CompanyDto#setCompany_group(CompanyDto) + * + * @param companies - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCompanies(final List<CompanyDto> companies) { + checkDisposed(); + for (CompanyDto dto : internalGetCompanies().toArray(new CompanyDto[this.companies.size()])) { + removeFromCompanies(dto); + } + + if(companies == null) { + return; + } + + for (CompanyDto dto : companies) { + addToCompanies(dto); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyRelationTypeDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyRelationTypeDto.java new file mode 100644 index 0000000..7852dc8 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/CompanyRelationTypeDto.java
@@ -0,0 +1,99 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.osbp.tests.dtos.BaseUUIDDto; + +@SuppressWarnings("all") +public class CompanyRelationTypeDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainKey + private String name; + + private String description; + + public CompanyRelationTypeDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link CompanyRelationType} to the dto {@link CompanyRelationTypeDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name ); + } + + /** + * Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the <code>description</code> property to this instance. + * + * @param description - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDescription(final String description) { + firePropertyChange("description", this.description, this.description = description ); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DepartmentDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DepartmentDto.java new file mode 100644 index 0000000..b398612 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DepartmentDto.java
@@ -0,0 +1,294 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.CompanyDto; + +@SuppressWarnings("all") +public class DepartmentDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainReference + private CompanyDto company; + + @DomainKey + private String name; + + private String description; + + @DomainReference + @Valid + private List<AddressDto> address; + + private double default_yearly_income; + + public DepartmentDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link Department} to the dto {@link DepartmentDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + address = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + AddressDto.class, "department.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.address != null) { + for (AddressDto addressDto : this.address) { + addressDto.dispose(); + } + this.address = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * Returns the company property or <code>null</code> if not present. + */ + public CompanyDto getCompany() { + return this.company; + } + + /** + * Sets the <code>company</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CompanyDto# + * departments</code> of the <code>company</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CompanyDto#setDepartments(CompanyDto) + * + * @param company - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCompany(final CompanyDto company) { + checkDisposed(); + if (this.company != null) { + this.company.internalRemoveFromDepartments(this); + } + + internalSetCompany(company); + + if (this.company != null) { + this.company.internalAddToDepartments(this); + } + } + + /** + * For internal use only! + */ + public void internalSetCompany(final CompanyDto company) { + firePropertyChange("company", this.company, this.company = company); + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name ); + } + + /** + * Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + return this.description; + } + + /** + * Sets the <code>description</code> property to this instance. + * + * @param description - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDescription(final String description) { + firePropertyChange("description", this.description, this.description = description ); + } + + /** + * Returns an unmodifiable list of address. + */ + public List<AddressDto> getAddress() { + return Collections.unmodifiableList(internalGetAddress()); + } + + /** + * Returns the list of <code>AddressDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<AddressDto> internalGetAddress() { + if (this.address == null) { + this.address = new java.util.ArrayList<AddressDto>(); + } + return this.address; + } + + /** + * Adds the given addressDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>AddressDto#department</code> of the <code>addressDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link AddressDto#setDepartment(AddressDto)}. + * + * @param addressDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToAddress(final AddressDto addressDto) { + checkDisposed(); + + addressDto.setDepartment(this); + } + + /** + * Removes the given addressDto from this object. <p> + * + * @param addressDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromAddress(final AddressDto addressDto) { + checkDisposed(); + + addressDto.setDepartment(null); + } + + /** + * For internal use only! + */ + public void internalAddToAddress(final AddressDto addressDto) { + + if(!internalGetAddress().contains(addressDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<AddressDto> oldList = new java.util.ArrayList<>(internalGetAddress()); + internalGetAddress().add(addressDto); + firePropertyChange("address", oldList, internalGetAddress()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetAddress().add(addressDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromAddress(final AddressDto addressDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<AddressDto> oldList = new java.util.ArrayList<>(internalGetAddress()); + internalGetAddress().remove(addressDto); + firePropertyChange("address", oldList, internalGetAddress()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetAddress().remove(addressDto); + } + } + + /** + * Sets the <code>address</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>AddressDto# + * department</code> of the <code>address</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link AddressDto#setDepartment(AddressDto) + * + * @param address - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress(final List<AddressDto> address) { + checkDisposed(); + for (AddressDto dto : internalGetAddress().toArray(new AddressDto[this.address.size()])) { + removeFromAddress(dto); + } + + if(address == null) { + return; + } + + for (AddressDto dto : address) { + addToAddress(dto); + } + } + + /** + * Returns the default_yearly_income property or <code>null</code> if not present. + */ + public double getDefault_yearly_income() { + return this.default_yearly_income; + } + + /** + * Sets the <code>default_yearly_income</code> property to this instance. + * + * @param default_yearly_income - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDefault_yearly_income(final double default_yearly_income) { + firePropertyChange("default_yearly_income", this.default_yearly_income, this.default_yearly_income = default_yearly_income ); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestBeanDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestBeanDto.java new file mode 100644 index 0000000..bc54ee4 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestBeanDto.java
@@ -0,0 +1,151 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; + +@SuppressWarnings("all") +public class DtoTestBeanDto implements IDto, Serializable, PropertyChangeListener { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + @Dispose + private boolean disposed; + + private String foo; + + @DomainReference + private DtoTestChildCrossRefDto crossRefChild; + + public DtoTestBeanDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link DtoTestBean} to the dto {@link DtoTestBeanDto}. + * + */ + protected void installLazyCollections() { + + } + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + firePropertyChange("disposed", this.disposed, this.disposed = true); + } + + /** + * Returns the foo property or <code>null</code> if not present. + */ + public String getFoo() { + return this.foo; + } + + /** + * Sets the <code>foo</code> property to this instance. + * + * @param foo - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setFoo(final String foo) { + firePropertyChange("foo", this.foo, this.foo = foo ); + } + + /** + * Returns the crossRefChild property or <code>null</code> if not present. + */ + public DtoTestChildCrossRefDto getCrossRefChild() { + return this.crossRefChild; + } + + /** + * Sets the <code>crossRefChild</code> property to this instance. + * + * @param crossRefChild - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCrossRefChild(final DtoTestChildCrossRefDto crossRefChild) { + checkDisposed(); + firePropertyChange("crossRefChild", this.crossRefChild, this.crossRefChild = crossRefChild); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + // no super class available to forward event + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildContainmentDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildContainmentDto.java new file mode 100644 index 0000000..255f3aa --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildContainmentDto.java
@@ -0,0 +1,100 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.DtoTestParentDto; + +@SuppressWarnings("all") +public class DtoTestChildContainmentDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainReference + private DtoTestParentDto container; + + public DtoTestChildContainmentDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link DtoTestChildContainment} to the dto {@link DtoTestChildContainmentDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the container property or <code>null</code> if not present. + */ + public DtoTestParentDto getContainer() { + return this.container; + } + + /** + * Sets the <code>container</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DtoTestParentDto# + * containmentChilds</code> of the <code>container</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DtoTestParentDto#setContainmentChilds(DtoTestParentDto) + * + * @param container - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setContainer(final DtoTestParentDto container) { + checkDisposed(); + if (this.container != null) { + this.container.internalRemoveFromContainmentChilds(this); + } + + internalSetContainer(container); + + if (this.container != null) { + this.container.internalAddToContainmentChilds(this); + } + } + + /** + * For internal use only! + */ + public void internalSetContainer(final DtoTestParentDto container) { + firePropertyChange("container", this.container, this.container = container); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildCrossRefDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildCrossRefDto.java new file mode 100644 index 0000000..fb3f583 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestChildCrossRefDto.java
@@ -0,0 +1,100 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.DtoTestParentDto; + +@SuppressWarnings("all") +public class DtoTestChildCrossRefDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + @DomainReference + private DtoTestParentDto container; + + public DtoTestChildCrossRefDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link DtoTestChildCrossRef} to the dto {@link DtoTestChildCrossRefDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the container property or <code>null</code> if not present. + */ + public DtoTestParentDto getContainer() { + return this.container; + } + + /** + * Sets the <code>container</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DtoTestParentDto# + * crossRefChilds</code> of the <code>container</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DtoTestParentDto#setCrossRefChilds(DtoTestParentDto) + * + * @param container - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setContainer(final DtoTestParentDto container) { + checkDisposed(); + if (this.container != null) { + this.container.internalRemoveFromCrossRefChilds(this); + } + + internalSetContainer(container); + + if (this.container != null) { + this.container.internalAddToCrossRefChilds(this); + } + } + + /** + * For internal use only! + */ + public void internalSetContainer(final DtoTestParentDto container) { + firePropertyChange("container", this.container, this.container = container); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestParentDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestParentDto.java new file mode 100644 index 0000000..92773e2 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/DtoTestParentDto.java
@@ -0,0 +1,385 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.dtos.DtoTestBeanDto; +import org.osbp.tests.dtos.DtoTestChildContainmentDto; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; + +@SuppressWarnings("all") +public class DtoTestParentDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener { + private String string; + + @DomainReference + @Valid + private List<DtoTestChildContainmentDto> containmentChilds; + + @DomainReference + private List<DtoTestChildCrossRefDto> crossRefChilds; + + @DomainReference + private DtoTestChildCrossRefDto crossRefChild; + + @Valid + private DtoTestBeanDto beanx; + + public DtoTestParentDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link DtoTestParent} to the dto {@link DtoTestParentDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + containmentChilds = new org.eclipse.osbp.dsl.dto.lib.OppositeContainmentDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + DtoTestChildContainmentDto.class, "container.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + crossRefChilds = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + DtoTestChildCrossRefDto.class, "container.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.containmentChilds != null) { + for (DtoTestChildContainmentDto dtoTestChildContainmentDto : this.containmentChilds) { + dtoTestChildContainmentDto.dispose(); + } + this.containmentChilds = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * Returns the string property or <code>null</code> if not present. + */ + public String getString() { + return this.string; + } + + /** + * Sets the <code>string</code> property to this instance. + * + * @param string - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setString(final String string) { + firePropertyChange("string", this.string, this.string = string ); + } + + /** + * Returns an unmodifiable list of containmentChilds. + */ + public List<DtoTestChildContainmentDto> getContainmentChilds() { + return Collections.unmodifiableList(internalGetContainmentChilds()); + } + + /** + * Returns the list of <code>DtoTestChildContainmentDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<DtoTestChildContainmentDto> internalGetContainmentChilds() { + if (this.containmentChilds == null) { + this.containmentChilds = new java.util.ArrayList<DtoTestChildContainmentDto>(); + } + return this.containmentChilds; + } + + /** + * Adds the given dtoTestChildContainmentDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>DtoTestChildContainmentDto#container</code> of the <code>dtoTestChildContainmentDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link DtoTestChildContainmentDto#setContainer(DtoTestChildContainmentDto)}. + * + * @param dtoTestChildContainmentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToContainmentChilds(final DtoTestChildContainmentDto dtoTestChildContainmentDto) { + checkDisposed(); + + dtoTestChildContainmentDto.setContainer(this); + } + + /** + * Removes the given dtoTestChildContainmentDto from this object. <p> + * + * @param dtoTestChildContainmentDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromContainmentChilds(final DtoTestChildContainmentDto dtoTestChildContainmentDto) { + checkDisposed(); + + dtoTestChildContainmentDto.setContainer(null); + } + + /** + * For internal use only! + */ + public void internalAddToContainmentChilds(final DtoTestChildContainmentDto dtoTestChildContainmentDto) { + + if(!internalGetContainmentChilds().contains(dtoTestChildContainmentDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DtoTestChildContainmentDto> oldList = new java.util.ArrayList<>(internalGetContainmentChilds()); + internalGetContainmentChilds().add(dtoTestChildContainmentDto); + firePropertyChange("containmentChilds", oldList, internalGetContainmentChilds()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetContainmentChilds().add(dtoTestChildContainmentDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromContainmentChilds(final DtoTestChildContainmentDto dtoTestChildContainmentDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DtoTestChildContainmentDto> oldList = new java.util.ArrayList<>(internalGetContainmentChilds()); + internalGetContainmentChilds().remove(dtoTestChildContainmentDto); + firePropertyChange("containmentChilds", oldList, internalGetContainmentChilds()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetContainmentChilds().remove(dtoTestChildContainmentDto); + } + } + + /** + * Sets the <code>containmentChilds</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DtoTestChildContainmentDto# + * container</code> of the <code>containmentChilds</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DtoTestChildContainmentDto#setContainer(DtoTestChildContainmentDto) + * + * @param containmentChilds - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setContainmentChilds(final List<DtoTestChildContainmentDto> containmentChilds) { + checkDisposed(); + for (DtoTestChildContainmentDto dto : internalGetContainmentChilds().toArray(new DtoTestChildContainmentDto[this.containmentChilds.size()])) { + removeFromContainmentChilds(dto); + } + + if(containmentChilds == null) { + return; + } + + for (DtoTestChildContainmentDto dto : containmentChilds) { + addToContainmentChilds(dto); + } + } + + /** + * Returns an unmodifiable list of crossRefChilds. + */ + public List<DtoTestChildCrossRefDto> getCrossRefChilds() { + return Collections.unmodifiableList(internalGetCrossRefChilds()); + } + + /** + * Returns the list of <code>DtoTestChildCrossRefDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<DtoTestChildCrossRefDto> internalGetCrossRefChilds() { + if (this.crossRefChilds == null) { + this.crossRefChilds = new java.util.ArrayList<DtoTestChildCrossRefDto>(); + } + return this.crossRefChilds; + } + + /** + * Adds the given dtoTestChildCrossRefDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>DtoTestChildCrossRefDto#container</code> of the <code>dtoTestChildCrossRefDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link DtoTestChildCrossRefDto#setContainer(DtoTestChildCrossRefDto)}. + * + * @param dtoTestChildCrossRefDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToCrossRefChilds(final DtoTestChildCrossRefDto dtoTestChildCrossRefDto) { + checkDisposed(); + + dtoTestChildCrossRefDto.setContainer(this); + } + + /** + * Removes the given dtoTestChildCrossRefDto from this object. <p> + * + * @param dtoTestChildCrossRefDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromCrossRefChilds(final DtoTestChildCrossRefDto dtoTestChildCrossRefDto) { + checkDisposed(); + + dtoTestChildCrossRefDto.setContainer(null); + } + + /** + * For internal use only! + */ + public void internalAddToCrossRefChilds(final DtoTestChildCrossRefDto dtoTestChildCrossRefDto) { + + if(!internalGetCrossRefChilds().contains(dtoTestChildCrossRefDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DtoTestChildCrossRefDto> oldList = new java.util.ArrayList<>(internalGetCrossRefChilds()); + internalGetCrossRefChilds().add(dtoTestChildCrossRefDto); + firePropertyChange("crossRefChilds", oldList, internalGetCrossRefChilds()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetCrossRefChilds().add(dtoTestChildCrossRefDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromCrossRefChilds(final DtoTestChildCrossRefDto dtoTestChildCrossRefDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<DtoTestChildCrossRefDto> oldList = new java.util.ArrayList<>(internalGetCrossRefChilds()); + internalGetCrossRefChilds().remove(dtoTestChildCrossRefDto); + firePropertyChange("crossRefChilds", oldList, internalGetCrossRefChilds()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetCrossRefChilds().remove(dtoTestChildCrossRefDto); + } + } + + /** + * Sets the <code>crossRefChilds</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>DtoTestChildCrossRefDto# + * container</code> of the <code>crossRefChilds</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link DtoTestChildCrossRefDto#setContainer(DtoTestChildCrossRefDto) + * + * @param crossRefChilds - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCrossRefChilds(final List<DtoTestChildCrossRefDto> crossRefChilds) { + checkDisposed(); + for (DtoTestChildCrossRefDto dto : internalGetCrossRefChilds().toArray(new DtoTestChildCrossRefDto[this.crossRefChilds.size()])) { + removeFromCrossRefChilds(dto); + } + + if(crossRefChilds == null) { + return; + } + + for (DtoTestChildCrossRefDto dto : crossRefChilds) { + addToCrossRefChilds(dto); + } + } + + /** + * Returns the crossRefChild property or <code>null</code> if not present. + */ + public DtoTestChildCrossRefDto getCrossRefChild() { + return this.crossRefChild; + } + + /** + * Sets the <code>crossRefChild</code> property to this instance. + * + * @param crossRefChild - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCrossRefChild(final DtoTestChildCrossRefDto crossRefChild) { + checkDisposed(); + firePropertyChange("crossRefChild", this.crossRefChild, this.crossRefChild = crossRefChild); + } + + /** + * Returns the beanx property. + */ + public DtoTestBeanDto getBeanx() { + if(this.beanx== null){ + this.beanx = new DtoTestBeanDto(); + } + return this.beanx; + } + + /** + * Sets the <code>beanx</code> property to this instance. + * + * @param beanx - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setBeanx(final DtoTestBeanDto beanx) { + // ensure that embedded beans will notify their parent about changes + // so their dirty state can be handled properly + if (this.beanx != null) { + this.beanx.removePropertyChangeListener(this); + } + + firePropertyChange("beanx", this.beanx, this.beanx = beanx ); + + if (this.beanx != null) { + this.beanx.addPropertyChangeListener(this); + } + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + if(source == beanx){ + firePropertyChange("beanx" + "_" + event.getPropertyName(), event.getOldValue(), event.getNewValue()); + } else + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/McustomerDto.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/McustomerDto.java new file mode 100644 index 0000000..8ed33a0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/McustomerDto.java
@@ -0,0 +1,760 @@ +package org.osbp.tests.dtos; + +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.osbp.tests.dtos.BaseIDDto; +import org.osbp.tests.dtos.CashSlipDto; + +@SuppressWarnings("all") +public class McustomerDto extends BaseIDDto implements IDto, Serializable, PropertyChangeListener { + private long account_num; + + private String lname; + + private String fname; + + private String mi; + + private String address1; + + private String address2; + + private String address3; + + private String address4; + + private String city; + + private String state_province; + + private String postal_code; + + private String country; + + private String phone1; + + private String phone2; + + @Valid + private Date birthdate; + + private String marital_status; + + private String yearly_income; + + private String gender; + + private int total_children; + + private int num_children_at_home; + + private String education; + + private String date_accnt_opened; + + private String member_card; + + private String occupation; + + private String houseowner; + + private int num_cars_owned; + + @DomainKey + private String fullname; + + private String test; + + @DomainReference + private List<CashSlipDto> slips; + + private String foo; + + public McustomerDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link Mcustomer} to the dto {@link McustomerDto}. + * + */ + protected void installLazyCollections() { + super.installLazyCollections(); + slips = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + CashSlipDto.class, "customer.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId()); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * Returns the account_num property or <code>null</code> if not present. + */ + public long getAccount_num() { + return this.account_num; + } + + /** + * Sets the <code>account_num</code> property to this instance. + * + * @param account_num - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAccount_num(final long account_num) { + firePropertyChange("account_num", this.account_num, this.account_num = account_num ); + } + + /** + * Returns the lname property or <code>null</code> if not present. + */ + public String getLname() { + return this.lname; + } + + /** + * Sets the <code>lname</code> property to this instance. + * + * @param lname - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setLname(final String lname) { + firePropertyChange("lname", this.lname, this.lname = lname ); + } + + /** + * Returns the fname property or <code>null</code> if not present. + */ + public String getFname() { + return this.fname; + } + + /** + * Sets the <code>fname</code> property to this instance. + * + * @param fname - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setFname(final String fname) { + firePropertyChange("fname", this.fname, this.fname = fname ); + } + + /** + * Returns the mi property or <code>null</code> if not present. + */ + public String getMi() { + return this.mi; + } + + /** + * Sets the <code>mi</code> property to this instance. + * + * @param mi - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMi(final String mi) { + firePropertyChange("mi", this.mi, this.mi = mi ); + } + + /** + * Returns the address1 property or <code>null</code> if not present. + */ + public String getAddress1() { + return this.address1; + } + + /** + * Sets the <code>address1</code> property to this instance. + * + * @param address1 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress1(final String address1) { + firePropertyChange("address1", this.address1, this.address1 = address1 ); + } + + /** + * Returns the address2 property or <code>null</code> if not present. + */ + public String getAddress2() { + return this.address2; + } + + /** + * Sets the <code>address2</code> property to this instance. + * + * @param address2 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress2(final String address2) { + firePropertyChange("address2", this.address2, this.address2 = address2 ); + } + + /** + * Returns the address3 property or <code>null</code> if not present. + */ + public String getAddress3() { + return this.address3; + } + + /** + * Sets the <code>address3</code> property to this instance. + * + * @param address3 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress3(final String address3) { + firePropertyChange("address3", this.address3, this.address3 = address3 ); + } + + /** + * Returns the address4 property or <code>null</code> if not present. + */ + public String getAddress4() { + return this.address4; + } + + /** + * Sets the <code>address4</code> property to this instance. + * + * @param address4 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setAddress4(final String address4) { + firePropertyChange("address4", this.address4, this.address4 = address4 ); + } + + /** + * Returns the city property or <code>null</code> if not present. + */ + public String getCity() { + return this.city; + } + + /** + * Sets the <code>city</code> property to this instance. + * + * @param city - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCity(final String city) { + firePropertyChange("city", this.city, this.city = city ); + } + + /** + * Returns the state_province property or <code>null</code> if not present. + */ + public String getState_province() { + return this.state_province; + } + + /** + * Sets the <code>state_province</code> property to this instance. + * + * @param state_province - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setState_province(final String state_province) { + firePropertyChange("state_province", this.state_province, this.state_province = state_province ); + } + + /** + * Returns the postal_code property or <code>null</code> if not present. + */ + public String getPostal_code() { + return this.postal_code; + } + + /** + * Sets the <code>postal_code</code> property to this instance. + * + * @param postal_code - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPostal_code(final String postal_code) { + firePropertyChange("postal_code", this.postal_code, this.postal_code = postal_code ); + } + + /** + * Returns the country property or <code>null</code> if not present. + */ + public String getCountry() { + return this.country; + } + + /** + * Sets the <code>country</code> property to this instance. + * + * @param country - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setCountry(final String country) { + firePropertyChange("country", this.country, this.country = country ); + } + + /** + * Returns the phone1 property or <code>null</code> if not present. + */ + public String getPhone1() { + return this.phone1; + } + + /** + * Sets the <code>phone1</code> property to this instance. + * + * @param phone1 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPhone1(final String phone1) { + firePropertyChange("phone1", this.phone1, this.phone1 = phone1 ); + } + + /** + * Returns the phone2 property or <code>null</code> if not present. + */ + public String getPhone2() { + return this.phone2; + } + + /** + * Sets the <code>phone2</code> property to this instance. + * + * @param phone2 - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPhone2(final String phone2) { + firePropertyChange("phone2", this.phone2, this.phone2 = phone2 ); + } + + /** + * Returns the birthdate property or <code>null</code> if not present. + */ + public Date getBirthdate() { + return this.birthdate; + } + + /** + * Sets the <code>birthdate</code> property to this instance. + * + * @param birthdate - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setBirthdate(final Date birthdate) { + firePropertyChange("birthdate", this.birthdate, this.birthdate = birthdate ); + } + + /** + * Returns the marital_status property or <code>null</code> if not present. + */ + public String getMarital_status() { + return this.marital_status; + } + + /** + * Sets the <code>marital_status</code> property to this instance. + * + * @param marital_status - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMarital_status(final String marital_status) { + firePropertyChange("marital_status", this.marital_status, this.marital_status = marital_status ); + } + + /** + * Returns the yearly_income property or <code>null</code> if not present. + */ + public String getYearly_income() { + return this.yearly_income; + } + + /** + * Sets the <code>yearly_income</code> property to this instance. + * + * @param yearly_income - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setYearly_income(final String yearly_income) { + firePropertyChange("yearly_income", this.yearly_income, this.yearly_income = yearly_income ); + } + + /** + * Returns the gender property or <code>null</code> if not present. + */ + public String getGender() { + return this.gender; + } + + /** + * Sets the <code>gender</code> property to this instance. + * + * @param gender - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setGender(final String gender) { + firePropertyChange("gender", this.gender, this.gender = gender ); + } + + /** + * Returns the total_children property or <code>null</code> if not present. + */ + public int getTotal_children() { + return this.total_children; + } + + /** + * Sets the <code>total_children</code> property to this instance. + * + * @param total_children - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setTotal_children(final int total_children) { + firePropertyChange("total_children", this.total_children, this.total_children = total_children ); + } + + /** + * Returns the num_children_at_home property or <code>null</code> if not present. + */ + public int getNum_children_at_home() { + return this.num_children_at_home; + } + + /** + * Sets the <code>num_children_at_home</code> property to this instance. + * + * @param num_children_at_home - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNum_children_at_home(final int num_children_at_home) { + firePropertyChange("num_children_at_home", this.num_children_at_home, this.num_children_at_home = num_children_at_home ); + } + + /** + * Returns the education property or <code>null</code> if not present. + */ + public String getEducation() { + return this.education; + } + + /** + * Sets the <code>education</code> property to this instance. + * + * @param education - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setEducation(final String education) { + firePropertyChange("education", this.education, this.education = education ); + } + + /** + * Returns the date_accnt_opened property or <code>null</code> if not present. + */ + public String getDate_accnt_opened() { + return this.date_accnt_opened; + } + + /** + * Sets the <code>date_accnt_opened</code> property to this instance. + * + * @param date_accnt_opened - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDate_accnt_opened(final String date_accnt_opened) { + firePropertyChange("date_accnt_opened", this.date_accnt_opened, this.date_accnt_opened = date_accnt_opened ); + } + + /** + * Returns the member_card property or <code>null</code> if not present. + */ + public String getMember_card() { + return this.member_card; + } + + /** + * Sets the <code>member_card</code> property to this instance. + * + * @param member_card - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMember_card(final String member_card) { + firePropertyChange("member_card", this.member_card, this.member_card = member_card ); + } + + /** + * Returns the occupation property or <code>null</code> if not present. + */ + public String getOccupation() { + return this.occupation; + } + + /** + * Sets the <code>occupation</code> property to this instance. + * + * @param occupation - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setOccupation(final String occupation) { + firePropertyChange("occupation", this.occupation, this.occupation = occupation ); + } + + /** + * Returns the houseowner property or <code>null</code> if not present. + */ + public String getHouseowner() { + return this.houseowner; + } + + /** + * Sets the <code>houseowner</code> property to this instance. + * + * @param houseowner - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setHouseowner(final String houseowner) { + firePropertyChange("houseowner", this.houseowner, this.houseowner = houseowner ); + } + + /** + * Returns the num_cars_owned property or <code>null</code> if not present. + */ + public int getNum_cars_owned() { + return this.num_cars_owned; + } + + /** + * Sets the <code>num_cars_owned</code> property to this instance. + * + * @param num_cars_owned - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNum_cars_owned(final int num_cars_owned) { + firePropertyChange("num_cars_owned", this.num_cars_owned, this.num_cars_owned = num_cars_owned ); + } + + /** + * Returns the fullname property or <code>null</code> if not present. + */ + public String getFullname() { + return this.fullname; + } + + /** + * Sets the <code>fullname</code> property to this instance. + * + * @param fullname - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setFullname(final String fullname) { + firePropertyChange("fullname", this.fullname, this.fullname = fullname ); + } + + /** + * Returns the test property or <code>null</code> if not present. + */ + public String getTest() { + return this.test; + } + + /** + * Sets the <code>test</code> property to this instance. + * + * @param test - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setTest(final String test) { + firePropertyChange("test", this.test, this.test = test ); + } + + /** + * Returns an unmodifiable list of slips. + */ + public List<CashSlipDto> getSlips() { + return Collections.unmodifiableList(internalGetSlips()); + } + + /** + * Returns the list of <code>CashSlipDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<CashSlipDto> internalGetSlips() { + if (this.slips == null) { + this.slips = new java.util.ArrayList<CashSlipDto>(); + } + return this.slips; + } + + /** + * Adds the given cashSlipDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>CashSlipDto#customer</code> of the <code>cashSlipDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setCustomer(CashSlipDto)}. + * + * @param cashSlipDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToSlips(final CashSlipDto cashSlipDto) { + checkDisposed(); + + cashSlipDto.setCustomer(this); + } + + /** + * Removes the given cashSlipDto from this object. <p> + * + * @param cashSlipDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromSlips(final CashSlipDto cashSlipDto) { + checkDisposed(); + + cashSlipDto.setCustomer(null); + } + + /** + * For internal use only! + */ + public void internalAddToSlips(final CashSlipDto cashSlipDto) { + + if(!internalGetSlips().contains(cashSlipDto)) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashSlipDto> oldList = new java.util.ArrayList<>(internalGetSlips()); + internalGetSlips().add(cashSlipDto); + firePropertyChange("slips", oldList, internalGetSlips()); + } else { + // in mapping mode, we do NOT resolve any collection + internalGetSlips().add(cashSlipDto); + } + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromSlips(final CashSlipDto cashSlipDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + // collections will become resolved! We need to send a delta notification. + List<CashSlipDto> oldList = new java.util.ArrayList<>(internalGetSlips()); + internalGetSlips().remove(cashSlipDto); + firePropertyChange("slips", oldList, internalGetSlips()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetSlips().remove(cashSlipDto); + } + } + + /** + * Sets the <code>slips</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>CashSlipDto# + * customer</code> of the <code>slips</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link CashSlipDto#setCustomer(CashSlipDto) + * + * @param slips - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setSlips(final List<CashSlipDto> slips) { + checkDisposed(); + for (CashSlipDto dto : internalGetSlips().toArray(new CashSlipDto[this.slips.size()])) { + removeFromSlips(dto); + } + + if(slips == null) { + return; + } + + for (CashSlipDto dto : slips) { + addToSlips(dto); + } + } + + /** + * Returns the foo property or <code>null</code> if not present. + */ + public String getFoo() { + return this.foo; + } + + /** + * Sets the <code>foo</code> property to this instance. + * + * @param foo - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setFoo(final String foo) { + firePropertyChange("foo", this.foo, this.foo = foo ); + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + super.propertyChange(event); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/AddressDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/AddressDtoMapper.java new file mode 100644 index 0000000..02dbc5f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/AddressDtoMapper.java
@@ -0,0 +1,467 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.dtos.DepartmentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.Address; +import org.osbp.tests.entities.Company; +import org.osbp.tests.entities.Department; + +/** + * This class maps the dto {@link AddressDto} to and from the entity {@link Address}. + * + */ +@SuppressWarnings("all") +public class AddressDtoMapper<DTO extends AddressDto, ENTITY extends Address> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public Address createEntity() { + return new Address(); + } + + /** + * Creates a new instance of the dto + */ + public AddressDto createDto() { + return new AddressDto(); + } + + /** + * Maps the entity {@link Address} to the dto {@link AddressDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final AddressDto dto, final Address entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setCompany(toDto_company(entity, context)); + dto.setDepartment(toDto_department(entity, context)); + dto.setAddress1(toDto_address1(entity, context)); + dto.setAddress2(toDto_address2(entity, context)); + dto.setCity(toDto_city(entity, context)); + dto.setState_province(toDto_state_province(entity, context)); + dto.setPostal_code(toDto_postal_code(entity, context)); + dto.setCountry(toDto_country(entity, context)); + dto.setEmail(toDto_email(entity, context)); + dto.setLandline(toDto_landline(entity, context)); + dto.setMobile(toDto_mobile(entity, context)); + } + + /** + * Maps the dto {@link AddressDto} to the entity {@link Address}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final AddressDto dto, final Address entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setCompany(toEntity_company(dto, entity, context)); + entity.setDepartment(toEntity_department(dto, entity, context)); + entity.setAddress1(toEntity_address1(dto, entity, context)); + entity.setAddress2(toEntity_address2(dto, entity, context)); + entity.setCity(toEntity_city(dto, entity, context)); + entity.setState_province(toEntity_state_province(dto, entity, context)); + entity.setPostal_code(toEntity_postal_code(dto, entity, context)); + entity.setCountry(toEntity_country(dto, entity, context)); + entity.setEmail(toEntity_email(dto, entity, context)); + entity.setLandline(toEntity_landline(dto, entity, context)); + entity.setMobile(toEntity_mobile(dto, entity, context)); + } + + /** + * Maps the property company from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CompanyDto toDto_company(final Address in, final MappingContext context) { + if(in.getCompany() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToDtoMapper(CompanyDto.class, in.getCompany().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CompanyDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCompany())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCompany(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCompany(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property company from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected Company toEntity_company(final AddressDto in, final Address parentEntity, final MappingContext context) { + if(in.getCompany() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToEntityMapper(in.getCompany().getClass(), Company.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + Company entity = null; + entity = context.get(mapper.createEntityHash(in.getCompany())); + if(entity != null) { + return entity; + } else { + entity = (Company) context + .findEntityByEntityManager(Company.class, in.getCompany().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCompany()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCompany(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property department from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected DepartmentDto toDto_department(final Address in, final MappingContext context) { + if(in.getDepartment() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DepartmentDto, Department> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DepartmentDto, Department>) getToDtoMapper(DepartmentDto.class, in.getDepartment().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + DepartmentDto dto = null; + dto = context.get(mapper.createDtoHash(in.getDepartment())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getDepartment(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getDepartment(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property department from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected Department toEntity_department(final AddressDto in, final Address parentEntity, final MappingContext context) { + if(in.getDepartment() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DepartmentDto, Department> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DepartmentDto, Department>) getToEntityMapper(in.getDepartment().getClass(), Department.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + Department entity = null; + entity = context.get(mapper.createEntityHash(in.getDepartment())); + if(entity != null) { + return entity; + } else { + entity = (Department) context + .findEntityByEntityManager(Department.class, in.getDepartment().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getDepartment()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getDepartment(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property address1 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address1(final Address in, final MappingContext context) { + return in.getAddress1(); + } + + /** + * Maps the property address1 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address1(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getAddress1(); + } + + /** + * Maps the property address2 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address2(final Address in, final MappingContext context) { + return in.getAddress2(); + } + + /** + * Maps the property address2 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address2(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getAddress2(); + } + + /** + * Maps the property city from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_city(final Address in, final MappingContext context) { + return in.getCity(); + } + + /** + * Maps the property city from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_city(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getCity(); + } + + /** + * Maps the property state_province from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_state_province(final Address in, final MappingContext context) { + return in.getState_province(); + } + + /** + * Maps the property state_province from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_state_province(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getState_province(); + } + + /** + * Maps the property postal_code from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_postal_code(final Address in, final MappingContext context) { + return in.getPostal_code(); + } + + /** + * Maps the property postal_code from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_postal_code(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getPostal_code(); + } + + /** + * Maps the property country from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_country(final Address in, final MappingContext context) { + return in.getCountry(); + } + + /** + * Maps the property country from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_country(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getCountry(); + } + + /** + * Maps the property email from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_email(final Address in, final MappingContext context) { + return in.getEmail(); + } + + /** + * Maps the property email from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_email(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getEmail(); + } + + /** + * Maps the property landline from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_landline(final Address in, final MappingContext context) { + return in.getLandline(); + } + + /** + * Maps the property landline from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_landline(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getLandline(); + } + + /** + * Maps the property mobile from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_mobile(final Address in, final MappingContext context) { + return in.getMobile(); + } + + /** + * Maps the property mobile from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_mobile(final AddressDto in, final Address parentEntity, final MappingContext context) { + return in.getMobile(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(AddressDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Address.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseIDDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseIDDtoMapper.java new file mode 100644 index 0000000..35fb8e6 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseIDDtoMapper.java
@@ -0,0 +1,141 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.IMapper; +import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.BaseIDDto; +import org.osbp.tests.entities.BaseID; + +/** + * This class maps the dto {@link BaseIDDto} to and from the entity {@link BaseID}. + * + */ +@SuppressWarnings("all") +public class BaseIDDtoMapper<DTO extends BaseIDDto, ENTITY extends BaseID> implements IMapper<DTO, ENTITY> { + private IMapperAccess mapperAccess; + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToDtoMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToDtoMapper(dtoClass, entityClass); + } + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToEntityMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToEntityMapper(dtoClass, entityClass); + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void bindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = mapperAccess; + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void unbindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = null; + } + + /** + * Creates a new instance of the entity + */ + public BaseID createEntity() { + return new BaseID(); + } + + /** + * Creates a new instance of the dto + */ + public BaseIDDto createDto() { + return new BaseIDDto(); + } + + /** + * Maps the entity {@link BaseID} to the dto {@link BaseIDDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final BaseIDDto dto, final BaseID entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + dto.setId(toDto_id(entity, context)); + } + + /** + * Maps the dto {@link BaseIDDto} to the entity {@link BaseID}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final BaseIDDto dto, final BaseID entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + + entity.setId(toEntity_id(dto, entity, context)); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toDto_id(final BaseID in, final MappingContext context) { + return in.getId(); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toEntity_id(final BaseIDDto in, final BaseID parentEntity, final MappingContext context) { + return in.getId(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(BaseIDDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(BaseID.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseUUIDDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseUUIDDtoMapper.java new file mode 100644 index 0000000..693f468 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/BaseUUIDDtoMapper.java
@@ -0,0 +1,141 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.IMapper; +import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.entities.BaseUUID; + +/** + * This class maps the dto {@link BaseUUIDDto} to and from the entity {@link BaseUUID}. + * + */ +@SuppressWarnings("all") +public class BaseUUIDDtoMapper<DTO extends BaseUUIDDto, ENTITY extends BaseUUID> implements IMapper<DTO, ENTITY> { + private IMapperAccess mapperAccess; + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToDtoMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToDtoMapper(dtoClass, entityClass); + } + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToEntityMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToEntityMapper(dtoClass, entityClass); + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void bindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = mapperAccess; + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void unbindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = null; + } + + /** + * Creates a new instance of the entity + */ + public BaseUUID createEntity() { + return new BaseUUID(); + } + + /** + * Creates a new instance of the dto + */ + public BaseUUIDDto createDto() { + return new BaseUUIDDto(); + } + + /** + * Maps the entity {@link BaseUUID} to the dto {@link BaseUUIDDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final BaseUUIDDto dto, final BaseUUID entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + dto.setId(toDto_id(entity, context)); + } + + /** + * Maps the dto {@link BaseUUIDDto} to the entity {@link BaseUUID}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final BaseUUIDDto dto, final BaseUUID entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + + entity.setId(toEntity_id(dto, entity, context)); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_id(final BaseUUID in, final MappingContext context) { + return in.getId(); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_id(final BaseUUIDDto in, final BaseUUID parentEntity, final MappingContext context) { + return in.getId(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(BaseUUIDDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(BaseUUID.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentDtoMapper.java new file mode 100644 index 0000000..046fc2d --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentDtoMapper.java
@@ -0,0 +1,279 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.Date; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashPaymentDto; +import org.osbp.tests.dtos.CashPaymentMethodDto; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CashPayment; +import org.osbp.tests.entities.CashPaymentMethod; +import org.osbp.tests.entities.CashSlip; + +/** + * This class maps the dto {@link CashPaymentDto} to and from the entity {@link CashPayment}. + * + */ +@SuppressWarnings("all") +public class CashPaymentDtoMapper<DTO extends CashPaymentDto, ENTITY extends CashPayment> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CashPayment createEntity() { + return new CashPayment(); + } + + /** + * Creates a new instance of the dto + */ + public CashPaymentDto createDto() { + return new CashPaymentDto(); + } + + /** + * Maps the entity {@link CashPayment} to the dto {@link CashPaymentDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CashPaymentDto dto, final CashPayment entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setNow(toDto_now(entity, context)); + dto.setPayed(toDto_payed(entity, context)); + dto.setSlip(toDto_slip(entity, context)); + dto.setMethodOfPayment(toDto_methodOfPayment(entity, context)); + } + + /** + * Maps the dto {@link CashPaymentDto} to the entity {@link CashPayment}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CashPaymentDto dto, final CashPayment entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setNow(toEntity_now(dto, entity, context)); + entity.setPayed(toEntity_payed(dto, entity, context)); + entity.setSlip(toEntity_slip(dto, entity, context)); + entity.setMethodOfPayment(toEntity_methodOfPayment(dto, entity, context)); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toDto_now(final CashPayment in, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toEntity_now(final CashPaymentDto in, final CashPayment parentEntity, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property payed from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toDto_payed(final CashPayment in, final MappingContext context) { + return in.getPayed(); + } + + /** + * Maps the property payed from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toEntity_payed(final CashPaymentDto in, final CashPayment parentEntity, final MappingContext context) { + return in.getPayed(); + } + + /** + * Maps the property slip from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CashSlipDto toDto_slip(final CashPayment in, final MappingContext context) { + if(in.getSlip() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip>) getToDtoMapper(CashSlipDto.class, in.getSlip().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CashSlipDto dto = null; + dto = context.get(mapper.createDtoHash(in.getSlip())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getSlip(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getSlip(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property slip from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CashSlip toEntity_slip(final CashPaymentDto in, final CashPayment parentEntity, final MappingContext context) { + if(in.getSlip() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip>) getToEntityMapper(in.getSlip().getClass(), CashSlip.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CashSlip entity = null; + entity = context.get(mapper.createEntityHash(in.getSlip())); + if(entity != null) { + return entity; + } else { + entity = (CashSlip) context + .findEntityByEntityManager(CashSlip.class, in.getSlip().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getSlip()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getSlip(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property methodOfPayment from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CashPaymentMethodDto toDto_methodOfPayment(final CashPayment in, final MappingContext context) { + if(in.getMethodOfPayment() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentMethodDto, CashPaymentMethod> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentMethodDto, CashPaymentMethod>) getToDtoMapper(CashPaymentMethodDto.class, in.getMethodOfPayment().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CashPaymentMethodDto dto = null; + dto = context.get(mapper.createDtoHash(in.getMethodOfPayment())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getMethodOfPayment(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getMethodOfPayment(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property methodOfPayment from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CashPaymentMethod toEntity_methodOfPayment(final CashPaymentDto in, final CashPayment parentEntity, final MappingContext context) { + if(in.getMethodOfPayment() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentMethodDto, CashPaymentMethod> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentMethodDto, CashPaymentMethod>) getToEntityMapper(in.getMethodOfPayment().getClass(), CashPaymentMethod.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CashPaymentMethod entity = null; + entity = context.get(mapper.createEntityHash(in.getMethodOfPayment())); + if(entity != null) { + return entity; + } else { + entity = (CashPaymentMethod) context + .findEntityByEntityManager(CashPaymentMethod.class, in.getMethodOfPayment().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getMethodOfPayment()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getMethodOfPayment(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPaymentDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPayment.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentMethodDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentMethodDtoMapper.java new file mode 100644 index 0000000..fdce801 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPaymentMethodDtoMapper.java
@@ -0,0 +1,254 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashPaymentDto; +import org.osbp.tests.dtos.CashPaymentMethodDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CashPayment; +import org.osbp.tests.entities.CashPaymentMethod; + +/** + * This class maps the dto {@link CashPaymentMethodDto} to and from the entity {@link CashPaymentMethod}. + * + */ +@SuppressWarnings("all") +public class CashPaymentMethodDtoMapper<DTO extends CashPaymentMethodDto, ENTITY extends CashPaymentMethod> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CashPaymentMethod createEntity() { + return new CashPaymentMethod(); + } + + /** + * Creates a new instance of the dto + */ + public CashPaymentMethodDto createDto() { + return new CashPaymentMethodDto(); + } + + /** + * Maps the entity {@link CashPaymentMethod} to the dto {@link CashPaymentMethodDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CashPaymentMethodDto dto, final CashPaymentMethod entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setNum(toDto_num(entity, context)); + dto.setName(toDto_name(entity, context)); + dto.setCredit(toDto_credit(entity, context)); + dto.setImageName(toDto_imageName(entity, context)); + dto.setLowerLimit(toDto_lowerLimit(entity, context)); + } + + /** + * Maps the dto {@link CashPaymentMethodDto} to the entity {@link CashPaymentMethod}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CashPaymentMethodDto dto, final CashPaymentMethod entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setNum(toEntity_num(dto, entity, context)); + entity.setName(toEntity_name(dto, entity, context)); + entity.setCredit(toEntity_credit(dto, entity, context)); + entity.setImageName(toEntity_imageName(dto, entity, context)); + entity.setLowerLimit(toEntity_lowerLimit(dto, entity, context)); + toEntity_payments(dto, entity, context); + } + + /** + * Maps the property num from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_num(final CashPaymentMethod in, final MappingContext context) { + return in.getNum(); + } + + /** + * Maps the property num from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_num(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + return in.getNum(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_name(final CashPaymentMethod in, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_name(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property credit from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Boolean toDto_credit(final CashPaymentMethod in, final MappingContext context) { + return in.getCredit(); + } + + /** + * Maps the property credit from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Boolean toEntity_credit(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + return in.getCredit(); + } + + /** + * Maps the property imageName from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_imageName(final CashPaymentMethod in, final MappingContext context) { + return in.getImageName(); + } + + /** + * Maps the property imageName from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_imageName(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + return in.getImageName(); + } + + /** + * Maps the property lowerLimit from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toDto_lowerLimit(final CashPaymentMethod in, final MappingContext context) { + return in.getLowerLimit(); + } + + /** + * Maps the property lowerLimit from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toEntity_lowerLimit(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + return in.getLowerLimit(); + } + + /** + * Maps the property payments from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CashPaymentDto> toDto_payments(final CashPaymentMethod in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property payments from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<CashPayment> toEntity_payments(final CashPaymentMethodDto in, final CashPaymentMethod parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentDto, CashPayment> mapper = getToEntityMapper(CashPaymentDto.class, CashPayment.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPaymentDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPaymentDto>) in.internalGetPayments(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToPayments, + parentEntity::internalRemoveFromPayments); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPaymentMethodDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPaymentMethod.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPositionDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPositionDtoMapper.java new file mode 100644 index 0000000..0eaaea0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashPositionDtoMapper.java
@@ -0,0 +1,257 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.Date; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashPositionDto; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CashPosition; +import org.osbp.tests.entities.CashSlip; + +/** + * This class maps the dto {@link CashPositionDto} to and from the entity {@link CashPosition}. + * + */ +@SuppressWarnings("all") +public class CashPositionDtoMapper<DTO extends CashPositionDto, ENTITY extends CashPosition> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CashPosition createEntity() { + return new CashPosition(); + } + + /** + * Creates a new instance of the dto + */ + public CashPositionDto createDto() { + return new CashPositionDto(); + } + + /** + * Maps the entity {@link CashPosition} to the dto {@link CashPositionDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CashPositionDto dto, final CashPosition entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setNow(toDto_now(entity, context)); + dto.setQuantity(toDto_quantity(entity, context)); + dto.setPrice(toDto_price(entity, context)); + dto.setAmount(toDto_amount(entity, context)); + dto.setSlip(toDto_slip(entity, context)); + } + + /** + * Maps the dto {@link CashPositionDto} to the entity {@link CashPosition}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CashPositionDto dto, final CashPosition entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setNow(toEntity_now(dto, entity, context)); + entity.setQuantity(toEntity_quantity(dto, entity, context)); + entity.setPrice(toEntity_price(dto, entity, context)); + entity.setAmount(toEntity_amount(dto, entity, context)); + entity.setSlip(toEntity_slip(dto, entity, context)); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toDto_now(final CashPosition in, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toEntity_now(final CashPositionDto in, final CashPosition parentEntity, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property quantity from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toDto_quantity(final CashPosition in, final MappingContext context) { + return in.getQuantity(); + } + + /** + * Maps the property quantity from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toEntity_quantity(final CashPositionDto in, final CashPosition parentEntity, final MappingContext context) { + return in.getQuantity(); + } + + /** + * Maps the property price from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toDto_price(final CashPosition in, final MappingContext context) { + return in.getPrice(); + } + + /** + * Maps the property price from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toEntity_price(final CashPositionDto in, final CashPosition parentEntity, final MappingContext context) { + return in.getPrice(); + } + + /** + * Maps the property amount from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toDto_amount(final CashPosition in, final MappingContext context) { + return in.getAmount(); + } + + /** + * Maps the property amount from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toEntity_amount(final CashPositionDto in, final CashPosition parentEntity, final MappingContext context) { + return in.getAmount(); + } + + /** + * Maps the property slip from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CashSlipDto toDto_slip(final CashPosition in, final MappingContext context) { + if(in.getSlip() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip>) getToDtoMapper(CashSlipDto.class, in.getSlip().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CashSlipDto dto = null; + dto = context.get(mapper.createDtoHash(in.getSlip())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getSlip(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getSlip(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property slip from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CashSlip toEntity_slip(final CashPositionDto in, final CashPosition parentEntity, final MappingContext context) { + if(in.getSlip() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip>) getToEntityMapper(in.getSlip().getClass(), CashSlip.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CashSlip entity = null; + entity = context.get(mapper.createEntityHash(in.getSlip())); + if(entity != null) { + return entity; + } else { + entity = (CashSlip) context + .findEntityByEntityManager(CashSlip.class, in.getSlip().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getSlip()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getSlip(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPositionDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashPosition.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashRegisterDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashRegisterDtoMapper.java new file mode 100644 index 0000000..03a3321 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashRegisterDtoMapper.java
@@ -0,0 +1,227 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashRegisterDto; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CashRegister; +import org.osbp.tests.entities.CashSlip; + +/** + * This class maps the dto {@link CashRegisterDto} to and from the entity {@link CashRegister}. + * + */ +@SuppressWarnings("all") +public class CashRegisterDtoMapper<DTO extends CashRegisterDto, ENTITY extends CashRegister> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CashRegister createEntity() { + return new CashRegister(); + } + + /** + * Creates a new instance of the dto + */ + public CashRegisterDto createDto() { + return new CashRegisterDto(); + } + + /** + * Maps the entity {@link CashRegister} to the dto {@link CashRegisterDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CashRegisterDto dto, final CashRegister entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setNum(toDto_num(entity, context)); + dto.setIp(toDto_ip(entity, context)); + dto.setLocation(toDto_location(entity, context)); + dto.setCurrentDay(toDto_currentDay(entity, context)); + } + + /** + * Maps the dto {@link CashRegisterDto} to the entity {@link CashRegister}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CashRegisterDto dto, final CashRegister entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setNum(toEntity_num(dto, entity, context)); + entity.setIp(toEntity_ip(dto, entity, context)); + entity.setLocation(toEntity_location(dto, entity, context)); + entity.setCurrentDay(toEntity_currentDay(dto, entity, context)); + toEntity_slips(dto, entity, context); + } + + /** + * Maps the property num from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_num(final CashRegister in, final MappingContext context) { + return in.getNum(); + } + + /** + * Maps the property num from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_num(final CashRegisterDto in, final CashRegister parentEntity, final MappingContext context) { + return in.getNum(); + } + + /** + * Maps the property ip from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_ip(final CashRegister in, final MappingContext context) { + return in.getIp(); + } + + /** + * Maps the property ip from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_ip(final CashRegisterDto in, final CashRegister parentEntity, final MappingContext context) { + return in.getIp(); + } + + /** + * Maps the property location from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_location(final CashRegister in, final MappingContext context) { + return in.getLocation(); + } + + /** + * Maps the property location from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_location(final CashRegisterDto in, final CashRegister parentEntity, final MappingContext context) { + return in.getLocation(); + } + + /** + * Maps the property currentDay from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_currentDay(final CashRegister in, final MappingContext context) { + return in.getCurrentDay(); + } + + /** + * Maps the property currentDay from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_currentDay(final CashRegisterDto in, final CashRegister parentEntity, final MappingContext context) { + return in.getCurrentDay(); + } + + /** + * Maps the property slips from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CashSlipDto> toDto_slips(final CashRegister in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property slips from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<CashSlip> toEntity_slips(final CashRegisterDto in, final CashRegister parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = getToEntityMapper(CashSlipDto.class, CashSlip.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashSlipDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashSlipDto>) in.internalGetSlips(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToSlips, + parentEntity::internalRemoveFromSlips); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashRegisterDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashRegister.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashSlipDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashSlipDtoMapper.java new file mode 100644 index 0000000..2faeacc --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CashSlipDtoMapper.java
@@ -0,0 +1,480 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.Date; +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashPaymentDto; +import org.osbp.tests.dtos.CashPositionDto; +import org.osbp.tests.dtos.CashRegisterDto; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.McustomerDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CashPayment; +import org.osbp.tests.entities.CashPosition; +import org.osbp.tests.entities.CashRegister; +import org.osbp.tests.entities.CashSlip; +import org.osbp.tests.entities.Mcustomer; + +/** + * This class maps the dto {@link CashSlipDto} to and from the entity {@link CashSlip}. + * + */ +@SuppressWarnings("all") +public class CashSlipDtoMapper<DTO extends CashSlipDto, ENTITY extends CashSlip> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CashSlip createEntity() { + return new CashSlip(); + } + + /** + * Creates a new instance of the dto + */ + public CashSlipDto createDto() { + return new CashSlipDto(); + } + + /** + * Maps the entity {@link CashSlip} to the dto {@link CashSlipDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CashSlipDto dto, final CashSlip entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setCurrentDay(toDto_currentDay(entity, context)); + dto.setNow(toDto_now(entity, context)); + dto.setCashier(toDto_cashier(entity, context)); + dto.setTotal(toDto_total(entity, context)); + dto.setSerial(toDto_serial(entity, context)); + dto.setPayed(toDto_payed(entity, context)); + dto.setCustomer(toDto_customer(entity, context)); + dto.setRegister(toDto_register(entity, context)); + } + + /** + * Maps the dto {@link CashSlipDto} to the entity {@link CashSlip}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CashSlipDto dto, final CashSlip entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setCurrentDay(toEntity_currentDay(dto, entity, context)); + entity.setNow(toEntity_now(dto, entity, context)); + entity.setCashier(toEntity_cashier(dto, entity, context)); + entity.setTotal(toEntity_total(dto, entity, context)); + entity.setSerial(toEntity_serial(dto, entity, context)); + entity.setPayed(toEntity_payed(dto, entity, context)); + toEntity_positions(dto, entity, context); + entity.setCustomer(toEntity_customer(dto, entity, context)); + entity.setRegister(toEntity_register(dto, entity, context)); + toEntity_payments(dto, entity, context); + } + + /** + * Maps the property currentDay from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_currentDay(final CashSlip in, final MappingContext context) { + return in.getCurrentDay(); + } + + /** + * Maps the property currentDay from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_currentDay(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getCurrentDay(); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toDto_now(final CashSlip in, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property now from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toEntity_now(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getNow(); + } + + /** + * Maps the property cashier from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_cashier(final CashSlip in, final MappingContext context) { + return in.getCashier(); + } + + /** + * Maps the property cashier from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_cashier(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getCashier(); + } + + /** + * Maps the property total from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toDto_total(final CashSlip in, final MappingContext context) { + return in.getTotal(); + } + + /** + * Maps the property total from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Double toEntity_total(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getTotal(); + } + + /** + * Maps the property serial from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected long toDto_serial(final CashSlip in, final MappingContext context) { + return in.getSerial(); + } + + /** + * Maps the property serial from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected long toEntity_serial(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getSerial(); + } + + /** + * Maps the property payed from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected boolean toDto_payed(final CashSlip in, final MappingContext context) { + return in.getPayed(); + } + + /** + * Maps the property payed from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected boolean toEntity_payed(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + return in.getPayed(); + } + + /** + * Maps the property positions from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CashPositionDto> toDto_positions(final CashSlip in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property positions from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<CashPosition> toEntity_positions(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CashPositionDto, CashPosition> mapper = getToEntityMapper(CashPositionDto.class, CashPosition.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPositionDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPositionDto>) in.internalGetPositions(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToPositions, + parentEntity::internalRemoveFromPositions); + return null; + } + + /** + * Maps the property customer from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected McustomerDto toDto_customer(final CashSlip in, final MappingContext context) { + if(in.getCustomer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<McustomerDto, Mcustomer> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<McustomerDto, Mcustomer>) getToDtoMapper(McustomerDto.class, in.getCustomer().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + McustomerDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCustomer())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCustomer(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCustomer(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property customer from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected Mcustomer toEntity_customer(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + if(in.getCustomer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<McustomerDto, Mcustomer> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<McustomerDto, Mcustomer>) getToEntityMapper(in.getCustomer().getClass(), Mcustomer.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + Mcustomer entity = null; + entity = context.get(mapper.createEntityHash(in.getCustomer())); + if(entity != null) { + return entity; + } else { + entity = (Mcustomer) context + .findEntityByEntityManager(Mcustomer.class, in.getCustomer().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCustomer()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCustomer(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property register from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CashRegisterDto toDto_register(final CashSlip in, final MappingContext context) { + if(in.getRegister() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashRegisterDto, CashRegister> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashRegisterDto, CashRegister>) getToDtoMapper(CashRegisterDto.class, in.getRegister().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CashRegisterDto dto = null; + dto = context.get(mapper.createDtoHash(in.getRegister())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getRegister(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getRegister(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property register from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CashRegister toEntity_register(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + if(in.getRegister() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CashRegisterDto, CashRegister> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CashRegisterDto, CashRegister>) getToEntityMapper(in.getRegister().getClass(), CashRegister.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CashRegister entity = null; + entity = context.get(mapper.createEntityHash(in.getRegister())); + if(entity != null) { + return entity; + } else { + entity = (CashRegister) context + .findEntityByEntityManager(CashRegister.class, in.getRegister().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getRegister()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getRegister(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property payments from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CashPaymentDto> toDto_payments(final CashSlip in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property payments from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<CashPayment> toEntity_payments(final CashSlipDto in, final CashSlip parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CashPaymentDto, CashPayment> mapper = getToEntityMapper(CashPaymentDto.class, CashPayment.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPaymentDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashPaymentDto>) in.internalGetPayments(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToPayments, + parentEntity::internalRemoveFromPayments); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashSlipDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CashSlip.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyDtoMapper.java new file mode 100644 index 0000000..c0001ec --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyDtoMapper.java
@@ -0,0 +1,371 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.dtos.CompanyGroupDto; +import org.osbp.tests.dtos.CompanyRelationTypeDto; +import org.osbp.tests.dtos.DepartmentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.Address; +import org.osbp.tests.entities.Company; +import org.osbp.tests.entities.CompanyGroup; +import org.osbp.tests.entities.CompanyRelationType; +import org.osbp.tests.entities.Department; + +/** + * This class maps the dto {@link CompanyDto} to and from the entity {@link Company}. + * + */ +@SuppressWarnings("all") +public class CompanyDtoMapper<DTO extends CompanyDto, ENTITY extends Company> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public Company createEntity() { + return new Company(); + } + + /** + * Creates a new instance of the dto + */ + public CompanyDto createDto() { + return new CompanyDto(); + } + + /** + * Maps the entity {@link Company} to the dto {@link CompanyDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CompanyDto dto, final Company entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setCompany_group(toDto_company_group(entity, context)); + dto.setName(toDto_name(entity, context)); + dto.setDescription(toDto_description(entity, context)); + dto.setRelation_type(toDto_relation_type(entity, context)); + } + + /** + * Maps the dto {@link CompanyDto} to the entity {@link Company}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CompanyDto dto, final Company entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setCompany_group(toEntity_company_group(dto, entity, context)); + entity.setName(toEntity_name(dto, entity, context)); + entity.setDescription(toEntity_description(dto, entity, context)); + entity.setRelation_type(toEntity_relation_type(dto, entity, context)); + toEntity_address(dto, entity, context); + toEntity_departments(dto, entity, context); + } + + /** + * Maps the property company_group from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CompanyGroupDto toDto_company_group(final Company in, final MappingContext context) { + if(in.getCompany_group() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyGroupDto, CompanyGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyGroupDto, CompanyGroup>) getToDtoMapper(CompanyGroupDto.class, in.getCompany_group().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CompanyGroupDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCompany_group())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCompany_group(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCompany_group(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property company_group from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CompanyGroup toEntity_company_group(final CompanyDto in, final Company parentEntity, final MappingContext context) { + if(in.getCompany_group() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyGroupDto, CompanyGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyGroupDto, CompanyGroup>) getToEntityMapper(in.getCompany_group().getClass(), CompanyGroup.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CompanyGroup entity = null; + entity = context.get(mapper.createEntityHash(in.getCompany_group())); + if(entity != null) { + return entity; + } else { + entity = (CompanyGroup) context + .findEntityByEntityManager(CompanyGroup.class, in.getCompany_group().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCompany_group()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCompany_group(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_name(final Company in, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_name(final CompanyDto in, final Company parentEntity, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_description(final Company in, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_description(final CompanyDto in, final Company parentEntity, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property relation_type from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CompanyRelationTypeDto toDto_relation_type(final Company in, final MappingContext context) { + if(in.getRelation_type() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyRelationTypeDto, CompanyRelationType> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyRelationTypeDto, CompanyRelationType>) getToDtoMapper(CompanyRelationTypeDto.class, in.getRelation_type().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CompanyRelationTypeDto dto = null; + dto = context.get(mapper.createDtoHash(in.getRelation_type())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getRelation_type(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getRelation_type(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property relation_type from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected CompanyRelationType toEntity_relation_type(final CompanyDto in, final Company parentEntity, final MappingContext context) { + if(in.getRelation_type() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyRelationTypeDto, CompanyRelationType> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyRelationTypeDto, CompanyRelationType>) getToEntityMapper(in.getRelation_type().getClass(), CompanyRelationType.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + CompanyRelationType entity = null; + entity = context.get(mapper.createEntityHash(in.getRelation_type())); + if(entity != null) { + return entity; + } else { + entity = (CompanyRelationType) context + .findEntityByEntityManager(CompanyRelationType.class, in.getRelation_type().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getRelation_type()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getRelation_type(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property address from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<AddressDto> toDto_address(final Company in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property address from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<Address> toEntity_address(final CompanyDto in, final Company parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address> mapper = getToEntityMapper(AddressDto.class, Address.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<AddressDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<AddressDto>) in.internalGetAddress(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToAddress, + parentEntity::internalRemoveFromAddress); + return null; + } + + /** + * Maps the property departments from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<DepartmentDto> toDto_departments(final Company in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property departments from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<Department> toEntity_departments(final CompanyDto in, final Company parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<DepartmentDto, Department> mapper = getToEntityMapper(DepartmentDto.class, Department.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DepartmentDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DepartmentDto>) in.internalGetDepartments(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToDepartments, + parentEntity::internalRemoveFromDepartments); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CompanyDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Company.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyGroupDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyGroupDtoMapper.java new file mode 100644 index 0000000..acc13b7 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyGroupDtoMapper.java
@@ -0,0 +1,247 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.dtos.CompanyGroupDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.Company; +import org.osbp.tests.entities.CompanyGroup; + +/** + * This class maps the dto {@link CompanyGroupDto} to and from the entity {@link CompanyGroup}. + * + */ +@SuppressWarnings("all") +public class CompanyGroupDtoMapper<DTO extends CompanyGroupDto, ENTITY extends CompanyGroup> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CompanyGroup createEntity() { + return new CompanyGroup(); + } + + /** + * Creates a new instance of the dto + */ + public CompanyGroupDto createDto() { + return new CompanyGroupDto(); + } + + /** + * Maps the entity {@link CompanyGroup} to the dto {@link CompanyGroupDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CompanyGroupDto dto, final CompanyGroup entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setName(toDto_name(entity, context)); + dto.setDescription(toDto_description(entity, context)); + dto.setMain_company(toDto_main_company(entity, context)); + } + + /** + * Maps the dto {@link CompanyGroupDto} to the entity {@link CompanyGroup}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CompanyGroupDto dto, final CompanyGroup entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setName(toEntity_name(dto, entity, context)); + entity.setDescription(toEntity_description(dto, entity, context)); + entity.setMain_company(toEntity_main_company(dto, entity, context)); + toEntity_companies(dto, entity, context); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_name(final CompanyGroup in, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_name(final CompanyGroupDto in, final CompanyGroup parentEntity, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_description(final CompanyGroup in, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_description(final CompanyGroupDto in, final CompanyGroup parentEntity, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property main_company from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CompanyDto toDto_main_company(final CompanyGroup in, final MappingContext context) { + if(in.getMain_company() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToDtoMapper(CompanyDto.class, in.getMain_company().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CompanyDto dto = null; + dto = context.get(mapper.createDtoHash(in.getMain_company())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getMain_company(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getMain_company(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property main_company from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected Company toEntity_main_company(final CompanyGroupDto in, final CompanyGroup parentEntity, final MappingContext context) { + if(in.getMain_company() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToEntityMapper(in.getMain_company().getClass(), Company.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + Company entity = null; + entity = context.get(mapper.createEntityHash(in.getMain_company())); + if(entity != null) { + return entity; + } else { + entity = (Company) context + .findEntityByEntityManager(Company.class, in.getMain_company().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getMain_company()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getMain_company(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property companies from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CompanyDto> toDto_companies(final CompanyGroup in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property companies from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<Company> toEntity_companies(final CompanyGroupDto in, final CompanyGroup parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = getToEntityMapper(CompanyDto.class, Company.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CompanyDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CompanyDto>) in.internalGetCompanies(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToCompanies, + parentEntity::internalRemoveFromCompanies); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CompanyGroupDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CompanyGroup.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyRelationTypeDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyRelationTypeDtoMapper.java new file mode 100644 index 0000000..a8d71aa --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/CompanyRelationTypeDtoMapper.java
@@ -0,0 +1,126 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CompanyRelationTypeDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.CompanyRelationType; + +/** + * This class maps the dto {@link CompanyRelationTypeDto} to and from the entity {@link CompanyRelationType}. + * + */ +@SuppressWarnings("all") +public class CompanyRelationTypeDtoMapper<DTO extends CompanyRelationTypeDto, ENTITY extends CompanyRelationType> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public CompanyRelationType createEntity() { + return new CompanyRelationType(); + } + + /** + * Creates a new instance of the dto + */ + public CompanyRelationTypeDto createDto() { + return new CompanyRelationTypeDto(); + } + + /** + * Maps the entity {@link CompanyRelationType} to the dto {@link CompanyRelationTypeDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final CompanyRelationTypeDto dto, final CompanyRelationType entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setName(toDto_name(entity, context)); + dto.setDescription(toDto_description(entity, context)); + } + + /** + * Maps the dto {@link CompanyRelationTypeDto} to the entity {@link CompanyRelationType}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final CompanyRelationTypeDto dto, final CompanyRelationType entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setName(toEntity_name(dto, entity, context)); + entity.setDescription(toEntity_description(dto, entity, context)); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_name(final CompanyRelationType in, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_name(final CompanyRelationTypeDto in, final CompanyRelationType parentEntity, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_description(final CompanyRelationType in, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_description(final CompanyRelationTypeDto in, final CompanyRelationType parentEntity, final MappingContext context) { + return in.getDescription(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CompanyRelationTypeDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CompanyRelationType.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DepartmentDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DepartmentDtoMapper.java new file mode 100644 index 0000000..34abcb8 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DepartmentDtoMapper.java
@@ -0,0 +1,276 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.dtos.DepartmentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.Address; +import org.osbp.tests.entities.Company; +import org.osbp.tests.entities.Department; + +/** + * This class maps the dto {@link DepartmentDto} to and from the entity {@link Department}. + * + */ +@SuppressWarnings("all") +public class DepartmentDtoMapper<DTO extends DepartmentDto, ENTITY extends Department> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public Department createEntity() { + return new Department(); + } + + /** + * Creates a new instance of the dto + */ + public DepartmentDto createDto() { + return new DepartmentDto(); + } + + /** + * Maps the entity {@link Department} to the dto {@link DepartmentDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final DepartmentDto dto, final Department entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setCompany(toDto_company(entity, context)); + dto.setName(toDto_name(entity, context)); + dto.setDescription(toDto_description(entity, context)); + dto.setDefault_yearly_income(toDto_default_yearly_income(entity, context)); + } + + /** + * Maps the dto {@link DepartmentDto} to the entity {@link Department}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final DepartmentDto dto, final Department entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setCompany(toEntity_company(dto, entity, context)); + entity.setName(toEntity_name(dto, entity, context)); + entity.setDescription(toEntity_description(dto, entity, context)); + toEntity_address(dto, entity, context); + entity.setDefault_yearly_income(toEntity_default_yearly_income(dto, entity, context)); + } + + /** + * Maps the property company from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected CompanyDto toDto_company(final Department in, final MappingContext context) { + if(in.getCompany() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToDtoMapper(CompanyDto.class, in.getCompany().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + CompanyDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCompany())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCompany(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCompany(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property company from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected Company toEntity_company(final DepartmentDto in, final Department parentEntity, final MappingContext context) { + if(in.getCompany() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CompanyDto, Company>) getToEntityMapper(in.getCompany().getClass(), Company.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + Company entity = null; + entity = context.get(mapper.createEntityHash(in.getCompany())); + if(entity != null) { + return entity; + } else { + entity = (Company) context + .findEntityByEntityManager(Company.class, in.getCompany().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCompany()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCompany(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_name(final Department in, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property name from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_name(final DepartmentDto in, final Department parentEntity, final MappingContext context) { + return in.getName(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_description(final Department in, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property description from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_description(final DepartmentDto in, final Department parentEntity, final MappingContext context) { + return in.getDescription(); + } + + /** + * Maps the property address from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<AddressDto> toDto_address(final Department in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property address from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<Address> toEntity_address(final DepartmentDto in, final Department parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address> mapper = getToEntityMapper(AddressDto.class, Address.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<AddressDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<AddressDto>) in.internalGetAddress(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToAddress, + parentEntity::internalRemoveFromAddress); + return null; + } + + /** + * Maps the property default_yearly_income from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toDto_default_yearly_income(final Department in, final MappingContext context) { + return in.getDefault_yearly_income(); + } + + /** + * Maps the property default_yearly_income from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected double toEntity_default_yearly_income(final DepartmentDto in, final Department parentEntity, final MappingContext context) { + return in.getDefault_yearly_income(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DepartmentDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Department.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestBeanDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestBeanDtoMapper.java new file mode 100644 index 0000000..a7c9934 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestBeanDtoMapper.java
@@ -0,0 +1,213 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.IMapper; +import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.DtoTestBeanDto; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; +import org.osbp.tests.entities.DtoTestBean; +import org.osbp.tests.entities.DtoTestChildCrossRef; + +/** + * This class maps the dto {@link DtoTestBeanDto} to and from the entity {@link DtoTestBean}. + * + */ +@SuppressWarnings("all") +public class DtoTestBeanDtoMapper<DTO extends DtoTestBeanDto, ENTITY extends DtoTestBean> implements IMapper<DTO, ENTITY> { + private IMapperAccess mapperAccess; + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToDtoMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToDtoMapper(dtoClass, entityClass); + } + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToEntityMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToEntityMapper(dtoClass, entityClass); + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void bindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = mapperAccess; + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void unbindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = null; + } + + /** + * Creates a new instance of the entity + */ + public DtoTestBean createEntity() { + return new DtoTestBean(); + } + + /** + * Creates a new instance of the dto + */ + public DtoTestBeanDto createDto() { + return new DtoTestBeanDto(); + } + + /** + * Maps the entity {@link DtoTestBean} to the dto {@link DtoTestBeanDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final DtoTestBeanDto dto, final DtoTestBean entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + dto.setFoo(toDto_foo(entity, context)); + dto.setCrossRefChild(toDto_crossRefChild(entity, context)); + } + + /** + * Maps the dto {@link DtoTestBeanDto} to the entity {@link DtoTestBean}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final DtoTestBeanDto dto, final DtoTestBean entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + + entity.setFoo(toEntity_foo(dto, entity, context)); + entity.setCrossRefChild(toEntity_crossRefChild(dto, entity, context)); + } + + /** + * Maps the property foo from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_foo(final DtoTestBean in, final MappingContext context) { + return in.getFoo(); + } + + /** + * Maps the property foo from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_foo(final DtoTestBeanDto in, final DtoTestBean parentEntity, final MappingContext context) { + return in.getFoo(); + } + + /** + * Maps the property crossRefChild from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected DtoTestChildCrossRefDto toDto_crossRefChild(final DtoTestBean in, final MappingContext context) { + if(in.getCrossRefChild() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef>) getToDtoMapper(DtoTestChildCrossRefDto.class, in.getCrossRefChild().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + DtoTestChildCrossRefDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCrossRefChild())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCrossRefChild(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCrossRefChild(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property crossRefChild from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected DtoTestChildCrossRef toEntity_crossRefChild(final DtoTestBeanDto in, final DtoTestBean parentEntity, final MappingContext context) { + if(in.getCrossRefChild() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef>) getToEntityMapper(in.getCrossRefChild().getClass(), DtoTestChildCrossRef.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestChildCrossRef entity = null; + entity = context.get(mapper.createEntityHash(in.getCrossRefChild())); + if(entity != null) { + return entity; + } else { + entity = (DtoTestChildCrossRef) context + .findEntityByEntityManager(DtoTestChildCrossRef.class, in.getCrossRefChild().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCrossRefChild()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCrossRefChild(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + throw new UnsupportedOperationException("No id attribute available"); + } + + public String createEntityHash(final Object in) { + throw new UnsupportedOperationException("No id attribute available"); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildContainmentDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildContainmentDtoMapper.java new file mode 100644 index 0000000..faf5246 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildContainmentDtoMapper.java
@@ -0,0 +1,148 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.DtoTestChildContainmentDto; +import org.osbp.tests.dtos.DtoTestParentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.DtoTestChildContainment; +import org.osbp.tests.entities.DtoTestParent; + +/** + * This class maps the dto {@link DtoTestChildContainmentDto} to and from the entity {@link DtoTestChildContainment}. + * + */ +@SuppressWarnings("all") +public class DtoTestChildContainmentDtoMapper<DTO extends DtoTestChildContainmentDto, ENTITY extends DtoTestChildContainment> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public DtoTestChildContainment createEntity() { + return new DtoTestChildContainment(); + } + + /** + * Creates a new instance of the dto + */ + public DtoTestChildContainmentDto createDto() { + return new DtoTestChildContainmentDto(); + } + + /** + * Maps the entity {@link DtoTestChildContainment} to the dto {@link DtoTestChildContainmentDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final DtoTestChildContainmentDto dto, final DtoTestChildContainment entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setContainer(toDto_container(entity, context)); + } + + /** + * Maps the dto {@link DtoTestChildContainmentDto} to the entity {@link DtoTestChildContainment}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final DtoTestChildContainmentDto dto, final DtoTestChildContainment entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setContainer(toEntity_container(dto, entity, context)); + } + + /** + * Maps the property container from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected DtoTestParentDto toDto_container(final DtoTestChildContainment in, final MappingContext context) { + if(in.getContainer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent>) getToDtoMapper(DtoTestParentDto.class, in.getContainer().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + DtoTestParentDto dto = null; + dto = context.get(mapper.createDtoHash(in.getContainer())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getContainer(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getContainer(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property container from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected DtoTestParent toEntity_container(final DtoTestChildContainmentDto in, final DtoTestChildContainment parentEntity, final MappingContext context) { + if(in.getContainer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent>) getToEntityMapper(in.getContainer().getClass(), DtoTestParent.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestParent entity = null; + entity = context.get(mapper.createEntityHash(in.getContainer())); + if(entity != null) { + return entity; + } else { + entity = (DtoTestParent) context + .findEntityByEntityManager(DtoTestParent.class, in.getContainer().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getContainer()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getContainer(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestChildContainmentDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestChildContainment.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildCrossRefDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildCrossRefDtoMapper.java new file mode 100644 index 0000000..0dd4358 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestChildCrossRefDtoMapper.java
@@ -0,0 +1,148 @@ +package org.osbp.tests.dtos.mapper; + +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; +import org.osbp.tests.dtos.DtoTestParentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.DtoTestChildCrossRef; +import org.osbp.tests.entities.DtoTestParent; + +/** + * This class maps the dto {@link DtoTestChildCrossRefDto} to and from the entity {@link DtoTestChildCrossRef}. + * + */ +@SuppressWarnings("all") +public class DtoTestChildCrossRefDtoMapper<DTO extends DtoTestChildCrossRefDto, ENTITY extends DtoTestChildCrossRef> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public DtoTestChildCrossRef createEntity() { + return new DtoTestChildCrossRef(); + } + + /** + * Creates a new instance of the dto + */ + public DtoTestChildCrossRefDto createDto() { + return new DtoTestChildCrossRefDto(); + } + + /** + * Maps the entity {@link DtoTestChildCrossRef} to the dto {@link DtoTestChildCrossRefDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final DtoTestChildCrossRefDto dto, final DtoTestChildCrossRef entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setContainer(toDto_container(entity, context)); + } + + /** + * Maps the dto {@link DtoTestChildCrossRefDto} to the entity {@link DtoTestChildCrossRef}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final DtoTestChildCrossRefDto dto, final DtoTestChildCrossRef entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setContainer(toEntity_container(dto, entity, context)); + } + + /** + * Maps the property container from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected DtoTestParentDto toDto_container(final DtoTestChildCrossRef in, final MappingContext context) { + if(in.getContainer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent>) getToDtoMapper(DtoTestParentDto.class, in.getContainer().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + DtoTestParentDto dto = null; + dto = context.get(mapper.createDtoHash(in.getContainer())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getContainer(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getContainer(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property container from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected DtoTestParent toEntity_container(final DtoTestChildCrossRefDto in, final DtoTestChildCrossRef parentEntity, final MappingContext context) { + if(in.getContainer() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestParentDto, DtoTestParent>) getToEntityMapper(in.getContainer().getClass(), DtoTestParent.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestParent entity = null; + entity = context.get(mapper.createEntityHash(in.getContainer())); + if(entity != null) { + return entity; + } else { + entity = (DtoTestParent) context + .findEntityByEntityManager(DtoTestParent.class, in.getContainer().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getContainer()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getContainer(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestChildCrossRefDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestChildCrossRef.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestParentDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestParentDtoMapper.java new file mode 100644 index 0000000..ea92a50 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/DtoTestParentDtoMapper.java
@@ -0,0 +1,322 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.DtoTestBeanDto; +import org.osbp.tests.dtos.DtoTestChildContainmentDto; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; +import org.osbp.tests.dtos.DtoTestParentDto; +import org.osbp.tests.dtos.mapper.BaseUUIDDtoMapper; +import org.osbp.tests.entities.DtoTestBean; +import org.osbp.tests.entities.DtoTestChildContainment; +import org.osbp.tests.entities.DtoTestChildCrossRef; +import org.osbp.tests.entities.DtoTestParent; + +/** + * This class maps the dto {@link DtoTestParentDto} to and from the entity {@link DtoTestParent}. + * + */ +@SuppressWarnings("all") +public class DtoTestParentDtoMapper<DTO extends DtoTestParentDto, ENTITY extends DtoTestParent> extends BaseUUIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public DtoTestParent createEntity() { + return new DtoTestParent(); + } + + /** + * Creates a new instance of the dto + */ + public DtoTestParentDto createDto() { + return new DtoTestParentDto(); + } + + /** + * Maps the entity {@link DtoTestParent} to the dto {@link DtoTestParentDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final DtoTestParentDto dto, final DtoTestParent entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setString(toDto_string(entity, context)); + dto.setCrossRefChild(toDto_crossRefChild(entity, context)); + dto.setBeanx(toDto_beanx(entity, context)); + } + + /** + * Maps the dto {@link DtoTestParentDto} to the entity {@link DtoTestParent}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final DtoTestParentDto dto, final DtoTestParent entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setString(toEntity_string(dto, entity, context)); + toEntity_containmentChilds(dto, entity, context); + toEntity_crossRefChilds(dto, entity, context); + entity.setCrossRefChild(toEntity_crossRefChild(dto, entity, context)); + entity.setBeanx(toEntity_beanx(dto, entity, context)); + } + + /** + * Maps the property string from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_string(final DtoTestParent in, final MappingContext context) { + return in.getString(); + } + + /** + * Maps the property string from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_string(final DtoTestParentDto in, final DtoTestParent parentEntity, final MappingContext context) { + return in.getString(); + } + + /** + * Maps the property containmentChilds from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<DtoTestChildContainmentDto> toDto_containmentChilds(final DtoTestParent in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property containmentChilds from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<DtoTestChildContainment> toEntity_containmentChilds(final DtoTestParentDto in, final DtoTestParent parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildContainmentDto, DtoTestChildContainment> mapper = getToEntityMapper(DtoTestChildContainmentDto.class, DtoTestChildContainment.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DtoTestChildContainmentDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DtoTestChildContainmentDto>) in.internalGetContainmentChilds(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToContainmentChilds, + parentEntity::internalRemoveFromContainmentChilds); + return null; + } + + /** + * Maps the property crossRefChilds from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<DtoTestChildCrossRefDto> toDto_crossRefChilds(final DtoTestParent in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property crossRefChilds from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<DtoTestChildCrossRef> toEntity_crossRefChilds(final DtoTestParentDto in, final DtoTestParent parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef> mapper = getToEntityMapper(DtoTestChildCrossRefDto.class, DtoTestChildCrossRef.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DtoTestChildCrossRefDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<DtoTestChildCrossRefDto>) in.internalGetCrossRefChilds(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToCrossRefChilds, + parentEntity::internalRemoveFromCrossRefChilds); + return null; + } + + /** + * Maps the property crossRefChild from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped dto + * + */ + protected DtoTestChildCrossRefDto toDto_crossRefChild(final DtoTestParent in, final MappingContext context) { + if(in.getCrossRefChild() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef>) getToDtoMapper(DtoTestChildCrossRefDto.class, in.getCrossRefChild().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + DtoTestChildCrossRefDto dto = null; + dto = context.get(mapper.createDtoHash(in.getCrossRefChild())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getCrossRefChild(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getCrossRefChild(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property crossRefChild from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return the mapped entity + * + */ + protected DtoTestChildCrossRef toEntity_crossRefChild(final DtoTestParentDto in, final DtoTestParent parentEntity, final MappingContext context) { + if(in.getCrossRefChild() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestChildCrossRefDto, DtoTestChildCrossRef>) getToEntityMapper(in.getCrossRefChild().getClass(), DtoTestChildCrossRef.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestChildCrossRef entity = null; + entity = context.get(mapper.createEntityHash(in.getCrossRefChild())); + if(entity != null) { + return entity; + } else { + entity = (DtoTestChildCrossRef) context + .findEntityByEntityManager(DtoTestChildCrossRef.class, in.getCrossRefChild().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getCrossRefChild()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getCrossRefChild(), entity, context); + return entity; + } else { + return null; + } + } + + /** + * Maps the property beanx from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected DtoTestBeanDto toDto_beanx(final DtoTestParent in, final MappingContext context) { + if(in.getBeanx() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestBeanDto, DtoTestBean> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestBeanDto, DtoTestBean>) getToDtoMapper(DtoTestBeanDto.class, in.getBeanx().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestBeanDto dto = null; + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getBeanx(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } + } + + /** + * Maps the property beanx from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected DtoTestBean toEntity_beanx(final DtoTestParentDto in, final DtoTestParent parentEntity, final MappingContext context) { + if(in.getBeanx() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestBeanDto, DtoTestBean> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<DtoTestBeanDto, DtoTestBean>) getToEntityMapper(in.getBeanx().getClass(), DtoTestBean.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + DtoTestBean entity = mapper.createEntity(); + mapper.mapToEntity(in.getBeanx(), entity, context); + return entity; + } else { + return null; + } + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestParentDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(DtoTestParent.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/McustomerDtoMapper.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/McustomerDtoMapper.java new file mode 100644 index 0000000..7f8b12a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/mapper/McustomerDtoMapper.java
@@ -0,0 +1,902 @@ +package org.osbp.tests.dtos.mapper; + +import java.util.Date; +import java.util.List; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.McustomerDto; +import org.osbp.tests.dtos.mapper.BaseIDDtoMapper; +import org.osbp.tests.entities.CashSlip; +import org.osbp.tests.entities.Mcustomer; + +/** + * This class maps the dto {@link McustomerDto} to and from the entity {@link Mcustomer}. + * + */ +@SuppressWarnings("all") +public class McustomerDtoMapper<DTO extends McustomerDto, ENTITY extends Mcustomer> extends BaseIDDtoMapper<DTO, ENTITY> { + /** + * Creates a new instance of the entity + */ + public Mcustomer createEntity() { + return new Mcustomer(); + } + + /** + * Creates a new instance of the dto + */ + public McustomerDto createDto() { + return new McustomerDto(); + } + + /** + * Maps the entity {@link Mcustomer} to the dto {@link McustomerDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final McustomerDto dto, final Mcustomer entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + super.mapToDTO(dto, entity, context); + + dto.setAccount_num(toDto_account_num(entity, context)); + dto.setLname(toDto_lname(entity, context)); + dto.setFname(toDto_fname(entity, context)); + dto.setMi(toDto_mi(entity, context)); + dto.setAddress1(toDto_address1(entity, context)); + dto.setAddress2(toDto_address2(entity, context)); + dto.setAddress3(toDto_address3(entity, context)); + dto.setAddress4(toDto_address4(entity, context)); + dto.setCity(toDto_city(entity, context)); + dto.setState_province(toDto_state_province(entity, context)); + dto.setPostal_code(toDto_postal_code(entity, context)); + dto.setCountry(toDto_country(entity, context)); + dto.setPhone1(toDto_phone1(entity, context)); + dto.setPhone2(toDto_phone2(entity, context)); + dto.setBirthdate(toDto_birthdate(entity, context)); + dto.setMarital_status(toDto_marital_status(entity, context)); + dto.setYearly_income(toDto_yearly_income(entity, context)); + dto.setGender(toDto_gender(entity, context)); + dto.setTotal_children(toDto_total_children(entity, context)); + dto.setNum_children_at_home(toDto_num_children_at_home(entity, context)); + dto.setEducation(toDto_education(entity, context)); + dto.setDate_accnt_opened(toDto_date_accnt_opened(entity, context)); + dto.setMember_card(toDto_member_card(entity, context)); + dto.setOccupation(toDto_occupation(entity, context)); + dto.setHouseowner(toDto_houseowner(entity, context)); + dto.setNum_cars_owned(toDto_num_cars_owned(entity, context)); + dto.setFullname(toDto_fullname(entity, context)); + dto.setTest(toDto_test(entity, context)); + dto.setFoo(toDto_foo(entity, context)); + } + + /** + * Maps the dto {@link McustomerDto} to the entity {@link Mcustomer}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final McustomerDto dto, final Mcustomer entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + super.mapToEntity(dto, entity, context); + + entity.setAccount_num(toEntity_account_num(dto, entity, context)); + entity.setLname(toEntity_lname(dto, entity, context)); + entity.setFname(toEntity_fname(dto, entity, context)); + entity.setMi(toEntity_mi(dto, entity, context)); + entity.setAddress1(toEntity_address1(dto, entity, context)); + entity.setAddress2(toEntity_address2(dto, entity, context)); + entity.setAddress3(toEntity_address3(dto, entity, context)); + entity.setAddress4(toEntity_address4(dto, entity, context)); + entity.setCity(toEntity_city(dto, entity, context)); + entity.setState_province(toEntity_state_province(dto, entity, context)); + entity.setPostal_code(toEntity_postal_code(dto, entity, context)); + entity.setCountry(toEntity_country(dto, entity, context)); + entity.setPhone1(toEntity_phone1(dto, entity, context)); + entity.setPhone2(toEntity_phone2(dto, entity, context)); + entity.setBirthdate(toEntity_birthdate(dto, entity, context)); + entity.setMarital_status(toEntity_marital_status(dto, entity, context)); + entity.setYearly_income(toEntity_yearly_income(dto, entity, context)); + entity.setGender(toEntity_gender(dto, entity, context)); + entity.setTotal_children(toEntity_total_children(dto, entity, context)); + entity.setNum_children_at_home(toEntity_num_children_at_home(dto, entity, context)); + entity.setEducation(toEntity_education(dto, entity, context)); + entity.setDate_accnt_opened(toEntity_date_accnt_opened(dto, entity, context)); + entity.setMember_card(toEntity_member_card(dto, entity, context)); + entity.setOccupation(toEntity_occupation(dto, entity, context)); + entity.setHouseowner(toEntity_houseowner(dto, entity, context)); + entity.setNum_cars_owned(toEntity_num_cars_owned(dto, entity, context)); + entity.setFullname(toEntity_fullname(dto, entity, context)); + entity.setTest(toEntity_test(dto, entity, context)); + toEntity_slips(dto, entity, context); + } + + /** + * Maps the property account_num from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected long toDto_account_num(final Mcustomer in, final MappingContext context) { + return in.getAccount_num(); + } + + /** + * Maps the property account_num from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected long toEntity_account_num(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getAccount_num(); + } + + /** + * Maps the property lname from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_lname(final Mcustomer in, final MappingContext context) { + return in.getLname(); + } + + /** + * Maps the property lname from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_lname(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getLname(); + } + + /** + * Maps the property fname from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_fname(final Mcustomer in, final MappingContext context) { + return in.getFname(); + } + + /** + * Maps the property fname from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_fname(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getFname(); + } + + /** + * Maps the property mi from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_mi(final Mcustomer in, final MappingContext context) { + return in.getMi(); + } + + /** + * Maps the property mi from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_mi(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getMi(); + } + + /** + * Maps the property address1 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address1(final Mcustomer in, final MappingContext context) { + return in.getAddress1(); + } + + /** + * Maps the property address1 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address1(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getAddress1(); + } + + /** + * Maps the property address2 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address2(final Mcustomer in, final MappingContext context) { + return in.getAddress2(); + } + + /** + * Maps the property address2 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address2(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getAddress2(); + } + + /** + * Maps the property address3 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address3(final Mcustomer in, final MappingContext context) { + return in.getAddress3(); + } + + /** + * Maps the property address3 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address3(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getAddress3(); + } + + /** + * Maps the property address4 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_address4(final Mcustomer in, final MappingContext context) { + return in.getAddress4(); + } + + /** + * Maps the property address4 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_address4(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getAddress4(); + } + + /** + * Maps the property city from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_city(final Mcustomer in, final MappingContext context) { + return in.getCity(); + } + + /** + * Maps the property city from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_city(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getCity(); + } + + /** + * Maps the property state_province from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_state_province(final Mcustomer in, final MappingContext context) { + return in.getState_province(); + } + + /** + * Maps the property state_province from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_state_province(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getState_province(); + } + + /** + * Maps the property postal_code from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_postal_code(final Mcustomer in, final MappingContext context) { + return in.getPostal_code(); + } + + /** + * Maps the property postal_code from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_postal_code(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getPostal_code(); + } + + /** + * Maps the property country from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_country(final Mcustomer in, final MappingContext context) { + return in.getCountry(); + } + + /** + * Maps the property country from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_country(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getCountry(); + } + + /** + * Maps the property phone1 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_phone1(final Mcustomer in, final MappingContext context) { + return in.getPhone1(); + } + + /** + * Maps the property phone1 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_phone1(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getPhone1(); + } + + /** + * Maps the property phone2 from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_phone2(final Mcustomer in, final MappingContext context) { + return in.getPhone2(); + } + + /** + * Maps the property phone2 from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_phone2(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getPhone2(); + } + + /** + * Maps the property birthdate from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toDto_birthdate(final Mcustomer in, final MappingContext context) { + return in.getBirthdate(); + } + + /** + * Maps the property birthdate from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected Date toEntity_birthdate(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getBirthdate(); + } + + /** + * Maps the property marital_status from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_marital_status(final Mcustomer in, final MappingContext context) { + return in.getMarital_status(); + } + + /** + * Maps the property marital_status from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_marital_status(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getMarital_status(); + } + + /** + * Maps the property yearly_income from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_yearly_income(final Mcustomer in, final MappingContext context) { + return in.getYearly_income(); + } + + /** + * Maps the property yearly_income from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_yearly_income(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getYearly_income(); + } + + /** + * Maps the property gender from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_gender(final Mcustomer in, final MappingContext context) { + return in.getGender(); + } + + /** + * Maps the property gender from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_gender(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getGender(); + } + + /** + * Maps the property total_children from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toDto_total_children(final Mcustomer in, final MappingContext context) { + return in.getTotal_children(); + } + + /** + * Maps the property total_children from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toEntity_total_children(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getTotal_children(); + } + + /** + * Maps the property num_children_at_home from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toDto_num_children_at_home(final Mcustomer in, final MappingContext context) { + return in.getNum_children_at_home(); + } + + /** + * Maps the property num_children_at_home from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toEntity_num_children_at_home(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getNum_children_at_home(); + } + + /** + * Maps the property education from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_education(final Mcustomer in, final MappingContext context) { + return in.getEducation(); + } + + /** + * Maps the property education from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_education(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getEducation(); + } + + /** + * Maps the property date_accnt_opened from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_date_accnt_opened(final Mcustomer in, final MappingContext context) { + return in.getDate_accnt_opened(); + } + + /** + * Maps the property date_accnt_opened from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_date_accnt_opened(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getDate_accnt_opened(); + } + + /** + * Maps the property member_card from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_member_card(final Mcustomer in, final MappingContext context) { + return in.getMember_card(); + } + + /** + * Maps the property member_card from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_member_card(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getMember_card(); + } + + /** + * Maps the property occupation from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_occupation(final Mcustomer in, final MappingContext context) { + return in.getOccupation(); + } + + /** + * Maps the property occupation from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_occupation(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getOccupation(); + } + + /** + * Maps the property houseowner from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_houseowner(final Mcustomer in, final MappingContext context) { + return in.getHouseowner(); + } + + /** + * Maps the property houseowner from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_houseowner(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getHouseowner(); + } + + /** + * Maps the property num_cars_owned from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toDto_num_cars_owned(final Mcustomer in, final MappingContext context) { + return in.getNum_cars_owned(); + } + + /** + * Maps the property num_cars_owned from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected int toEntity_num_cars_owned(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getNum_cars_owned(); + } + + /** + * Maps the property fullname from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_fullname(final Mcustomer in, final MappingContext context) { + return in.getFullname(); + } + + /** + * Maps the property fullname from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_fullname(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getFullname(); + } + + /** + * Maps the property test from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_test(final Mcustomer in, final MappingContext context) { + return in.getTest(); + } + + /** + * Maps the property test from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_test(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getTest(); + } + + /** + * Maps the property slips from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<CashSlipDto> toDto_slips(final Mcustomer in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property slips from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<CashSlip> toEntity_slips(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<CashSlipDto, CashSlip> mapper = getToEntityMapper(CashSlipDto.class, CashSlip.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashSlipDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<CashSlipDto>) in.internalGetSlips(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + childsList.mapToEntity(mapper, + parentEntity::addToSlips, + parentEntity::internalRemoveFromSlips); + return null; + } + + /** + * Maps the property foo from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_foo(final Mcustomer in, final MappingContext context) { + return in.getFoo(); + } + + /** + * Maps the property foo from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_foo(final McustomerDto in, final Mcustomer parentEntity, final MappingContext context) { + return in.getFoo(); + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(McustomerDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Mcustomer.class, in); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/AddressDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/AddressDtoService.java new file mode 100644 index 0000000..ef881fd --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/AddressDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.AddressDto; +import org.osbp.tests.entities.Address; + +@SuppressWarnings("all") +public class AddressDtoService extends AbstractDTOService<AddressDto, Address> { + public Class<AddressDto> getDtoClass() { + return AddressDto.class; + } + + public Class<Address> getEntityClass() { + return Address.class; + } + + public Object getId(final AddressDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseIDDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseIDDtoService.java new file mode 100644 index 0000000..f4604a8 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseIDDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.BaseIDDto; +import org.osbp.tests.entities.BaseID; + +@SuppressWarnings("all") +public class BaseIDDtoService extends AbstractDTOService<BaseIDDto, BaseID> { + public Class<BaseIDDto> getDtoClass() { + return BaseIDDto.class; + } + + public Class<BaseID> getEntityClass() { + return BaseID.class; + } + + public Object getId(final BaseIDDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseUUIDDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseUUIDDtoService.java new file mode 100644 index 0000000..44b886e --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/BaseUUIDDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.BaseUUIDDto; +import org.osbp.tests.entities.BaseUUID; + +@SuppressWarnings("all") +public class BaseUUIDDtoService extends AbstractDTOService<BaseUUIDDto, BaseUUID> { + public Class<BaseUUIDDto> getDtoClass() { + return BaseUUIDDto.class; + } + + public Class<BaseUUID> getEntityClass() { + return BaseUUID.class; + } + + public Object getId(final BaseUUIDDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentDtoService.java new file mode 100644 index 0000000..63fd282 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CashPaymentDto; +import org.osbp.tests.entities.CashPayment; + +@SuppressWarnings("all") +public class CashPaymentDtoService extends AbstractDTOService<CashPaymentDto, CashPayment> { + public Class<CashPaymentDto> getDtoClass() { + return CashPaymentDto.class; + } + + public Class<CashPayment> getEntityClass() { + return CashPayment.class; + } + + public Object getId(final CashPaymentDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentMethodDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentMethodDtoService.java new file mode 100644 index 0000000..a37ddd7 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPaymentMethodDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CashPaymentMethodDto; +import org.osbp.tests.entities.CashPaymentMethod; + +@SuppressWarnings("all") +public class CashPaymentMethodDtoService extends AbstractDTOService<CashPaymentMethodDto, CashPaymentMethod> { + public Class<CashPaymentMethodDto> getDtoClass() { + return CashPaymentMethodDto.class; + } + + public Class<CashPaymentMethod> getEntityClass() { + return CashPaymentMethod.class; + } + + public Object getId(final CashPaymentMethodDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPositionDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPositionDtoService.java new file mode 100644 index 0000000..a584227 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashPositionDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CashPositionDto; +import org.osbp.tests.entities.CashPosition; + +@SuppressWarnings("all") +public class CashPositionDtoService extends AbstractDTOService<CashPositionDto, CashPosition> { + public Class<CashPositionDto> getDtoClass() { + return CashPositionDto.class; + } + + public Class<CashPosition> getEntityClass() { + return CashPosition.class; + } + + public Object getId(final CashPositionDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashRegisterDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashRegisterDtoService.java new file mode 100644 index 0000000..abe076a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashRegisterDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CashRegisterDto; +import org.osbp.tests.entities.CashRegister; + +@SuppressWarnings("all") +public class CashRegisterDtoService extends AbstractDTOService<CashRegisterDto, CashRegister> { + public Class<CashRegisterDto> getDtoClass() { + return CashRegisterDto.class; + } + + public Class<CashRegister> getEntityClass() { + return CashRegister.class; + } + + public Object getId(final CashRegisterDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashSlipDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashSlipDtoService.java new file mode 100644 index 0000000..342019a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CashSlipDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.entities.CashSlip; + +@SuppressWarnings("all") +public class CashSlipDtoService extends AbstractDTOService<CashSlipDto, CashSlip> { + public Class<CashSlipDto> getDtoClass() { + return CashSlipDto.class; + } + + public Class<CashSlip> getEntityClass() { + return CashSlip.class; + } + + public Object getId(final CashSlipDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyDtoService.java new file mode 100644 index 0000000..c117891 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CompanyDto; +import org.osbp.tests.entities.Company; + +@SuppressWarnings("all") +public class CompanyDtoService extends AbstractDTOService<CompanyDto, Company> { + public Class<CompanyDto> getDtoClass() { + return CompanyDto.class; + } + + public Class<Company> getEntityClass() { + return Company.class; + } + + public Object getId(final CompanyDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyGroupDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyGroupDtoService.java new file mode 100644 index 0000000..a290320 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyGroupDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CompanyGroupDto; +import org.osbp.tests.entities.CompanyGroup; + +@SuppressWarnings("all") +public class CompanyGroupDtoService extends AbstractDTOService<CompanyGroupDto, CompanyGroup> { + public Class<CompanyGroupDto> getDtoClass() { + return CompanyGroupDto.class; + } + + public Class<CompanyGroup> getEntityClass() { + return CompanyGroup.class; + } + + public Object getId(final CompanyGroupDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyRelationTypeDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyRelationTypeDtoService.java new file mode 100644 index 0000000..546e361 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/CompanyRelationTypeDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.CompanyRelationTypeDto; +import org.osbp.tests.entities.CompanyRelationType; + +@SuppressWarnings("all") +public class CompanyRelationTypeDtoService extends AbstractDTOService<CompanyRelationTypeDto, CompanyRelationType> { + public Class<CompanyRelationTypeDto> getDtoClass() { + return CompanyRelationTypeDto.class; + } + + public Class<CompanyRelationType> getEntityClass() { + return CompanyRelationType.class; + } + + public Object getId(final CompanyRelationTypeDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DepartmentDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DepartmentDtoService.java new file mode 100644 index 0000000..7d872ab --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DepartmentDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.DepartmentDto; +import org.osbp.tests.entities.Department; + +@SuppressWarnings("all") +public class DepartmentDtoService extends AbstractDTOService<DepartmentDto, Department> { + public Class<DepartmentDto> getDtoClass() { + return DepartmentDto.class; + } + + public Class<Department> getEntityClass() { + return Department.class; + } + + public Object getId(final DepartmentDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildContainmentDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildContainmentDtoService.java new file mode 100644 index 0000000..f9bef74 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildContainmentDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.DtoTestChildContainmentDto; +import org.osbp.tests.entities.DtoTestChildContainment; + +@SuppressWarnings("all") +public class DtoTestChildContainmentDtoService extends AbstractDTOService<DtoTestChildContainmentDto, DtoTestChildContainment> { + public Class<DtoTestChildContainmentDto> getDtoClass() { + return DtoTestChildContainmentDto.class; + } + + public Class<DtoTestChildContainment> getEntityClass() { + return DtoTestChildContainment.class; + } + + public Object getId(final DtoTestChildContainmentDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildCrossRefDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildCrossRefDtoService.java new file mode 100644 index 0000000..f711016 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestChildCrossRefDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.DtoTestChildCrossRefDto; +import org.osbp.tests.entities.DtoTestChildCrossRef; + +@SuppressWarnings("all") +public class DtoTestChildCrossRefDtoService extends AbstractDTOService<DtoTestChildCrossRefDto, DtoTestChildCrossRef> { + public Class<DtoTestChildCrossRefDto> getDtoClass() { + return DtoTestChildCrossRefDto.class; + } + + public Class<DtoTestChildCrossRef> getEntityClass() { + return DtoTestChildCrossRef.class; + } + + public Object getId(final DtoTestChildCrossRefDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestParentDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestParentDtoService.java new file mode 100644 index 0000000..52cf5ff --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/DtoTestParentDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.DtoTestParentDto; +import org.osbp.tests.entities.DtoTestParent; + +@SuppressWarnings("all") +public class DtoTestParentDtoService extends AbstractDTOService<DtoTestParentDto, DtoTestParent> { + public Class<DtoTestParentDto> getDtoClass() { + return DtoTestParentDto.class; + } + + public Class<DtoTestParent> getEntityClass() { + return DtoTestParent.class; + } + + public Object getId(final DtoTestParentDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/McustomerDtoService.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/McustomerDtoService.java new file mode 100644 index 0000000..60426ac --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/dtos/service/McustomerDtoService.java
@@ -0,0 +1,20 @@ +package org.osbp.tests.dtos.service; + +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; +import org.osbp.tests.dtos.McustomerDto; +import org.osbp.tests.entities.Mcustomer; + +@SuppressWarnings("all") +public class McustomerDtoService extends AbstractDTOService<McustomerDto, Mcustomer> { + public Class<McustomerDto> getDtoClass() { + return McustomerDto.class; + } + + public Class<Mcustomer> getEntityClass() { + return Mcustomer.class; + } + + public Object getId(final McustomerDto dto) { + return dto.getId(); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Address.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Address.java new file mode 100644 index 0000000..d9dd69b --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Address.java
@@ -0,0 +1,363 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.Company; +import org.osbp.tests.entities.Department; + +/** + * an address + */ +@Entity +@Table(name = "ADDRESS") +@SuppressWarnings("all") +public class Address extends BaseUUID implements IEntity { + /** + * if address for a company, the company is given + */ + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "COMPANY_ID") + private Company company; + + /** + * if address for a department, the address is given + */ + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "DEPARTMENT_ID") + private Department department; + + /** + * address field 1 + */ + @Column(name = "ADDRESS1") + private String address1; + + /** + * address field 2 + */ + @Column(name = "ADDRESS2") + private String address2; + + /** + * city + */ + @Column(name = "CITY") + private String city; + + /** + * state province + */ + @Column(name = "STATE_PROVINCE") + private String state_province; + + /** + * postal code + */ + @Column(name = "POSTAL_CODE") + private String postal_code; + + /** + * country + */ + @Column(name = "COUNTRY") + private String country; + + /** + * email + */ + @Column(name = "EMAIL") + private String email; + + /** + * landline (Festnetznummer) + */ + @Column(name = "LANDLINE") + private String landline; + + /** + * mobile + */ + @Column(name = "MOBILE") + private String mobile; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.company != null) { + this.company.dispose(); + this.company = null; + } + if (this.department != null) { + this.department.dispose(); + this.department = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the company property or <code>null</code> if not present. + */ + public Company getCompany() { + checkDisposed(); + return this.company; + } + + /** + * Sets the company property to this instance. + * Since the reference is a container reference, the opposite reference (Company.address) + * of the company will be handled automatically and no further coding is required to keep them in sync. + * See {@link Company#setAddress(Company)}. + */ + public void setCompany(final Company company) { + checkDisposed(); + if (this.company != null) { + this.company.internalRemoveFromAddress(this); + } + internalSetCompany(company); + if (this.company != null) { + this.company.internalAddToAddress(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetCompany(final Company company) { + this.company = company; + } + + /** + * @return Returns the department property or <code>null</code> if not present. + */ + public Department getDepartment() { + checkDisposed(); + return this.department; + } + + /** + * Sets the department property to this instance. + * Since the reference is a container reference, the opposite reference (Department.address) + * of the department will be handled automatically and no further coding is required to keep them in sync. + * See {@link Department#setAddress(Department)}. + */ + public void setDepartment(final Department department) { + checkDisposed(); + if (this.department != null) { + this.department.internalRemoveFromAddress(this); + } + internalSetDepartment(department); + if (this.department != null) { + this.department.internalAddToAddress(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetDepartment(final Department department) { + this.department = department; + } + + /** + * @return Returns the address1 property or <code>null</code> if not present. + */ + public String getAddress1() { + checkDisposed(); + return this.address1; + } + + /** + * Sets the address1 property to this instance. + */ + public void setAddress1(final String address1) { + checkDisposed(); + this.address1 = address1; + } + + /** + * @return Returns the address2 property or <code>null</code> if not present. + */ + public String getAddress2() { + checkDisposed(); + return this.address2; + } + + /** + * Sets the address2 property to this instance. + */ + public void setAddress2(final String address2) { + checkDisposed(); + this.address2 = address2; + } + + /** + * @return Returns the city property or <code>null</code> if not present. + */ + public String getCity() { + checkDisposed(); + return this.city; + } + + /** + * Sets the city property to this instance. + */ + public void setCity(final String city) { + checkDisposed(); + this.city = city; + } + + /** + * @return Returns the state_province property or <code>null</code> if not present. + */ + public String getState_province() { + checkDisposed(); + return this.state_province; + } + + /** + * Sets the state_province property to this instance. + */ + public void setState_province(final String state_province) { + checkDisposed(); + this.state_province = state_province; + } + + /** + * @return Returns the postal_code property or <code>null</code> if not present. + */ + public String getPostal_code() { + checkDisposed(); + return this.postal_code; + } + + /** + * Sets the postal_code property to this instance. + */ + public void setPostal_code(final String postal_code) { + checkDisposed(); + this.postal_code = postal_code; + } + + /** + * @return Returns the country property or <code>null</code> if not present. + */ + public String getCountry() { + checkDisposed(); + return this.country; + } + + /** + * Sets the country property to this instance. + */ + public void setCountry(final String country) { + checkDisposed(); + this.country = country; + } + + /** + * @return Returns the email property or <code>null</code> if not present. + */ + public String getEmail() { + checkDisposed(); + return this.email; + } + + /** + * Sets the email property to this instance. + */ + public void setEmail(final String email) { + checkDisposed(); + this.email = email; + } + + /** + * @return Returns the landline property or <code>null</code> if not present. + */ + public String getLandline() { + checkDisposed(); + return this.landline; + } + + /** + * Sets the landline property to this instance. + */ + public void setLandline(final String landline) { + checkDisposed(); + this.landline = landline; + } + + /** + * @return Returns the mobile property or <code>null</code> if not present. + */ + public String getMobile() { + checkDisposed(); + return this.mobile; + } + + /** + * Sets the mobile property to this instance. + */ + public void setMobile(final String mobile) { + checkDisposed(); + this.mobile = mobile; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseID.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseID.java new file mode 100644 index 0000000..f989dc8 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseID.java
@@ -0,0 +1,117 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import javax.persistence.PreRemove; +import javax.persistence.Transient; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; + +@MappedSuperclass +@SuppressWarnings("all") +public class BaseID implements IEntity { + @Transient + @Dispose + private boolean disposed; + + @Id + @GeneratedValue + private int id; + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + @Dispose + public boolean isDisposed() { + return this.disposed; + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * @return Returns the id property or <code>null</code> if not present. + */ + public int getId() { + checkDisposed(); + return this.id; + } + + /** + * Sets the id property to this instance. + */ + public void setId(final int id) { + checkDisposed(); + this.id = id; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BaseID other = (BaseID) obj; + if (other.id != this.id) + return false; + return true; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + this.id; + return result; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseUUID.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseUUID.java new file mode 100644 index 0000000..ecd0d3a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/BaseUUID.java
@@ -0,0 +1,118 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import javax.persistence.PreRemove; +import javax.persistence.Transient; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; + +@MappedSuperclass +@SuppressWarnings("all") +public class BaseUUID implements IEntity { + @Transient + @Dispose + private boolean disposed; + + @Id + private String id = java.util.UUID.randomUUID().toString(); + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + @Dispose + public boolean isDisposed() { + return this.disposed; + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * @return Returns the id property or <code>null</code> if not present. + */ + public String getId() { + checkDisposed(); + return this.id; + } + + /** + * Sets the id property to this instance. + */ + public void setId(final String id) { + checkDisposed(); + this.id = id; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BaseUUID other = (BaseUUID) obj; + if (this.id == null) { + if (other.id != null) + return false; + } else if (!this.id.equals(other.id)) + return false; + return true; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((this.id== null) ? 0 : this.id.hashCode()); + return result; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPayment.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPayment.java new file mode 100644 index 0000000..337e855 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPayment.java
@@ -0,0 +1,199 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.Date; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CashPaymentMethod; +import org.osbp.tests.entities.CashSlip; + +@Entity +@Table(name = "CASH_PAYMENT") +@SuppressWarnings("all") +public class CashPayment extends BaseUUID implements IEntity { + @Column(name = "NOW") + @Temporal(value = TemporalType.TIMESTAMP) + @Valid + private Date now; + + @Column(name = "PAYED") + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double payed; + + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "SLIP_ID") + private CashSlip slip; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "METHOD_OF_PAYMENT_ID") + private CashPaymentMethod methodOfPayment; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.slip != null) { + this.slip.dispose(); + this.slip = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + checkDisposed(); + return this.now; + } + + /** + * Sets the now property to this instance. + */ + public void setNow(final Date now) { + checkDisposed(); + this.now = now; + } + + /** + * @return Returns the payed property or <code>null</code> if not present. + */ + public Double getPayed() { + checkDisposed(); + return this.payed; + } + + /** + * Sets the payed property to this instance. + */ + public void setPayed(final Double payed) { + checkDisposed(); + this.payed = payed; + } + + /** + * @return Returns the slip property or <code>null</code> if not present. + */ + public CashSlip getSlip() { + checkDisposed(); + return this.slip; + } + + /** + * Sets the slip property to this instance. + * Since the reference is a container reference, the opposite reference (CashSlip.payments) + * of the slip will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashSlip#setPayments(CashSlip)}. + */ + public void setSlip(final CashSlip slip) { + checkDisposed(); + if (this.slip != null) { + this.slip.internalRemoveFromPayments(this); + } + internalSetSlip(slip); + if (this.slip != null) { + this.slip.internalAddToPayments(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetSlip(final CashSlip slip) { + this.slip = slip; + } + + /** + * @return Returns the methodOfPayment property or <code>null</code> if not present. + */ + public CashPaymentMethod getMethodOfPayment() { + checkDisposed(); + return this.methodOfPayment; + } + + /** + * Sets the methodOfPayment property to this instance. + * Since the reference is a container reference, the opposite reference (CashPaymentMethod.payments) + * of the methodOfPayment will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPaymentMethod#setPayments(CashPaymentMethod)}. + */ + public void setMethodOfPayment(final CashPaymentMethod methodOfPayment) { + checkDisposed(); + if (this.methodOfPayment != null) { + this.methodOfPayment.internalRemoveFromPayments(this); + } + internalSetMethodOfPayment(methodOfPayment); + if (this.methodOfPayment != null) { + this.methodOfPayment.internalAddToPayments(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetMethodOfPayment(final CashPaymentMethod methodOfPayment) { + this.methodOfPayment = methodOfPayment; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPaymentMethod.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPaymentMethod.java new file mode 100644 index 0000000..40cc30c --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPaymentMethod.java
@@ -0,0 +1,252 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainDescription; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CashPayment; + +@Entity +@Table(name = "CASH_PAYMENT_METHOD", indexes = @Index(name = "paymentNumIndex", unique = true, columnList = "num")) +@SuppressWarnings("all") +public class CashPaymentMethod extends BaseUUID implements IEntity { + @DomainKey + @Column(name = "NUM") + private String num; + + @DomainDescription + @Column(name = "NAME") + private String name; + + @Column(name = "CREDIT") + private Boolean credit; + + @Column(name = "IMAGE_NAME") + private String imageName; + + @Column(name = "LOWER_LIMIT") + private double lowerLimit; + + @JoinColumn(name = "PAYMENTS_ID") + @OneToMany(mappedBy = "methodOfPayment") + @Noncacheable + private List<CashPayment> payments; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the num property or <code>null</code> if not present. + */ + public String getNum() { + checkDisposed(); + return this.num; + } + + /** + * Sets the num property to this instance. + */ + public void setNum(final String num) { + checkDisposed(); + this.num = num; + } + + /** + * @return Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the name property to this instance. + */ + public void setName(final String name) { + checkDisposed(); + this.name = name; + } + + /** + * @return Returns the credit property or <code>null</code> if not present. + */ + public Boolean getCredit() { + checkDisposed(); + return this.credit; + } + + /** + * Sets the credit property to this instance. + */ + public void setCredit(final Boolean credit) { + checkDisposed(); + this.credit = credit; + } + + /** + * @return Returns the imageName property or <code>null</code> if not present. + */ + public String getImageName() { + checkDisposed(); + return this.imageName; + } + + /** + * Sets the imageName property to this instance. + */ + public void setImageName(final String imageName) { + checkDisposed(); + this.imageName = imageName; + } + + /** + * @return Returns the lowerLimit property or <code>null</code> if not present. + */ + public double getLowerLimit() { + checkDisposed(); + return this.lowerLimit; + } + + /** + * Sets the lowerLimit property to this instance. + */ + public void setLowerLimit(final double lowerLimit) { + checkDisposed(); + this.lowerLimit = lowerLimit; + } + + /** + * @return Returns an unmodifiable list of payments. + */ + public List<CashPayment> getPayments() { + checkDisposed(); + return Collections.unmodifiableList(internalGetPayments()); + } + + /** + * Sets the given payments to the object. Currently contained payments instances will be removed. + * + * @param payments the list of new instances + */ + public void setPayments(final List<CashPayment> payments) { + // remove the old cashPayment + for(CashPayment oldElement : new ArrayList<CashPayment>(this.internalGetPayments())){ + removeFromPayments(oldElement); + } + + // add the new cashPayment + for(CashPayment newElement : payments){ + addToPayments(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>CashPayment</code>s thereby lazy initializing it. + */ + public List<CashPayment> internalGetPayments() { + if (this.payments == null) { + this.payments = new ArrayList<CashPayment>(); + } + return this.payments; + } + + /** + * Adds the given cashPayment to this object. <p> + * Since the reference is a composition reference, the opposite reference (CashPayment.methodOfPayment) + * of the cashPayment will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPayment#setMethodOfPayment(CashPayment)}. + * + */ + public void addToPayments(final CashPayment cashPayment) { + checkDisposed(); + cashPayment.setMethodOfPayment(this); + } + + /** + * Removes the given cashPayment from this object. <p> + * + */ + public void removeFromPayments(final CashPayment cashPayment) { + checkDisposed(); + cashPayment.setMethodOfPayment(null); + } + + /** + * For internal use only! + */ + public void internalAddToPayments(final CashPayment cashPayment) { + if(cashPayment == null) { + return; + } + + if(!internalGetPayments().contains(cashPayment)) { + internalGetPayments().add(cashPayment); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPayments(final CashPayment cashPayment) { + internalGetPayments().remove(cashPayment); + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the payments + for(CashPayment oldElement : new ArrayList<CashPayment>(this.internalGetPayments())){ + removeFromPayments(oldElement); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPosition.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPosition.java new file mode 100644 index 0000000..b6ff39f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashPosition.java
@@ -0,0 +1,200 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.Date; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CashSlip; + +@Entity +@Table(name = "CASH_POSITION") +@SuppressWarnings("all") +public class CashPosition extends BaseUUID implements IEntity { + @Column(name = "NOW") + @Temporal(value = TemporalType.TIMESTAMP) + @Valid + private Date now; + + @Column(name = "QUANTITY") + private double quantity; + + @Column(name = "PRICE") + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double price; + + @Column(name = "AMOUNT") + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double amount; + + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "SLIP_ID") + private CashSlip slip; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.slip != null) { + this.slip.dispose(); + this.slip = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + checkDisposed(); + return this.now; + } + + /** + * Sets the now property to this instance. + */ + public void setNow(final Date now) { + checkDisposed(); + this.now = now; + } + + /** + * @return Returns the quantity property or <code>null</code> if not present. + */ + public double getQuantity() { + checkDisposed(); + return this.quantity; + } + + /** + * Sets the quantity property to this instance. + */ + public void setQuantity(final double quantity) { + checkDisposed(); + this.quantity = quantity; + } + + /** + * @return Returns the price property or <code>null</code> if not present. + */ + public Double getPrice() { + checkDisposed(); + return this.price; + } + + /** + * Sets the price property to this instance. + */ + public void setPrice(final Double price) { + checkDisposed(); + this.price = price; + } + + /** + * @return Returns the amount property or <code>null</code> if not present. + */ + public Double getAmount() { + checkDisposed(); + return this.amount; + } + + /** + * Sets the amount property to this instance. + */ + public void setAmount(final Double amount) { + checkDisposed(); + this.amount = amount; + } + + /** + * @return Returns the slip property or <code>null</code> if not present. + */ + public CashSlip getSlip() { + checkDisposed(); + return this.slip; + } + + /** + * Sets the slip property to this instance. + * Since the reference is a container reference, the opposite reference (CashSlip.positions) + * of the slip will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashSlip#setPositions(CashSlip)}. + */ + public void setSlip(final CashSlip slip) { + checkDisposed(); + if (this.slip != null) { + this.slip.internalRemoveFromPositions(this); + } + internalSetSlip(slip); + if (this.slip != null) { + this.slip.internalAddToPositions(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetSlip(final CashSlip slip) { + this.slip = slip; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashRegister.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashRegister.java new file mode 100644 index 0000000..e9a80da --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashRegister.java
@@ -0,0 +1,233 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.Cacheable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CashSlip; + +@Entity +@Table(name = "CASH_REGISTER", indexes = { @Index(name = "cashIpIndex", unique = true, columnList = "ip"), @Index(name = "cashNumIndex", unique = true, columnList = "num") }) +@Cacheable +@SuppressWarnings("all") +public class CashRegister extends BaseUUID implements IEntity { + @DomainKey + @Column(name = "NUM") + private String num; + + @Column(name = "IP") + private String ip; + + @Column(name = "LOCATION") + private String location; + + @Column(name = "CURRENT_DAY") + private String currentDay; + + @JoinColumn(name = "SLIPS_ID") + @OneToMany(mappedBy = "register") + @Noncacheable + private List<CashSlip> slips; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the num property or <code>null</code> if not present. + */ + public String getNum() { + checkDisposed(); + return this.num; + } + + /** + * Sets the num property to this instance. + */ + public void setNum(final String num) { + checkDisposed(); + this.num = num; + } + + /** + * @return Returns the ip property or <code>null</code> if not present. + */ + public String getIp() { + checkDisposed(); + return this.ip; + } + + /** + * Sets the ip property to this instance. + */ + public void setIp(final String ip) { + checkDisposed(); + this.ip = ip; + } + + /** + * @return Returns the location property or <code>null</code> if not present. + */ + public String getLocation() { + checkDisposed(); + return this.location; + } + + /** + * Sets the location property to this instance. + */ + public void setLocation(final String location) { + checkDisposed(); + this.location = location; + } + + /** + * @return Returns the currentDay property or <code>null</code> if not present. + */ + public String getCurrentDay() { + checkDisposed(); + return this.currentDay; + } + + /** + * Sets the currentDay property to this instance. + */ + public void setCurrentDay(final String currentDay) { + checkDisposed(); + this.currentDay = currentDay; + } + + /** + * @return Returns an unmodifiable list of slips. + */ + public List<CashSlip> getSlips() { + checkDisposed(); + return Collections.unmodifiableList(internalGetSlips()); + } + + /** + * Sets the given slips to the object. Currently contained slips instances will be removed. + * + * @param slips the list of new instances + */ + public void setSlips(final List<CashSlip> slips) { + // remove the old cashSlip + for(CashSlip oldElement : new ArrayList<CashSlip>(this.internalGetSlips())){ + removeFromSlips(oldElement); + } + + // add the new cashSlip + for(CashSlip newElement : slips){ + addToSlips(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>CashSlip</code>s thereby lazy initializing it. + */ + public List<CashSlip> internalGetSlips() { + if (this.slips == null) { + this.slips = new ArrayList<CashSlip>(); + } + return this.slips; + } + + /** + * Adds the given cashSlip to this object. <p> + * Since the reference is a composition reference, the opposite reference (CashSlip.register) + * of the cashSlip will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashSlip#setRegister(CashSlip)}. + * + */ + public void addToSlips(final CashSlip cashSlip) { + checkDisposed(); + cashSlip.setRegister(this); + } + + /** + * Removes the given cashSlip from this object. <p> + * + */ + public void removeFromSlips(final CashSlip cashSlip) { + checkDisposed(); + cashSlip.setRegister(null); + } + + /** + * For internal use only! + */ + public void internalAddToSlips(final CashSlip cashSlip) { + if(cashSlip == null) { + return; + } + + if(!internalGetSlips().contains(cashSlip)) { + internalGetSlips().add(cashSlip); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromSlips(final CashSlip cashSlip) { + internalGetSlips().remove(cashSlip); + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the slips + for(CashSlip oldElement : new ArrayList<CashSlip>(this.internalGetSlips())){ + removeFromSlips(oldElement); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashSlip.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashSlip.java new file mode 100644 index 0000000..45c6ed0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CashSlip.java
@@ -0,0 +1,472 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CashPayment; +import org.osbp.tests.entities.CashPosition; +import org.osbp.tests.entities.CashRegister; +import org.osbp.tests.entities.Mcustomer; + +@Entity +@Table(name = "CASH_SLIP", indexes = { @Index(name = "currentDay_index", columnList = "currentDay"), @Index(name = "serial_index", columnList = "currentDay, serial") }) +@SuppressWarnings("all") +public class CashSlip extends BaseUUID implements IEntity { + @Column(name = "CURRENT_DAY") + private String currentDay; + + @Column(name = "NOW") + @Temporal(value = TemporalType.TIMESTAMP) + @Valid + private Date now; + + @Column(name = "CASHIER") + private String cashier; + + @Column(name = "TOTAL") + @Properties(properties = @Property(key = "decimalformat", value = "###,##0.00 ¤")) + private Double total; + + @GeneratedValue + @Column(name = "SERIAL") + private long serial; + + @Column(name = "PAYED") + private boolean payed; + + @JoinColumn(name = "POSITIONS_ID") + @OneToMany(mappedBy = "slip", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<CashPosition> positions; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CUSTOMER_ID") + private Mcustomer customer; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "REGISTER_ID") + private CashRegister register; + + @JoinColumn(name = "PAYMENTS_ID") + @OneToMany(mappedBy = "slip", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<CashPayment> payments; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.positions != null) { + for (CashPosition cashPosition : this.positions) { + cashPosition.dispose(); + } + this.positions = null; + } + if (this.payments != null) { + for (CashPayment cashPayment : this.payments) { + cashPayment.dispose(); + } + this.payments = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the currentDay property or <code>null</code> if not present. + */ + public String getCurrentDay() { + checkDisposed(); + return this.currentDay; + } + + /** + * Sets the currentDay property to this instance. + */ + public void setCurrentDay(final String currentDay) { + checkDisposed(); + this.currentDay = currentDay; + } + + /** + * @return Returns the now property or <code>null</code> if not present. + */ + public Date getNow() { + checkDisposed(); + return this.now; + } + + /** + * Sets the now property to this instance. + */ + public void setNow(final Date now) { + checkDisposed(); + this.now = now; + } + + /** + * @return Returns the cashier property or <code>null</code> if not present. + */ + public String getCashier() { + checkDisposed(); + return this.cashier; + } + + /** + * Sets the cashier property to this instance. + */ + public void setCashier(final String cashier) { + checkDisposed(); + this.cashier = cashier; + } + + /** + * @return Returns the total property or <code>null</code> if not present. + */ + public Double getTotal() { + checkDisposed(); + return this.total; + } + + /** + * Sets the total property to this instance. + */ + public void setTotal(final Double total) { + checkDisposed(); + this.total = total; + } + + /** + * @return Returns the serial property or <code>null</code> if not present. + */ + public long getSerial() { + checkDisposed(); + return this.serial; + } + + /** + * Sets the serial property to this instance. + */ + public void setSerial(final long serial) { + checkDisposed(); + this.serial = serial; + } + + /** + * @return Returns the payed property or <code>null</code> if not present. + */ + public boolean getPayed() { + checkDisposed(); + return this.payed; + } + + /** + * Sets the payed property to this instance. + */ + public void setPayed(final boolean payed) { + checkDisposed(); + this.payed = payed; + } + + /** + * @return Returns an unmodifiable list of positions. + */ + public List<CashPosition> getPositions() { + checkDisposed(); + return Collections.unmodifiableList(internalGetPositions()); + } + + /** + * Sets the given positions to the object. Currently contained positions instances will be removed. + * + * @param positions the list of new instances + */ + public void setPositions(final List<CashPosition> positions) { + // remove the old cashPosition + for(CashPosition oldElement : new ArrayList<CashPosition>(this.internalGetPositions())){ + removeFromPositions(oldElement); + } + + // add the new cashPosition + for(CashPosition newElement : positions){ + addToPositions(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>CashPosition</code>s thereby lazy initializing it. + */ + public List<CashPosition> internalGetPositions() { + if (this.positions == null) { + this.positions = new ArrayList<CashPosition>(); + } + return this.positions; + } + + /** + * Adds the given cashPosition to this object. <p> + * Since the reference is a composition reference, the opposite reference (CashPosition.slip) + * of the cashPosition will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPosition#setSlip(CashPosition)}. + * + */ + public void addToPositions(final CashPosition cashPosition) { + checkDisposed(); + cashPosition.setSlip(this); + } + + /** + * Removes the given cashPosition from this object. <p> + * Since the reference is a cascading reference, the opposite reference (CashPosition.slip) + * of the cashPosition will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPosition#setSlip(CashPosition)}. + * + */ + public void removeFromPositions(final CashPosition cashPosition) { + checkDisposed(); + cashPosition.setSlip(null); + } + + /** + * For internal use only! + */ + public void internalAddToPositions(final CashPosition cashPosition) { + if(cashPosition == null) { + return; + } + + if(!internalGetPositions().contains(cashPosition)) { + internalGetPositions().add(cashPosition); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPositions(final CashPosition cashPosition) { + internalGetPositions().remove(cashPosition); + } + + /** + * @return Returns the customer property or <code>null</code> if not present. + */ + public Mcustomer getCustomer() { + checkDisposed(); + return this.customer; + } + + /** + * Sets the customer property to this instance. + * Since the reference is a container reference, the opposite reference (Mcustomer.slips) + * of the customer will be handled automatically and no further coding is required to keep them in sync. + * See {@link Mcustomer#setSlips(Mcustomer)}. + */ + public void setCustomer(final Mcustomer customer) { + checkDisposed(); + if (this.customer != null) { + this.customer.internalRemoveFromSlips(this); + } + internalSetCustomer(customer); + if (this.customer != null) { + this.customer.internalAddToSlips(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetCustomer(final Mcustomer customer) { + this.customer = customer; + } + + /** + * @return Returns the register property or <code>null</code> if not present. + */ + public CashRegister getRegister() { + checkDisposed(); + return this.register; + } + + /** + * Sets the register property to this instance. + * Since the reference is a container reference, the opposite reference (CashRegister.slips) + * of the register will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashRegister#setSlips(CashRegister)}. + */ + public void setRegister(final CashRegister register) { + checkDisposed(); + if (this.register != null) { + this.register.internalRemoveFromSlips(this); + } + internalSetRegister(register); + if (this.register != null) { + this.register.internalAddToSlips(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetRegister(final CashRegister register) { + this.register = register; + } + + /** + * @return Returns an unmodifiable list of payments. + */ + public List<CashPayment> getPayments() { + checkDisposed(); + return Collections.unmodifiableList(internalGetPayments()); + } + + /** + * Sets the given payments to the object. Currently contained payments instances will be removed. + * + * @param payments the list of new instances + */ + public void setPayments(final List<CashPayment> payments) { + // remove the old cashPayment + for(CashPayment oldElement : new ArrayList<CashPayment>(this.internalGetPayments())){ + removeFromPayments(oldElement); + } + + // add the new cashPayment + for(CashPayment newElement : payments){ + addToPayments(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>CashPayment</code>s thereby lazy initializing it. + */ + public List<CashPayment> internalGetPayments() { + if (this.payments == null) { + this.payments = new ArrayList<CashPayment>(); + } + return this.payments; + } + + /** + * Adds the given cashPayment to this object. <p> + * Since the reference is a composition reference, the opposite reference (CashPayment.slip) + * of the cashPayment will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPayment#setSlip(CashPayment)}. + * + */ + public void addToPayments(final CashPayment cashPayment) { + checkDisposed(); + cashPayment.setSlip(this); + } + + /** + * Removes the given cashPayment from this object. <p> + * Since the reference is a cascading reference, the opposite reference (CashPayment.slip) + * of the cashPayment will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashPayment#setSlip(CashPayment)}. + * + */ + public void removeFromPayments(final CashPayment cashPayment) { + checkDisposed(); + cashPayment.setSlip(null); + } + + /** + * For internal use only! + */ + public void internalAddToPayments(final CashPayment cashPayment) { + if(cashPayment == null) { + return; + } + + if(!internalGetPayments().contains(cashPayment)) { + internalGetPayments().add(cashPayment); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromPayments(final CashPayment cashPayment) { + internalGetPayments().remove(cashPayment); + } + + public String when() { + if ((this.now != null)) { + return SimpleDateFormat.getDateInstance(DateFormat.SHORT).format(this.now); + } + return ""; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Company.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Company.java new file mode 100644 index 0000000..17aaae7 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Company.java
@@ -0,0 +1,382 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.Address; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.CompanyGroup; +import org.osbp.tests.entities.CompanyRelationType; +import org.osbp.tests.entities.Department; + +/** + * a company + */ +@Entity +@Table(name = "COMPANY") +@SuppressWarnings("all") +public class Company extends BaseUUID implements IEntity { + /** + * the company group if any + */ + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "COMPANY_GROUP_ID") + private CompanyGroup company_group; + + /** + * name of the company + */ + @DomainKey + @Column(name = "NAME") + private String name; + + /** + * more detailed description with usable information for the PIM owner + */ + @Column(name = "DESCRIPTION") + private String description; + + /** + * relation of the company to the PIM owner + */ + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "RELATION_TYPE_ID") + private CompanyRelationType relation_type; + + /** + * any number of addresses + */ + @JoinColumn(name = "ADDRESS_ID") + @OneToMany(mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<Address> address; + + /** + * departments of this company + */ + @JoinColumn(name = "DEPARTMENTS_ID") + @OneToMany(mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<Department> departments; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.address != null) { + for (Address address : this.address) { + address.dispose(); + } + this.address = null; + } + if (this.departments != null) { + for (Department department : this.departments) { + department.dispose(); + } + this.departments = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the company_group property or <code>null</code> if not present. + */ + public CompanyGroup getCompany_group() { + checkDisposed(); + return this.company_group; + } + + /** + * Sets the company_group property to this instance. + * Since the reference is a container reference, the opposite reference (CompanyGroup.companies) + * of the company_group will be handled automatically and no further coding is required to keep them in sync. + * See {@link CompanyGroup#setCompanies(CompanyGroup)}. + */ + public void setCompany_group(final CompanyGroup company_group) { + checkDisposed(); + if (this.company_group != null) { + this.company_group.internalRemoveFromCompanies(this); + } + internalSetCompany_group(company_group); + if (this.company_group != null) { + this.company_group.internalAddToCompanies(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetCompany_group(final CompanyGroup company_group) { + this.company_group = company_group; + } + + /** + * @return Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the name property to this instance. + */ + public void setName(final String name) { + checkDisposed(); + this.name = name; + } + + /** + * @return Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + checkDisposed(); + return this.description; + } + + /** + * Sets the description property to this instance. + */ + public void setDescription(final String description) { + checkDisposed(); + this.description = description; + } + + /** + * @return Returns the relation_type property or <code>null</code> if not present. + */ + public CompanyRelationType getRelation_type() { + checkDisposed(); + return this.relation_type; + } + + /** + * Sets the relation_type property to this instance. + */ + public void setRelation_type(final CompanyRelationType relation_type) { + checkDisposed(); + this.relation_type = relation_type; + } + + /** + * @return Returns an unmodifiable list of address. + */ + public List<Address> getAddress() { + checkDisposed(); + return Collections.unmodifiableList(internalGetAddress()); + } + + /** + * Sets the given address to the object. Currently contained address instances will be removed. + * + * @param address the list of new instances + */ + public void setAddress(final List<Address> address) { + // remove the old address + for(Address oldElement : new ArrayList<Address>(this.internalGetAddress())){ + removeFromAddress(oldElement); + } + + // add the new address + for(Address newElement : address){ + addToAddress(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>Address</code>s thereby lazy initializing it. + */ + public List<Address> internalGetAddress() { + if (this.address == null) { + this.address = new ArrayList<Address>(); + } + return this.address; + } + + /** + * Adds the given address to this object. <p> + * Since the reference is a composition reference, the opposite reference (Address.company) + * of the address will be handled automatically and no further coding is required to keep them in sync. + * See {@link Address#setCompany(Address)}. + * + */ + public void addToAddress(final Address address) { + checkDisposed(); + address.setCompany(this); + } + + /** + * Removes the given address from this object. <p> + * Since the reference is a cascading reference, the opposite reference (Address.company) + * of the address will be handled automatically and no further coding is required to keep them in sync. + * See {@link Address#setCompany(Address)}. + * + */ + public void removeFromAddress(final Address address) { + checkDisposed(); + address.setCompany(null); + } + + /** + * For internal use only! + */ + public void internalAddToAddress(final Address address) { + if(address == null) { + return; + } + + if(!internalGetAddress().contains(address)) { + internalGetAddress().add(address); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromAddress(final Address address) { + internalGetAddress().remove(address); + } + + /** + * @return Returns an unmodifiable list of departments. + */ + public List<Department> getDepartments() { + checkDisposed(); + return Collections.unmodifiableList(internalGetDepartments()); + } + + /** + * Sets the given departments to the object. Currently contained departments instances will be removed. + * + * @param departments the list of new instances + */ + public void setDepartments(final List<Department> departments) { + // remove the old department + for(Department oldElement : new ArrayList<Department>(this.internalGetDepartments())){ + removeFromDepartments(oldElement); + } + + // add the new department + for(Department newElement : departments){ + addToDepartments(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>Department</code>s thereby lazy initializing it. + */ + public List<Department> internalGetDepartments() { + if (this.departments == null) { + this.departments = new ArrayList<Department>(); + } + return this.departments; + } + + /** + * Adds the given department to this object. <p> + * Since the reference is a composition reference, the opposite reference (Department.company) + * of the department will be handled automatically and no further coding is required to keep them in sync. + * See {@link Department#setCompany(Department)}. + * + */ + public void addToDepartments(final Department department) { + checkDisposed(); + department.setCompany(this); + } + + /** + * Removes the given department from this object. <p> + * Since the reference is a cascading reference, the opposite reference (Department.company) + * of the department will be handled automatically and no further coding is required to keep them in sync. + * See {@link Department#setCompany(Department)}. + * + */ + public void removeFromDepartments(final Department department) { + checkDisposed(); + department.setCompany(null); + } + + /** + * For internal use only! + */ + public void internalAddToDepartments(final Department department) { + if(department == null) { + return; + } + + if(!internalGetDepartments().contains(department)) { + internalGetDepartments().add(department); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromDepartments(final Department department) { + internalGetDepartments().remove(department); + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyGroup.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyGroup.java new file mode 100644 index 0000000..6f9851f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyGroup.java
@@ -0,0 +1,229 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.Company; + +/** + * a company group consisting of a group of companies, from one is defined as the main company + */ +@Entity +@Table(name = "COMPANY_GROUP") +@SuppressWarnings("all") +public class CompanyGroup extends BaseUUID implements IEntity { + /** + * name of the company group + */ + @DomainKey + @Column(name = "NAME") + private String name; + + /** + * more detailed description with usable information for the PIM owner + */ + @Column(name = "DESCRIPTION") + private String description; + + /** + * the main company + */ + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "MAIN_COMPANY_ID") + private Company main_company; + + /** + * group of companies + */ + @JoinColumn(name = "COMPANIES_ID") + @OneToMany(mappedBy = "company_group") + @Noncacheable + private List<Company> companies; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the name property to this instance. + */ + public void setName(final String name) { + checkDisposed(); + this.name = name; + } + + /** + * @return Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + checkDisposed(); + return this.description; + } + + /** + * Sets the description property to this instance. + */ + public void setDescription(final String description) { + checkDisposed(); + this.description = description; + } + + /** + * @return Returns the main_company property or <code>null</code> if not present. + */ + public Company getMain_company() { + checkDisposed(); + return this.main_company; + } + + /** + * Sets the main_company property to this instance. + */ + public void setMain_company(final Company main_company) { + checkDisposed(); + this.main_company = main_company; + } + + /** + * @return Returns an unmodifiable list of companies. + */ + public List<Company> getCompanies() { + checkDisposed(); + return Collections.unmodifiableList(internalGetCompanies()); + } + + /** + * Sets the given companies to the object. Currently contained companies instances will be removed. + * + * @param companies the list of new instances + */ + public void setCompanies(final List<Company> companies) { + // remove the old company + for(Company oldElement : new ArrayList<Company>(this.internalGetCompanies())){ + removeFromCompanies(oldElement); + } + + // add the new company + for(Company newElement : companies){ + addToCompanies(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>Company</code>s thereby lazy initializing it. + */ + public List<Company> internalGetCompanies() { + if (this.companies == null) { + this.companies = new ArrayList<Company>(); + } + return this.companies; + } + + /** + * Adds the given company to this object. <p> + * Since the reference is a composition reference, the opposite reference (Company.company_group) + * of the company will be handled automatically and no further coding is required to keep them in sync. + * See {@link Company#setCompany_group(Company)}. + * + */ + public void addToCompanies(final Company company) { + checkDisposed(); + company.setCompany_group(this); + } + + /** + * Removes the given company from this object. <p> + * + */ + public void removeFromCompanies(final Company company) { + checkDisposed(); + company.setCompany_group(null); + } + + /** + * For internal use only! + */ + public void internalAddToCompanies(final Company company) { + if(company == null) { + return; + } + + if(!internalGetCompanies().contains(company)) { + internalGetCompanies().add(company); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromCompanies(final Company company) { + internalGetCompanies().remove(company); + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the companies + for(Company oldElement : new ArrayList<Company>(this.internalGetCompanies())){ + removeFromCompanies(oldElement); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyRelationType.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyRelationType.java new file mode 100644 index 0000000..ee69d49 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/CompanyRelationType.java
@@ -0,0 +1,110 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.osbp.tests.entities.BaseUUID; + +/** + * relation of the company to the owner - not the user - of this personal information manager + */ +@Entity +@Table(name = "COMPANY_RELATION_TYPE") +@SuppressWarnings("all") +public class CompanyRelationType extends BaseUUID implements IEntity { + /** + * short name for this relation type + */ + @DomainKey + @Column(name = "NAME") + private String name; + + /** + * more detailed description + */ + @Column(name = "DESCRIPTION") + private String description; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the name property to this instance. + */ + public void setName(final String name) { + checkDisposed(); + this.name = name; + } + + /** + * @return Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + checkDisposed(); + return this.description; + } + + /** + * Sets the description property to this instance. + */ + public void setDescription(final String description) { + checkDisposed(); + this.description = description; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Department.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Department.java new file mode 100644 index 0000000..85b9a6f --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Department.java
@@ -0,0 +1,289 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.Address; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.Company; + +/** + * a companies department + */ +@Entity +@Table(name = "DEPARTMENT") +@SuppressWarnings("all") +public class Department extends BaseUUID implements IEntity { + /** + * the company + */ + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "COMPANY_ID") + private Company company; + + /** + * name of the department + */ + @DomainKey + @Column(name = "NAME") + private String name; + + /** + * more detailed description with usable information for the PIM owner + */ + @Column(name = "DESCRIPTION") + private String description; + + /** + * any number of addresses + */ + @JoinColumn(name = "ADDRESS_ID") + @OneToMany(mappedBy = "department", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<Address> address; + + /** + * any number of employees + */ + @Column(name = "DEFAULT_YEARLY_INCOME") + private double default_yearly_income; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.company != null) { + this.company.dispose(); + this.company = null; + } + if (this.address != null) { + for (Address address : this.address) { + address.dispose(); + } + this.address = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the company property or <code>null</code> if not present. + */ + public Company getCompany() { + checkDisposed(); + return this.company; + } + + /** + * Sets the company property to this instance. + * Since the reference is a container reference, the opposite reference (Company.departments) + * of the company will be handled automatically and no further coding is required to keep them in sync. + * See {@link Company#setDepartments(Company)}. + */ + public void setCompany(final Company company) { + checkDisposed(); + if (this.company != null) { + this.company.internalRemoveFromDepartments(this); + } + internalSetCompany(company); + if (this.company != null) { + this.company.internalAddToDepartments(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetCompany(final Company company) { + this.company = company; + } + + /** + * @return Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the name property to this instance. + */ + public void setName(final String name) { + checkDisposed(); + this.name = name; + } + + /** + * @return Returns the description property or <code>null</code> if not present. + */ + public String getDescription() { + checkDisposed(); + return this.description; + } + + /** + * Sets the description property to this instance. + */ + public void setDescription(final String description) { + checkDisposed(); + this.description = description; + } + + /** + * @return Returns an unmodifiable list of address. + */ + public List<Address> getAddress() { + checkDisposed(); + return Collections.unmodifiableList(internalGetAddress()); + } + + /** + * Sets the given address to the object. Currently contained address instances will be removed. + * + * @param address the list of new instances + */ + public void setAddress(final List<Address> address) { + // remove the old address + for(Address oldElement : new ArrayList<Address>(this.internalGetAddress())){ + removeFromAddress(oldElement); + } + + // add the new address + for(Address newElement : address){ + addToAddress(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>Address</code>s thereby lazy initializing it. + */ + public List<Address> internalGetAddress() { + if (this.address == null) { + this.address = new ArrayList<Address>(); + } + return this.address; + } + + /** + * Adds the given address to this object. <p> + * Since the reference is a composition reference, the opposite reference (Address.department) + * of the address will be handled automatically and no further coding is required to keep them in sync. + * See {@link Address#setDepartment(Address)}. + * + */ + public void addToAddress(final Address address) { + checkDisposed(); + address.setDepartment(this); + } + + /** + * Removes the given address from this object. <p> + * Since the reference is a cascading reference, the opposite reference (Address.department) + * of the address will be handled automatically and no further coding is required to keep them in sync. + * See {@link Address#setDepartment(Address)}. + * + */ + public void removeFromAddress(final Address address) { + checkDisposed(); + address.setDepartment(null); + } + + /** + * For internal use only! + */ + public void internalAddToAddress(final Address address) { + if(address == null) { + return; + } + + if(!internalGetAddress().contains(address)) { + internalGetAddress().add(address); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromAddress(final Address address) { + internalGetAddress().remove(address); + } + + /** + * @return Returns the default_yearly_income property or <code>null</code> if not present. + */ + public double getDefault_yearly_income() { + checkDisposed(); + return this.default_yearly_income; + } + + /** + * Sets the default_yearly_income property to this instance. + */ + public void setDefault_yearly_income(final double default_yearly_income) { + checkDisposed(); + this.default_yearly_income = default_yearly_income; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestBean.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestBean.java new file mode 100644 index 0000000..a36ee96 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestBean.java
@@ -0,0 +1,109 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.io.Serializable; +import javax.persistence.Basic; +import javax.persistence.Embeddable; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Transient; +import org.eclipse.osbp.dsl.common.datatypes.IBean; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.osbp.tests.entities.DtoTestChildCrossRef; + +@Embeddable +@SuppressWarnings("all") +public class DtoTestBean implements Serializable, IBean { + @Transient + @Dispose + private boolean disposed; + + @Basic + private String foo; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "crossRefChild") + private DtoTestChildCrossRef crossRefChild; + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + @Dispose + public boolean isDisposed() { + return this.disposed; + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * @return Returns the foo property or <code>null</code> if not present. + */ + public String getFoo() { + checkDisposed(); + return this.foo; + } + + /** + * Sets the foo property to this instance. + */ + public void setFoo(final String foo) { + checkDisposed(); + this.foo = foo; + } + + /** + * @return Returns the crossRefChild property or <code>null</code> if not present. + */ + public DtoTestChildCrossRef getCrossRefChild() { + checkDisposed(); + return this.crossRefChild; + } + + /** + * Sets the crossRefChild property to this instance. + */ + public void setCrossRefChild(final DtoTestChildCrossRef crossRefChild) { + checkDisposed(); + this.crossRefChild = crossRefChild; + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildContainment.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildContainment.java new file mode 100644 index 0000000..c5a1fa6 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildContainment.java
@@ -0,0 +1,113 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.DtoTestParent; + +@Entity +@Table(name = "DTO_TEST_CHILD_CONTAINMENT") +@SuppressWarnings("all") +public class DtoTestChildContainment extends BaseUUID implements IEntity { + @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "CONTAINER_ID") + private DtoTestParent container; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.container != null) { + this.container.dispose(); + this.container = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the container property or <code>null</code> if not present. + */ + public DtoTestParent getContainer() { + checkDisposed(); + return this.container; + } + + /** + * Sets the container property to this instance. + * Since the reference is a container reference, the opposite reference (DtoTestParent.containmentChilds) + * of the container will be handled automatically and no further coding is required to keep them in sync. + * See {@link DtoTestParent#setContainmentChilds(DtoTestParent)}. + */ + public void setContainer(final DtoTestParent container) { + checkDisposed(); + if (this.container != null) { + this.container.internalRemoveFromContainmentChilds(this); + } + internalSetContainer(container); + if (this.container != null) { + this.container.internalAddToContainmentChilds(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetContainer(final DtoTestParent container) { + this.container = container; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildCrossRef.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildCrossRef.java new file mode 100644 index 0000000..1e4ad15 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestChildCrossRef.java
@@ -0,0 +1,101 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.DtoTestParent; + +@Entity +@Table(name = "DTO_TEST_CHILD_CROSS_REF") +@SuppressWarnings("all") +public class DtoTestChildCrossRef extends BaseUUID implements IEntity { + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONTAINER_ID") + private DtoTestParent container; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the container property or <code>null</code> if not present. + */ + public DtoTestParent getContainer() { + checkDisposed(); + return this.container; + } + + /** + * Sets the container property to this instance. + * Since the reference is a container reference, the opposite reference (DtoTestParent.crossRefChilds) + * of the container will be handled automatically and no further coding is required to keep them in sync. + * See {@link DtoTestParent#setCrossRefChilds(DtoTestParent)}. + */ + public void setContainer(final DtoTestParent container) { + checkDisposed(); + if (this.container != null) { + this.container.internalRemoveFromCrossRefChilds(this); + } + internalSetContainer(container); + if (this.container != null) { + this.container.internalAddToCrossRefChilds(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetContainer(final DtoTestParent container) { + this.container = container; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestParent.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestParent.java new file mode 100644 index 0000000..7f692fe --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/DtoTestParent.java
@@ -0,0 +1,323 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.AssociationOverride; +import javax.persistence.AssociationOverrides; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseUUID; +import org.osbp.tests.entities.DtoTestBean; +import org.osbp.tests.entities.DtoTestChildContainment; +import org.osbp.tests.entities.DtoTestChildCrossRef; + +@Entity +@Table(name = "DTO_TEST_PARENT") +@SuppressWarnings("all") +public class DtoTestParent extends BaseUUID implements IEntity { + @Column(name = "STRING") + private String string; + + @JoinColumn(name = "CONTAINMENT_CHILDS_ID") + @OneToMany(mappedBy = "container", cascade = CascadeType.ALL, orphanRemoval = true) + @Noncacheable + @Valid + private List<DtoTestChildContainment> containmentChilds; + + @JoinColumn(name = "CROSS_REF_CHILDS_ID") + @OneToMany(mappedBy = "container") + @Noncacheable + private List<DtoTestChildCrossRef> crossRefChilds; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CROSS_REF_CHILD_ID") + private DtoTestChildCrossRef crossRefChild; + + @Embedded + @AttributeOverrides(value = @AttributeOverride(name = "foo", column = @Column(name = "BEANX_FOO"))) + @AssociationOverrides(value = @AssociationOverride(name = "crossRefChild", joinColumns = @JoinColumn(name = "BEANX_CROSSREFCHILD"))) + @Column(name = "BEANX") + @Valid + private DtoTestBean beanx; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.containmentChilds != null) { + for (DtoTestChildContainment dtoTestChildContainment : this.containmentChilds) { + dtoTestChildContainment.dispose(); + } + this.containmentChilds = null; + } + + } + finally { + super.dispose(); + } + + } + + /** + * @return Returns the string property or <code>null</code> if not present. + */ + public String getString() { + checkDisposed(); + return this.string; + } + + /** + * Sets the string property to this instance. + */ + public void setString(final String string) { + checkDisposed(); + this.string = string; + } + + /** + * @return Returns an unmodifiable list of containmentChilds. + */ + public List<DtoTestChildContainment> getContainmentChilds() { + checkDisposed(); + return Collections.unmodifiableList(internalGetContainmentChilds()); + } + + /** + * Sets the given containmentChilds to the object. Currently contained containmentChilds instances will be removed. + * + * @param containmentChilds the list of new instances + */ + public void setContainmentChilds(final List<DtoTestChildContainment> containmentChilds) { + // remove the old dtoTestChildContainment + for(DtoTestChildContainment oldElement : new ArrayList<DtoTestChildContainment>(this.internalGetContainmentChilds())){ + removeFromContainmentChilds(oldElement); + } + + // add the new dtoTestChildContainment + for(DtoTestChildContainment newElement : containmentChilds){ + addToContainmentChilds(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>DtoTestChildContainment</code>s thereby lazy initializing it. + */ + public List<DtoTestChildContainment> internalGetContainmentChilds() { + if (this.containmentChilds == null) { + this.containmentChilds = new ArrayList<DtoTestChildContainment>(); + } + return this.containmentChilds; + } + + /** + * Adds the given dtoTestChildContainment to this object. <p> + * Since the reference is a composition reference, the opposite reference (DtoTestChildContainment.container) + * of the dtoTestChildContainment will be handled automatically and no further coding is required to keep them in sync. + * See {@link DtoTestChildContainment#setContainer(DtoTestChildContainment)}. + * + */ + public void addToContainmentChilds(final DtoTestChildContainment dtoTestChildContainment) { + checkDisposed(); + dtoTestChildContainment.setContainer(this); + } + + /** + * Removes the given dtoTestChildContainment from this object. <p> + * Since the reference is a cascading reference, the opposite reference (DtoTestChildContainment.container) + * of the dtoTestChildContainment will be handled automatically and no further coding is required to keep them in sync. + * See {@link DtoTestChildContainment#setContainer(DtoTestChildContainment)}. + * + */ + public void removeFromContainmentChilds(final DtoTestChildContainment dtoTestChildContainment) { + checkDisposed(); + dtoTestChildContainment.setContainer(null); + } + + /** + * For internal use only! + */ + public void internalAddToContainmentChilds(final DtoTestChildContainment dtoTestChildContainment) { + if(dtoTestChildContainment == null) { + return; + } + + if(!internalGetContainmentChilds().contains(dtoTestChildContainment)) { + internalGetContainmentChilds().add(dtoTestChildContainment); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromContainmentChilds(final DtoTestChildContainment dtoTestChildContainment) { + internalGetContainmentChilds().remove(dtoTestChildContainment); + } + + /** + * @return Returns an unmodifiable list of crossRefChilds. + */ + public List<DtoTestChildCrossRef> getCrossRefChilds() { + checkDisposed(); + return Collections.unmodifiableList(internalGetCrossRefChilds()); + } + + /** + * Sets the given crossRefChilds to the object. Currently contained crossRefChilds instances will be removed. + * + * @param crossRefChilds the list of new instances + */ + public void setCrossRefChilds(final List<DtoTestChildCrossRef> crossRefChilds) { + // remove the old dtoTestChildCrossRef + for(DtoTestChildCrossRef oldElement : new ArrayList<DtoTestChildCrossRef>(this.internalGetCrossRefChilds())){ + removeFromCrossRefChilds(oldElement); + } + + // add the new dtoTestChildCrossRef + for(DtoTestChildCrossRef newElement : crossRefChilds){ + addToCrossRefChilds(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>DtoTestChildCrossRef</code>s thereby lazy initializing it. + */ + public List<DtoTestChildCrossRef> internalGetCrossRefChilds() { + if (this.crossRefChilds == null) { + this.crossRefChilds = new ArrayList<DtoTestChildCrossRef>(); + } + return this.crossRefChilds; + } + + /** + * Adds the given dtoTestChildCrossRef to this object. <p> + * Since the reference is a composition reference, the opposite reference (DtoTestChildCrossRef.container) + * of the dtoTestChildCrossRef will be handled automatically and no further coding is required to keep them in sync. + * See {@link DtoTestChildCrossRef#setContainer(DtoTestChildCrossRef)}. + * + */ + public void addToCrossRefChilds(final DtoTestChildCrossRef dtoTestChildCrossRef) { + checkDisposed(); + dtoTestChildCrossRef.setContainer(this); + } + + /** + * Removes the given dtoTestChildCrossRef from this object. <p> + * + */ + public void removeFromCrossRefChilds(final DtoTestChildCrossRef dtoTestChildCrossRef) { + checkDisposed(); + dtoTestChildCrossRef.setContainer(null); + } + + /** + * For internal use only! + */ + public void internalAddToCrossRefChilds(final DtoTestChildCrossRef dtoTestChildCrossRef) { + if(dtoTestChildCrossRef == null) { + return; + } + + if(!internalGetCrossRefChilds().contains(dtoTestChildCrossRef)) { + internalGetCrossRefChilds().add(dtoTestChildCrossRef); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromCrossRefChilds(final DtoTestChildCrossRef dtoTestChildCrossRef) { + internalGetCrossRefChilds().remove(dtoTestChildCrossRef); + } + + /** + * @return Returns the crossRefChild property or <code>null</code> if not present. + */ + public DtoTestChildCrossRef getCrossRefChild() { + checkDisposed(); + return this.crossRefChild; + } + + /** + * Sets the crossRefChild property to this instance. + */ + public void setCrossRefChild(final DtoTestChildCrossRef crossRefChild) { + checkDisposed(); + this.crossRefChild = crossRefChild; + } + + /** + * @return Returns the beanx property or <code>null</code> if not present. + */ + public DtoTestBean getBeanx() { + checkDisposed(); + return this.beanx; + } + + /** + * Sets the beanx property to this instance. + */ + public void setBeanx(final DtoTestBean beanx) { + checkDisposed(); + this.beanx = beanx; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the crossRefChilds + for(DtoTestChildCrossRef oldElement : new ArrayList<DtoTestChildCrossRef>(this.internalGetCrossRefChilds())){ + removeFromCrossRefChilds(oldElement); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Mcustomer.java b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Mcustomer.java new file mode 100644 index 0000000..be84de9 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src-gen/org/osbp/tests/entities/Mcustomer.java
@@ -0,0 +1,701 @@ +/** + * Copyright (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * This source was created by OSBP Softwarefactory Wizard! + * + * OSBP is (C) - Loetz GmbH&Co.KG, 69115 Heidelberg, Germany + * + * ================================================================ + * + * @file $HeadURL$ + * @version $Revision$ + * @date $Date$ + * @author $Author$ + */ +package org.osbp.tests.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.validation.Valid; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.persistence.annotations.Noncacheable; +import org.osbp.tests.entities.BaseID; +import org.osbp.tests.entities.CashSlip; + +@Entity +@Table(name = "MCUSTOMER") +@SuppressWarnings("all") +public class Mcustomer extends BaseID implements IEntity { + @Column(name = "ACCOUNT_NUM") + private long account_num; + + @Column(name = "LNAME") + private String lname; + + @Column(name = "FNAME") + private String fname; + + @Column(name = "MI") + private String mi; + + @Column(name = "ADDRESS1") + private String address1; + + @Column(name = "ADDRESS2") + private String address2; + + @Column(name = "ADDRESS3") + private String address3; + + @Column(name = "ADDRESS4") + private String address4; + + @Column(name = "CITY") + private String city; + + @Column(name = "STATE_PROVINCE") + private String state_province; + + @Column(name = "POSTAL_CODE") + private String postal_code; + + @Column(name = "COUNTRY") + private String country; + + @Column(name = "PHONE1") + private String phone1; + + @Column(name = "PHONE2") + private String phone2; + + @Column(name = "BIRTHDATE") + @Temporal(value = TemporalType.DATE) + @Valid + private Date birthdate; + + @Column(name = "MARITAL_STATUS") + private String marital_status; + + @Column(name = "YEARLY_INCOME") + private String yearly_income; + + @Column(name = "GENDER") + private String gender; + + @Column(name = "TOTAL_CHILDREN") + private int total_children; + + @Column(name = "NUM_CHILDREN_AT_HOME") + private int num_children_at_home; + + @Column(name = "EDUCATION") + private String education; + + @Column(name = "DATE_ACCNT_OPENED") + private String date_accnt_opened; + + @Column(name = "MEMBER_CARD") + private String member_card; + + @Column(name = "OCCUPATION") + private String occupation; + + @Column(name = "HOUSEOWNER") + private String houseowner; + + @Column(name = "NUM_CARS_OWNED") + private int num_cars_owned; + + @DomainKey + @Column(name = "FULLNAME") + private String fullname; + + @Column(name = "TEST") + private String test; + + @JoinColumn(name = "SLIPS_ID") + @OneToMany(mappedBy = "customer") + @Noncacheable + private List<CashSlip> slips; + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + super.dispose(); + } + + /** + * @return Returns the account_num property or <code>null</code> if not present. + */ + public long getAccount_num() { + checkDisposed(); + return this.account_num; + } + + /** + * Sets the account_num property to this instance. + */ + public void setAccount_num(final long account_num) { + checkDisposed(); + this.account_num = account_num; + } + + /** + * @return Returns the lname property or <code>null</code> if not present. + */ + public String getLname() { + checkDisposed(); + return this.lname; + } + + /** + * Sets the lname property to this instance. + */ + public void setLname(final String lname) { + checkDisposed(); + this.lname = lname; + } + + /** + * @return Returns the fname property or <code>null</code> if not present. + */ + public String getFname() { + checkDisposed(); + return this.fname; + } + + /** + * Sets the fname property to this instance. + */ + public void setFname(final String fname) { + checkDisposed(); + this.fname = fname; + } + + /** + * @return Returns the mi property or <code>null</code> if not present. + */ + public String getMi() { + checkDisposed(); + return this.mi; + } + + /** + * Sets the mi property to this instance. + */ + public void setMi(final String mi) { + checkDisposed(); + this.mi = mi; + } + + /** + * @return Returns the address1 property or <code>null</code> if not present. + */ + public String getAddress1() { + checkDisposed(); + return this.address1; + } + + /** + * Sets the address1 property to this instance. + */ + public void setAddress1(final String address1) { + checkDisposed(); + this.address1 = address1; + } + + /** + * @return Returns the address2 property or <code>null</code> if not present. + */ + public String getAddress2() { + checkDisposed(); + return this.address2; + } + + /** + * Sets the address2 property to this instance. + */ + public void setAddress2(final String address2) { + checkDisposed(); + this.address2 = address2; + } + + /** + * @return Returns the address3 property or <code>null</code> if not present. + */ + public String getAddress3() { + checkDisposed(); + return this.address3; + } + + /** + * Sets the address3 property to this instance. + */ + public void setAddress3(final String address3) { + checkDisposed(); + this.address3 = address3; + } + + /** + * @return Returns the address4 property or <code>null</code> if not present. + */ + public String getAddress4() { + checkDisposed(); + return this.address4; + } + + /** + * Sets the address4 property to this instance. + */ + public void setAddress4(final String address4) { + checkDisposed(); + this.address4 = address4; + } + + /** + * @return Returns the city property or <code>null</code> if not present. + */ + public String getCity() { + checkDisposed(); + return this.city; + } + + /** + * Sets the city property to this instance. + */ + public void setCity(final String city) { + checkDisposed(); + this.city = city; + } + + /** + * @return Returns the state_province property or <code>null</code> if not present. + */ + public String getState_province() { + checkDisposed(); + return this.state_province; + } + + /** + * Sets the state_province property to this instance. + */ + public void setState_province(final String state_province) { + checkDisposed(); + this.state_province = state_province; + } + + /** + * @return Returns the postal_code property or <code>null</code> if not present. + */ + public String getPostal_code() { + checkDisposed(); + return this.postal_code; + } + + /** + * Sets the postal_code property to this instance. + */ + public void setPostal_code(final String postal_code) { + checkDisposed(); + this.postal_code = postal_code; + } + + /** + * @return Returns the country property or <code>null</code> if not present. + */ + public String getCountry() { + checkDisposed(); + return this.country; + } + + /** + * Sets the country property to this instance. + */ + public void setCountry(final String country) { + checkDisposed(); + this.country = country; + } + + /** + * @return Returns the phone1 property or <code>null</code> if not present. + */ + public String getPhone1() { + checkDisposed(); + return this.phone1; + } + + /** + * Sets the phone1 property to this instance. + */ + public void setPhone1(final String phone1) { + checkDisposed(); + this.phone1 = phone1; + } + + /** + * @return Returns the phone2 property or <code>null</code> if not present. + */ + public String getPhone2() { + checkDisposed(); + return this.phone2; + } + + /** + * Sets the phone2 property to this instance. + */ + public void setPhone2(final String phone2) { + checkDisposed(); + this.phone2 = phone2; + } + + /** + * @return Returns the birthdate property or <code>null</code> if not present. + */ + public Date getBirthdate() { + checkDisposed(); + return this.birthdate; + } + + /** + * Sets the birthdate property to this instance. + */ + public void setBirthdate(final Date birthdate) { + checkDisposed(); + this.birthdate = birthdate; + } + + /** + * @return Returns the marital_status property or <code>null</code> if not present. + */ + public String getMarital_status() { + checkDisposed(); + return this.marital_status; + } + + /** + * Sets the marital_status property to this instance. + */ + public void setMarital_status(final String marital_status) { + checkDisposed(); + this.marital_status = marital_status; + } + + /** + * @return Returns the yearly_income property or <code>null</code> if not present. + */ + public String getYearly_income() { + checkDisposed(); + return this.yearly_income; + } + + /** + * Sets the yearly_income property to this instance. + */ + public void setYearly_income(final String yearly_income) { + checkDisposed(); + this.yearly_income = yearly_income; + } + + /** + * @return Returns the gender property or <code>null</code> if not present. + */ + public String getGender() { + checkDisposed(); + return this.gender; + } + + /** + * Sets the gender property to this instance. + */ + public void setGender(final String gender) { + checkDisposed(); + this.gender = gender; + } + + /** + * @return Returns the total_children property or <code>null</code> if not present. + */ + public int getTotal_children() { + checkDisposed(); + return this.total_children; + } + + /** + * Sets the total_children property to this instance. + */ + public void setTotal_children(final int total_children) { + checkDisposed(); + this.total_children = total_children; + } + + /** + * @return Returns the num_children_at_home property or <code>null</code> if not present. + */ + public int getNum_children_at_home() { + checkDisposed(); + return this.num_children_at_home; + } + + /** + * Sets the num_children_at_home property to this instance. + */ + public void setNum_children_at_home(final int num_children_at_home) { + checkDisposed(); + this.num_children_at_home = num_children_at_home; + } + + /** + * @return Returns the education property or <code>null</code> if not present. + */ + public String getEducation() { + checkDisposed(); + return this.education; + } + + /** + * Sets the education property to this instance. + */ + public void setEducation(final String education) { + checkDisposed(); + this.education = education; + } + + /** + * @return Returns the date_accnt_opened property or <code>null</code> if not present. + */ + public String getDate_accnt_opened() { + checkDisposed(); + return this.date_accnt_opened; + } + + /** + * Sets the date_accnt_opened property to this instance. + */ + public void setDate_accnt_opened(final String date_accnt_opened) { + checkDisposed(); + this.date_accnt_opened = date_accnt_opened; + } + + /** + * @return Returns the member_card property or <code>null</code> if not present. + */ + public String getMember_card() { + checkDisposed(); + return this.member_card; + } + + /** + * Sets the member_card property to this instance. + */ + public void setMember_card(final String member_card) { + checkDisposed(); + this.member_card = member_card; + } + + /** + * @return Returns the occupation property or <code>null</code> if not present. + */ + public String getOccupation() { + checkDisposed(); + return this.occupation; + } + + /** + * Sets the occupation property to this instance. + */ + public void setOccupation(final String occupation) { + checkDisposed(); + this.occupation = occupation; + } + + /** + * @return Returns the houseowner property or <code>null</code> if not present. + */ + public String getHouseowner() { + checkDisposed(); + return this.houseowner; + } + + /** + * Sets the houseowner property to this instance. + */ + public void setHouseowner(final String houseowner) { + checkDisposed(); + this.houseowner = houseowner; + } + + /** + * @return Returns the num_cars_owned property or <code>null</code> if not present. + */ + public int getNum_cars_owned() { + checkDisposed(); + return this.num_cars_owned; + } + + /** + * Sets the num_cars_owned property to this instance. + */ + public void setNum_cars_owned(final int num_cars_owned) { + checkDisposed(); + this.num_cars_owned = num_cars_owned; + } + + /** + * @return Returns the fullname property or <code>null</code> if not present. + */ + public String getFullname() { + checkDisposed(); + return this.fullname; + } + + /** + * Sets the fullname property to this instance. + */ + public void setFullname(final String fullname) { + checkDisposed(); + this.fullname = fullname; + } + + /** + * @return Returns the test property or <code>null</code> if not present. + */ + public String getTest() { + checkDisposed(); + return this.test; + } + + /** + * Sets the test property to this instance. + */ + public void setTest(final String test) { + checkDisposed(); + this.test = test; + } + + /** + * @return Returns an unmodifiable list of slips. + */ + public List<CashSlip> getSlips() { + checkDisposed(); + return Collections.unmodifiableList(internalGetSlips()); + } + + /** + * Sets the given slips to the object. Currently contained slips instances will be removed. + * + * @param slips the list of new instances + */ + public void setSlips(final List<CashSlip> slips) { + // remove the old cashSlip + for(CashSlip oldElement : new ArrayList<CashSlip>(this.internalGetSlips())){ + removeFromSlips(oldElement); + } + + // add the new cashSlip + for(CashSlip newElement : slips){ + addToSlips(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>CashSlip</code>s thereby lazy initializing it. + */ + public List<CashSlip> internalGetSlips() { + if (this.slips == null) { + this.slips = new ArrayList<CashSlip>(); + } + return this.slips; + } + + /** + * Adds the given cashSlip to this object. <p> + * Since the reference is a composition reference, the opposite reference (CashSlip.customer) + * of the cashSlip will be handled automatically and no further coding is required to keep them in sync. + * See {@link CashSlip#setCustomer(CashSlip)}. + * + */ + public void addToSlips(final CashSlip cashSlip) { + checkDisposed(); + cashSlip.setCustomer(this); + } + + /** + * Removes the given cashSlip from this object. <p> + * + */ + public void removeFromSlips(final CashSlip cashSlip) { + checkDisposed(); + cashSlip.setCustomer(null); + } + + /** + * For internal use only! + */ + public void internalAddToSlips(final CashSlip cashSlip) { + if(cashSlip == null) { + return; + } + + if(!internalGetSlips().contains(cashSlip)) { + internalGetSlips().add(cashSlip); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromSlips(final CashSlip cashSlip) { + internalGetSlips().remove(cashSlip); + } + + /** + * Calculates the value for the derived property foo + * + * @return foo The derived property value + */ + public String getFoo() { + return ((this.country + "_") + this.city); + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the slips + for(CashSlip oldElement : new ArrayList<CashSlip>(this.internalGetSlips())){ + removeFromSlips(oldElement); + } + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src/META-INF/persistence.xml b/org.eclipse.osbp.runtime.tests/src/META-INF/persistence.xml new file mode 100644 index 0000000..252aeed --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/META-INF/persistence.xml
@@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" + version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"> + + <persistence-unit name="testCarstore" + transaction-type="RESOURCE_LOCAL"> + <class>org.osbp.tests.entities.BaseID</class> + <class>org.osbp.tests.entities.BaseUUID</class> + + <class>org.osbp.tests.entities.Mcustomer</class> + <class>org.osbp.tests.entities.CashRegister</class> + <class>org.osbp.tests.entities.CashSlip</class> + <class>org.osbp.tests.entities.CashPosition</class> + <class>org.osbp.tests.entities.CashPayment</class> + <class>org.osbp.tests.entities.CashPaymentMethod</class> + + <class>org.osbp.tests.entities.CompanyRelationType</class> + <class>org.osbp.tests.entities.CompanyGroup</class> + <class>org.osbp.tests.entities.Company</class> + <class>org.osbp.tests.entities.Address</class> + <class>org.osbp.tests.entities.Department</class> + + <properties> + <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" /> + <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:model1;create=true" /> + <property name="javax.persistence.jdbc.user" value="test" /> + <property name="javax.persistence.jdbc.password" value="test" /> + + <!-- EclipseLink should create the database schema automatically --> + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> + <property name="eclipselink.create-ddl-jdbc-file-name" + value="createDDL_ddlGeneration.jdbc" /> + <property name="eclipselink.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc" /> + <property name="eclipselink.ddl-generation.output-mode" + value="both" /> + <property name="eclipselink.logging.level" value="FINEST" /> + </properties> + </persistence-unit> +</persistence> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractBean.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractBean.java new file mode 100644 index 0000000..cbac52a --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractBean.java
@@ -0,0 +1,95 @@ +/** + * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - initial API and implementation + */ +package org.eclipse.osbp.runtime.tests; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +/** + * Default implementation of value bean. Offerns {@link PropertyChangeSupport}. + */ +public class AbstractBean { + private final PropertyChangeSupport changeSupport = new PropertyChangeSupport( + this); + + public AbstractBean() { + } + + /** + * Adds the given property change listener to the change support. + * + * @param listener + * Listener to be added + * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + changeSupport.addPropertyChangeListener(listener); + } + + /** + * Adds the given property change listener to the change support. + * + * @param property + * Name of the property + * @param listener + * Listener to be added + * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(String property, + PropertyChangeListener listener) { + changeSupport.addPropertyChangeListener(property, listener); + } + + /** + * Removes the given property change listener from the change support. + * + * @param listener + * Listener to be removed + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + changeSupport.removePropertyChangeListener(listener); + } + + /** + * Removes the given property change listener from the change support. + * + * @param property + * Name of the property + * @param listener + * Listener to be removed + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(String property, + PropertyChangeListener listener) { + changeSupport.removePropertyChangeListener(property, listener); + } + + /** + * Fires the property changed event. + * + * @param property + * Name of the property + * @param oldValue + * The old value + * @param newValue + * The new value + * @see java.beans.PropertyChangeSupport#firePropertyChange(String, Object, + * Object) + */ + protected void firePropertyChanged(String property, Object oldValue, + Object newValue) { + changeSupport.firePropertyChange(property, oldValue, newValue); + } + +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractJPATest.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractJPATest.java new file mode 100644 index 0000000..edf3659 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/AbstractJPATest.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.osbp.runtime.tests; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.spi.PersistenceProvider; +import javax.persistence.spi.PersistenceProviderResolver; +import javax.persistence.spi.PersistenceProviderResolverHolder; + +import org.eclipse.persistence.config.PersistenceUnitProperties; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + +public class AbstractJPATest { + + protected Map<String, Object> properties = new HashMap<String, Object>(); + protected EntityManagerFactory emf; + + public void setUp() throws Exception { + PersistenceProviderResolverHolder + .setPersistenceProviderResolver(new PersistenceProviderResolver() { + private List<PersistenceProvider> providers = new ArrayList<PersistenceProvider>(); + + @Override + public List<PersistenceProvider> getPersistenceProviders() { + org.eclipse.persistence.jpa.PersistenceProvider provider = new org.eclipse.persistence.jpa.PersistenceProvider(); + providers.add(provider); + return providers; + } + + @Override + public void clearCachedProviders() { + providers.clear(); + } + }); + properties.put(PersistenceUnitProperties.CLASSLOADER, getClass() + .getClassLoader()); + + emf = Persistence.createEntityManagerFactory( + "testCarstore", properties); + Bundle bundle = FrameworkUtil.getBundle(AbstractJPATest.class); + bundle.getBundleContext().registerService(EntityManagerFactory.class, + emf, null); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Activator.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Activator.java new file mode 100644 index 0000000..b57ca36 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Activator.java
@@ -0,0 +1,97 @@ +/** + * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - initial API and implementation + */ +package org.eclipse.osbp.runtime.tests; + +import javax.persistence.EntityManagerFactory; + +import org.knowhowlab.osgi.testing.assertions.BundleAssert; +import org.knowhowlab.osgi.testing.assertions.ServiceAssert; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Activator implements BundleActivator { + + @SuppressWarnings("unused") + private static final Logger logger = LoggerFactory + .getLogger(Activator.class); + + private static Activator instance; + public static BundleContext context; + + /** + * @return the instance + */ + public static Activator getInstance() { + return instance; + } + + @Override + public void start(BundleContext context) throws Exception { + Activator.context = context; + instance = this; + + BundleAssert.setDefaultBundleContext(context); + ServiceAssert.setDefaultBundleContext(context); + + // BundleHelper.ensureSetup(); + } + + /** + * Returns the bundle with the given id. + * + * @param id + * @return + */ + public static Bundle findBundle(String id) { + for (Bundle bundle : context.getBundles()) { + if (bundle.getSymbolicName().equals(id)) { + return bundle; + } + } + return null; + } + + /** + * Returns the entity manager factory or <code>null</code>. + * + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static EntityManagerFactory getEMF() { + BundleContext context = FrameworkUtil.getBundle(Activator.class) + .getBundleContext(); + ServiceReference[] refs; + try { + refs = context.getServiceReferences( + EntityManagerFactory.class.getName(), + "(osgi.unit.name=dbDerby)"); + if (refs != null) { + return (EntityManagerFactory) context.getService(refs[0]); + } + } catch (InvalidSyntaxException e) { + throw new RuntimeException(e); + } + + return null; + } + + @Override + public void stop(BundleContext context) throws Exception { + Activator.context = null; + instance = null; + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Bar.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Bar.java new file mode 100644 index 0000000..d5448c7 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Bar.java
@@ -0,0 +1,168 @@ +/** + * + * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation + * + */ + package org.eclipse.osbp.runtime.tests; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Bar implements Serializable { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( + this); + + private boolean disposed; + + private String name; + + private Foo myfoo; + + /** + * Returns true, if the object is disposed. Disposed means, that it is + * prepared for garbage collection and may not be used anymore. Accessing + * objects that are already disposed will cause runtime exceptions. + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, + * PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener( + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, + * PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, + listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, + final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, + newValue); + } + + /** + * Checks whether the object is disposed. + * + * @throws RuntimeException + * if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions. + * If this object keeps composition containments, these will be disposed + * too. So the whole composition containment tree will be disposed on + * calling this method. + */ + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name + * - the property + * @throws RuntimeException + * if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name); + } + + /** + * Returns the myfoo property or <code>null</code> if not present. + */ + public Foo getMyfoo() { + checkDisposed(); + return this.myfoo; + } + +/** + * Sets the <code>myfoo</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>foo# + * mybars</code> of the <code>myfoo</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link foo#setMybars(foo) + * + * @param myfoo - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setMyfoo(final Foo myfoo) { + checkDisposed(); + if (this.myfoo != null) { + this.myfoo.internalRemoveFromMybars(this); + } + internalSetMyfoo(myfoo); + if (this.myfoo != null) { + this.myfoo.internalAddToMybars(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetMyfoo(final Foo myfoo) { + firePropertyChange("myfoo", this.myfoo, this.myfoo = myfoo); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/BarHashById.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/BarHashById.java new file mode 100644 index 0000000..b6d27f1 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/BarHashById.java
@@ -0,0 +1,168 @@ +/** + * + * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation + * + */ + package org.eclipse.osbp.runtime.tests; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; + +@SuppressWarnings("serial") +public class BarHashById implements Serializable { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( + this); + + private final String id; + + private boolean disposed; + + private String name; + + public BarHashById(String id) { + super(); + this.id = id; + } + + /** + * Returns true, if the object is disposed. Disposed means, that it is + * prepared for garbage collection and may not be used anymore. Accessing + * objects that are already disposed will cause runtime exceptions. + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, + * PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener( + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, + * PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, + listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, + final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, + newValue); + } + + /** + * Checks whether the object is disposed. + * + * @throws RuntimeException + * if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions. + * If this object keeps composition containments, these will be disposed + * too. So the whole composition containment tree will be disposed on + * calling this method. + */ + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name + * - the property + * @throws RuntimeException + * if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BarHashById other = (BarHashById) obj; + if (disposed != other.disposed) + return false; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/DefaultUI.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/DefaultUI.java new file mode 100644 index 0000000..f018b0c --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/DefaultUI.java
@@ -0,0 +1,161 @@ +/** + * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - initial API and implementation + */ +package org.eclipse.osbp.runtime.tests; + +import java.util.Properties; +import java.util.concurrent.Future; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.ServiceException; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinServletService; +import com.vaadin.server.VaadinSession; +import com.vaadin.shared.communication.PushMode; +import com.vaadin.ui.UI; +import com.vaadin.ui.UIDetachedException; + +@SuppressWarnings("serial") +public class DefaultUI extends UI { + + public DefaultUI() { + try { + VaadinSession session = new CustomVaadinSession( + new VaadinServletService(null, new CustomDeploymentConfiguration())); + session.lock(); + setSession(session); + VaadinSession.setCurrent(session); + UI.setCurrent(this); + + } catch (ServiceException e) { + throw new IllegalArgumentException(e); + } + } + + @Override + public void accessSynchronously(Runnable runnable) throws UIDetachedException { + runnable.run(); + } + + @Override + public Future<Void> access(Runnable runnable) { + runnable.run(); + return null; + } + + @Override + protected void init(VaadinRequest request) { + + } + + private class CustomVaadinSession extends VaadinSession { + + Lock lock = new ReentrantLock(); + + public CustomVaadinSession(VaadinService service) { + super(service); + } + + @Override + public Lock getLockInstance() { + return lock; + } + + } + + private static class CustomDeploymentConfiguration implements DeploymentConfiguration { + + @Override + public boolean isProductionMode() { + return false; + } + + @Override + public boolean isXsrfProtectionEnabled() { + return false; + } + + @Override + public boolean isSyncIdCheckEnabled() { + return false; + } + + @Override + public int getResourceCacheTime() { + return 0; + } + + @Override + public int getHeartbeatInterval() { + return 0; + } + + @Override + public boolean isCloseIdleSessions() { + return false; + } + + @Override + public PushMode getPushMode() { + return PushMode.DISABLED; + } + + @Override + public Properties getInitParameters() { + return new Properties(); + } + + @Override + public String getApplicationOrSystemProperty(String propertyName, String defaultValue) { + return null; + } + + @SuppressWarnings("deprecation") + @Override + public LegacyProperyToStringMode getLegacyPropertyToStringMode() { + return LegacyProperyToStringMode.DISABLED; + } + + @Override + public boolean isSendUrlsAsParameters() { + return false; + } + + @Override + public String getUIClassName() { + return null; + } + + @Override + public String getUIProviderClassName() { + return null; + } + + @Override + public String getWidgetset(String defaultValue) { + return null; + } + + @Override + public String getResourcesPath() { + return null; + } + + @Override + public String getClassLoaderName() { + return null; + } + + } + +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Foo.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Foo.java new file mode 100644 index 0000000..d98aeaa --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/Foo.java
@@ -0,0 +1,218 @@ +/** + * + * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation + * + */ + package org.eclipse.osbp.runtime.tests; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; + +@SuppressWarnings("serial") +public class Foo implements Serializable { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( + this); + + private boolean disposed; + + private String name; + + private List<Bar> mybars; + + /** + * Returns true, if the object is disposed. Disposed means, that it is + * prepared for garbage collection and may not be used anymore. Accessing + * objects that are already disposed will cause runtime exceptions. + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, + * PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener( + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, + * PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, + final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, + listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, + final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, + newValue); + } + + /** + * Checks whether the object is disposed. + * + * @throws RuntimeException + * if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions. + * If this object keeps composition containments, these will be disposed + * too. So the whole composition containment tree will be disposed on + * calling this method. + */ + public void dispose() { + if (isDisposed()) { + return; + } + try { + // Dispose all the composition references. + if (this.mybars != null) { + for (Bar bar : this.mybars) { + bar.dispose(); + } + this.mybars = null; + } + + } finally { + disposed = true; + } + + } + + /** + * Returns the name property or <code>null</code> if not present. + */ + public String getName() { + checkDisposed(); + return this.name; + } + + /** + * Sets the <code>name</code> property to this instance. + * + * @param name + * - the property + * @throws RuntimeException + * if instance is <code>disposed</code> + * + */ + public void setName(final String name) { + firePropertyChange("name", this.name, this.name = name); + } + + /** + * Returns an unmodifiable list of mybars. + */ + public List<Bar> getMybars() { + checkDisposed(); + return Collections.unmodifiableList(internalGetMybars()); + } + + /** + * Returns the list of <code>bar</code>s thereby lazy initializing it. For + * internal use only! + * + * @return list - the resulting list + * + */ + private List<Bar> internalGetMybars() { + if (this.mybars == null) { + this.mybars = new java.util.ArrayList<Bar>(); + } + return this.mybars; + } + + /** + * Adds the given bar to this object. + * <p> + * Since the reference is a composition reference, the opposite reference + * <code>bar#myfoo</code> of the <code>bar</code> will be handled + * automatically and no further coding is required to keep them in sync. + * <p> + * See {@link bar#setMyfoo(bar)}. + * + * @param bar + * - the property + * @throws RuntimeException + * if instance is <code>disposed</code> + * + */ + public void addToMybars(final Bar bar) { + checkDisposed(); + bar.setMyfoo(this); + } + + /** + * Removes the given bar from this object. + * <p> + * Since the reference is a cascading reference, the opposite reference + * (bar.myfoo) of the bar will be handled automatically and no further + * coding is required to keep them in sync. See {@link bar#setMyfoo(bar)}. + * + * @param bar + * - the property + * @throws RuntimeException + * if instance is <code>disposed</code> + * + */ + public void removeFromMybars(final Bar bar) { + checkDisposed(); + bar.setMyfoo(null); + } + + /** + * For internal use only! + */ + public void internalAddToMybars(final Bar bar) { + internalGetMybars().add(bar); + } + + /** + * For internal use only! + */ + public void internalRemoveFromMybars(final Bar bar) { + internalGetMybars().remove(bar); + } +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/ValueBean.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/ValueBean.java new file mode 100644 index 0000000..7eaddb0 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/ValueBean.java
@@ -0,0 +1,131 @@ +/** + * + * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation + * + */ + package org.eclipse.osbp.runtime.tests; + +import java.util.Date; + +public class ValueBean extends AbstractBean { + + private String value; + private boolean boolValue; + private Date dateValue; + private int intValue; + private long longValue; + private double doubleValue; + private float floatValue; + + public ValueBean(String value) { + super(); + this.value = value; + } + + public ValueBean(boolean value) { + super(); + this.boolValue = value; + } + + public ValueBean(Date value) { + super(); + this.dateValue = value; + } + + public ValueBean(int value) { + super(); + this.intValue = value; + } + + public ValueBean(long value) { + super(); + this.longValue = value; + } + + public ValueBean(double value) { + super(); + this.doubleValue = value; + } + + public ValueBean(float value) { + super(); + this.floatValue = value; + } + + /** + * @return the value + */ + public String getValue() { + return value; + } + + /** + * @param value + * the value to set + */ + public void setValue(String value) { + firePropertyChanged("value", this.value, this.value = value); + } + + public boolean isBoolValue() { + return boolValue; + } + + public void setBoolValue(boolean boolValue) { + firePropertyChanged("boolValue", this.boolValue, + this.boolValue = boolValue); + } + + public Date getDateValue() { + return dateValue; + } + + public void setDateValue(Date dateValue) { + firePropertyChanged("dateValue", this.dateValue, + this.dateValue = dateValue); + } + + public int getIntValue() { + return intValue; + } + + public void setIntValue(int intValue) { + firePropertyChanged("intValue", this.intValue, this.intValue = intValue); + } + + public long getLongValue() { + return longValue; + } + + public void setLongValue(long longValue) { + firePropertyChanged("longValue", this.longValue, + this.longValue = longValue); + } + + public double getDoubleValue() { + return doubleValue; + } + + public void setDoubleValue(double doubleValue) { + firePropertyChanged("doubleValue", this.doubleValue, + this.doubleValue = doubleValue); + } + + public float getFloatValue() { + return floatValue; + } + + public void setFloatValue(float floatValue) { + firePropertyChanged("floatValue", this.floatValue, + this.floatValue = floatValue); + } + +}
diff --git a/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/dtoandui/BoundCashTests.java b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/dtoandui/BoundCashTests.java new file mode 100644 index 0000000..55e8224 --- /dev/null +++ b/org.eclipse.osbp.runtime.tests/src/org/eclipse/osbp/runtime/tests/dtoandui/BoundCashTests.java
@@ -0,0 +1,198 @@ +/** + * + * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation + * + */ +package org.eclipse.osbp.runtime.tests.dtoandui; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Date; + +import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess; +import org.eclipse.osbp.ecview.core.common.beans.ISlot; +import org.eclipse.osbp.ecview.core.common.context.ContextException; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager; +import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet; +import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot; +import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlotListBindingEndpoint; +import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint; +import org.eclipse.osbp.ecview.core.common.model.core.YView; +import org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation; +import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout; +import org.eclipse.osbp.ecview.core.extension.model.extension.YTable; +import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory; +import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITableEditpart; +import org.eclipse.osbp.runtime.common.filter.IDTOService; +import org.eclipse.osbp.runtime.tests.AbstractJPATest; +import org.eclipse.osbp.runtime.tests.DefaultUI; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; +import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables; +import org.junit.Test; +import org.osbp.tests.dtos.CashPositionDto; +import org.osbp.tests.dtos.CashRegisterDto; +import org.osbp.tests.dtos.CashSlipDto; +import org.osbp.tests.dtos.McustomerDto; + +import com.vaadin.data.Container.Indexed; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.Table; +import com.vaadin.ui.UI; + +@SuppressWarnings("restriction") +public class BoundCashTests extends AbstractJPATest { + + private IDTOService<McustomerDto> customerService; + private IDTOService<CashRegisterDto> cashRegisterService; + private IDTOService<CashSlipDto> cashSlipService; + private IDTOService<CashPositionDto> cashSlipPosService; + + private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory(); + + private UI ui = new DefaultUI(); + private CssLayout rootLayout = new CssLayout(); + private YTable yTable; + private VaadinRenderer renderer; + private ITableEditpart table1Editpart; + private IViewContext viewContext; + private IFieldPresentation<Table> tablePresentation; + private Table table; + private Indexed indexedDs; + private YBindingSet yBindingSet; + private McustomerDto cust; + private CashSlipDto slip; + private CashPositionDto pos1; + private CashPositionDto pos2; + private YBeanSlot yBeanSlot; + private ISlot beanSlot; + + @Override + public void setUp() throws Exception { + super.setUp(); + + customerService = DtoServiceAccess.getService(McustomerDto.class); + cashRegisterService = DtoServiceAccess.getService(CashRegisterDto.class); + cashSlipService = DtoServiceAccess.getService(CashSlipDto.class); + cashSlipPosService = DtoServiceAccess.getService(CashPositionDto.class); + + setupView(); + createDatamodel(); + + // bind the slip + beanSlot.setValue(slip); + } + + private void setupView() throws ContextException { + + ui.setContent(rootLayout); + VaadinObservables.activateRealm(ui); + + // create a view + // + YView yView = factory.createView(); + YGridLayout yLayout = factory.createGridLayout(); + yView.setContent(yLayout); + yTable = factory.createTable(); + yTable.setType(CashPositionDto.class); + yLayout.getElements().add(yTable); + + yBindingSet = yView.getOrCreateBindingSet(); + yBeanSlot = yView.addBeanSlot("ds", CashSlipDto.class); + + YBeanSlotListBindingEndpoint ySlotListBinding = factory.createBeanSlotListBindingEndpoint(); + ySlotListBinding.setBeanSlot(yBeanSlot); + ySlotListBinding.setCollectionType(CashPositionDto.class); + ySlotListBinding.setAttributePath("positions"); + + YEmbeddableCollectionEndpoint yTableEndpoint = yTable.createCollectionEndpoint(); + yBindingSet.addBinding(ySlotListBinding, yTableEndpoint); + + renderer = new VaadinRenderer(); + viewContext = renderer.render(rootLayout, yView, null); + + table1Editpart = DelegatingEditPartManager.getInstance().getEditpart(viewContext, yTable); + tablePresentation = table1Editpart.getPresentation(); + table = (Table) tablePresentation.getWidget(); + + indexedDs = (Indexed) table.getContainerDataSource(); + beanSlot = viewContext.getBeanSlot("ds"); + + } + + private void createDatamodel() { + + int custId = 10; + + // create customer + cust = new McustomerDto(); + cust.setId(custId); + cust.setFullname("customer1"); + customerService.update(cust); + cust = customerService.get(custId); + + slip = new CashSlipDto(); + slip.setCashier("Jörg"); + slip.setCustomer(cust); + slip.setNow(new Date()); + slip.setCurrentDay(new Date().toString()); + slip.setSerial(10l); + // slip.setRegister(cashRegister); + slip.setTotal(100d); + cashSlipService.update(slip); + slip = cashSlipService.get(slip.getId()); + + pos1 = new CashPositionDto(); + pos1.setPrice(1000d); + pos1.setQuantity(10d); + slip.addToPositions(pos1); + cashSlipPosService.update(pos1); + + pos2 = new CashPositionDto(); + pos2.setPrice(2000d); + pos2.setQuantity(20d); + slip.addToPositions(pos2); + cashSlipPosService.update(pos2); + } + + @Test + public void testBindCashPosition() throws Exception { + setUp(); + + assertEquals(2, slip.getPositions().size()); + assertEquals(2, indexedDs.size()); + + CashPositionDto pos3 = new CashPositionDto(); + pos3.setPrice(3000d); + pos3.setQuantity(30d); + slip.addToPositions(pos3); + + assertEquals(3, slip.getPositions().size()); + assertEquals(3, indexedDs.size()); + + CashPositionDto pos4 = new CashPositionDto(); + pos4.setPrice(4000d); + pos4.setQuantity(40d); + slip.addToPositions(pos4); + + assertEquals(4, slip.getPositions().size()); + assertEquals(4, indexedDs.size()); + + slip.removeFromPositions(pos3); + + assertEquals(3, slip.getPositions().size()); + assertEquals(3, indexedDs.size()); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.classpath b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.classpath new file mode 100644 index 0000000..43b9862 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF index ea7f799..004967f 100644 --- a/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF
@@ -4,11 +4,11 @@ Bundle-SymbolicName: org.eclipse.osbp.runtime.web.atmosphere.fragment Bundle-Version: 0.9.0.qualifier Bundle-Vendor: Eclipse OSBP -Fragment-Host: com.vaadin.external.atmosphere.runtime;bundle-version="2.2.7.vaadin1" +Fragment-Host: com.vaadin.external.atmosphere.runtime;bundle-version="2.2.9.vaadin2" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: javax.servlet;version="2.6.0", - javax.servlet.annotation;version="2.6.0", - javax.servlet.descriptor;version="2.6.0", - javax.servlet.http;version="2.6.0", - javax.servlet.resources;version="2.6.0" -Require-Bundle: org.eclipse.jetty.websocket;bundle-version="8.1.16" +Require-Bundle: org.eclipse.jetty.websocket.api;bundle-version="9.4.1", + javax.servlet;bundle-version="[3.1.0,3.2.0)", + org.eclipse.jetty.server;bundle-version="9.4.1", + org.eclipse.jetty.websocket.common;bundle-version="9.4.1", + org.eclipse.jetty.websocket.server;bundle-version="9.4.1", + org.eclipse.jetty.websocket.servlet;bundle-version="9.4.1"
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.classpath b/org.eclipse.osbp.runtime.web.common.tests/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF index 83b5abd..d4b2110 100644 --- a/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ org.junit;bundle-version="4.10.0", org.eclipse.equinox.preferences;bundle-version="3.5.0", org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Eclipse OSBP Service-Component: OSGI-INF/*.xml Import-Package: org.eclipse.osgi.service.datalocation;version="1.3.0",
diff --git a/org.eclipse.osbp.runtime.web.common/.classpath b/org.eclipse.osbp.runtime.web.common/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.common/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF index 6263d80..c785029 100644 --- a/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.osbp.runtime.web.common Bundle-Version: 0.9.0.qualifier Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Eclipse OSBP Import-Package: org.osgi.service.component;version="1.2.0", org.osgi.service.prefs;version="1.1.1"
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.classpath b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.classpath new file mode 100644 index 0000000..46cec6e --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.7"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f42de36 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF index af5bf74..a498e7d 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF
@@ -4,8 +4,8 @@ Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests Bundle-Version: 0.9.0.qualifier Bundle-ClassPath: . -Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.classpath b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.classpath new file mode 100644 index 0000000..14129a1 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.classpath
@@ -0,0 +1,6 @@ +<?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.7"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f42de36 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF index 06edf04..9bdd8ba 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF
@@ -4,8 +4,8 @@ Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui Bundle-Version: 0.9.0.qualifier Bundle-ClassPath: . -Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", @@ -21,7 +21,7 @@ org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)", - com.vaadin.client-compiled;bundle-version="[7.5.7,7.7.0)" + com.vaadin.client-compiled;bundle-version="[7.7.6,7.8.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-Vendor: Eclipse OSBP Import-Package: javax.servlet;version="2.6.0",
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.classpath b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.classpath new file mode 100644 index 0000000..46cec6e --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.7"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f42de36 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF index f4801f7..29b6f8c 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF
@@ -7,8 +7,8 @@ Require-Bundle: org.junit;bundle-version="4.10.0", org.knowhowlab.osgi.testing.assertions;bundle-version="[1.3.0,1.3.1)", org.knowhowlab.osgi.testing.utils;bundle-version="[1.2.2,1.2.3)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", @@ -28,7 +28,7 @@ org.jsoup;bundle-version="1.7.2", org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)", org.slf4j.api;bundle-version="1.7.2", - org.eclipse.osbp.runtime.designer.api;bundle-version="0.9.0", + org.eclipse.osbp.runtime.designer.api;bundle-version="[0.9.0,0.10.0)", org.eclipse.equinox.ds;bundle-version="1.4.200" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;version="0.9.0",
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java index a867174..652f080 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java
@@ -31,8 +31,8 @@ VaadinSession session = new CustomVaadinSession( new VaadinServletService(null, new CustomDeploymentConfiguration())); + session.lock(); setSession(session); - VaadinSession.setCurrent(session); } catch (ServiceException e) {
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.classpath b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project index a635bf8..4f55d44 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project
@@ -36,11 +36,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF index 877cb86..1d882c2 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF
@@ -6,13 +6,13 @@ Bundle-Version: 0.9.0.qualifier Require-Bundle: org.eclipse.osbp.ecview.core.extension.editparts;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.eclipse.osbp.ecview.core.extension.model;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)";visibility:=reexport, - com.vaadin.client;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)";visibility:=reexport, + com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", - org.eclipse.core.databinding;bundle-version="[1.4.2,1.5.0)", - org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)", - org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)", + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)", org.eclipse.emf.databinding;bundle-version="[1.3.0,1.4.0)", org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)", com.ibm.icu;bundle-version="50.1.1", @@ -27,13 +27,18 @@ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)", org.jsoup;bundle-version="1.7.2", - org.eclipse.osbp.vaadin.addons.absolutelayout;bundle-version="0.9.0", - dragdroplayouts.osgi;bundle-version="1.1.3", - org.eclipse.osbp.vaadin.addons.suggesttext;bundle-version="0.9.0", + org.eclipse.osbp.vaadin.addons.absolutelayout;bundle-version="[0.9.0,0.10.0)", + dragdroplayouts.osgi;bundle-version="[1.3.2,1.3.3)", + org.eclipse.osbp.vaadin.addons.suggesttext;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.designer.api;bundle-version="[0.9.0,0.10.0)", org.apache.commons.lang3;bundle-version="3.4.0", - org.eclipse.osbp.ui.api -Import-Package: org.osgi.framework;version="1.7.0", + org.eclipse.osbp.ui.api;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.dsl.dto.xtext;bundle-version="0.9.0", + org.eclipse.osbp.blob;bundle-version="0.9.0", + org.eclipse.osbp.vaadin.addons.kanban;bundle-version="0.9.0" +Import-Package: org.eclipse.osbp.ecview.extension.api;version="0.9.0", + org.osgi.framework;version="1.7.0", + org.osgi.service.component.annotations;version="1.2.0", org.slf4j;version="1.6.4" Export-Package: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin; uses:="com.vaadin.data,
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory.xml similarity index 73% rename from org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml rename to org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory.xml index 60f1463..36c83da 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.factory"> - <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory"/> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory"> <service> <provide interface="org.eclipse.osbp.ecview.core.common.presentation.IPresentationFactory"/> </service> -</scr:component> + <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory"/> +</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider.xml similarity index 75% rename from org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml rename to org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider.xml index 0b681e9..cc00c58 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider.xml
@@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.service.provider"> - <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider"/> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider"> + <property name="ecview.serviceprovider.level" type="String" value="view"/> <service> <provide interface="org.eclipse.osbp.ecview.core.common.services.IServiceProvider"/> </service> - <property name="ecview.serviceprovider.level" type="String" value="view"/> -</scr:component> + <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider"/> +</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java index 60cafd5..761072b 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java
@@ -31,9 +31,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.vaadin.client.Focusable; import com.vaadin.data.Validator; import com.vaadin.data.util.converter.Converter; import com.vaadin.server.ErrorMessage; +import com.vaadin.server.VaadinSession; +import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Component; import com.vaadin.ui.Field; @@ -62,6 +65,10 @@ /** The converter. */ private Converter<?, ?> converter; + public AbstractFieldWidgetPresenter() { + super(null); + } + /** * Instantiates a new abstract field widget presenter. * @@ -273,7 +280,7 @@ casted.setConverter(getConverter()); } } - + super.initialize(field, getCastedModel()); } @@ -367,5 +374,4 @@ super.internalDispose(); } - }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java index f426453..592b85e 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java
@@ -12,23 +12,27 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.List; import org.eclipse.osbp.ecview.core.common.dnd.IDropTargetStrategy; import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart; import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart; +import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; import org.eclipse.osbp.ecview.core.common.model.core.YElement; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable; +import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableEvent; import org.eclipse.osbp.ecview.core.common.model.core.YLayout; import org.eclipse.osbp.ecview.core.common.model.core.YMarginable; import org.eclipse.osbp.ecview.core.common.model.core.YSpacingable; import org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation; -import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator; import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent; import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType; import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener; +import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator; import com.vaadin.ui.Component; +import com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier; import com.vaadin.ui.Layout.MarginHandler; import com.vaadin.ui.Layout.SpacingHandler; @@ -43,9 +47,8 @@ * @param <A> * the generic type */ -public abstract class AbstractLayoutPresenter<A extends Component> extends - AbstractVaadinWidgetPresenter<A> implements ILayoutPresentation<A>, - IDesignListener { +public abstract class AbstractLayoutPresenter<A extends Component> extends AbstractVaadinWidgetPresenter<A> + implements ILayoutPresentation<A>, IDesignListener { /** The children. */ private List<IEmbeddableEditpart> children; @@ -72,33 +75,48 @@ return (ILayoutEditpart) super.getEditpart(); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#getModel() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#getModel() */ @Override public YLayout getModel() { return (YLayout) getEditpart().getModel(); } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#getChildren() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * getChildren() */ @Override public List<IEmbeddableEditpart> getChildren() { - return children != null ? Collections.unmodifiableList(children) - : Collections.<IEmbeddableEditpart> emptyList(); + return children != null ? Collections.unmodifiableList(children) : Collections.<IEmbeddableEditpart>emptyList(); } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#contains(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * contains(org.eclipse.osbp.ecview.core.common.editpart. + * IEmbeddableEditpart) */ @Override public boolean contains(IEmbeddableEditpart presentation) { return children != null && children.contains(presentation); } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#add(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#add( + * org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart) */ @Override public void add(IEmbeddableEditpart editPart) { @@ -125,8 +143,12 @@ } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#remove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * remove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart) */ @Override public void remove(IEmbeddableEditpart editPart) { @@ -151,8 +173,13 @@ } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#insert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * insert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, + * int) */ @Override public void insert(IEmbeddableEditpart editPart, int index) { @@ -161,8 +188,7 @@ int currentIndex = children.indexOf(editPart); if (currentIndex > -1 && currentIndex != index) { throw new RuntimeException( - String.format( - "Insert at index %d not possible since presentation already contained at index %d", + String.format("Insert at index %d not possible since presentation already contained at index %d", index, currentIndex)); } @@ -187,21 +213,22 @@ } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#move(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#move + * (org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int) */ @Override public void move(IEmbeddableEditpart editpart, int index) { if (children == null) { - throw new RuntimeException( - "Move not possible. No children present."); + throw new RuntimeException("Move not possible. No children present."); } if (!children.contains(editpart)) { throw new RuntimeException( - String.format( - "Move to index %d not possible since presentation not added yet!", - index)); + String.format("Move to index %d not possible since presentation not added yet!", index)); } int currentIndex = children.indexOf(editpart); @@ -226,11 +253,32 @@ * The new index where the control should be located after the * move operation. */ - protected void internalMove(IEmbeddableEditpart presentation, int oldIndex, - int newIndex) { + protected void internalMove(IEmbeddableEditpart presentation, int oldIndex, int newIndex) { } + protected void initialize(Component component, YElement model) { + + super.initialize(component, model); + + if (component instanceof ComponentAttachDetachNotifier && model instanceof YLayout) { + ((ComponentAttachDetachNotifier) component).addComponentAttachListener(e -> { + YEmbeddableEvent event = CoreModelFactory.eINSTANCE.createYEmbeddableEvent(); + event.setTime(new Date()); + event.setEmbeddable((YEmbeddable) getModel()); + event.setRawEvent(e); + ((YLayout) model).setLastComponentAttach(event); + }); + ((ComponentAttachDetachNotifier) component).addComponentDetachListener(e -> { + YEmbeddableEvent event = CoreModelFactory.eINSTANCE.createYEmbeddableEvent(); + event.setTime(new Date()); + event.setEmbeddable((YEmbeddable) getModel()); + event.setRawEvent(e); + ((YLayout) model).setLastComponentDetach(event); + }); + } + } + /** * Returns true, if rendering should not be done. * @@ -240,8 +288,13 @@ return renderLock; } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable) + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core. + * YEmbeddable) */ @Override public void updateCellStyle(YEmbeddable child) { @@ -267,8 +320,12 @@ } } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#notify(org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#notify(org.eclipse.osbp.runtime.designer. + * api.IDesignerService.DesignEvent) */ @Override public void notify(DesignEvent event) { @@ -285,15 +342,12 @@ } } - IWidgetDesignConfigurator service = getViewContext().getService( - IWidgetDesignConfigurator.class.getName()); + IWidgetDesignConfigurator service = getViewContext().getService(IWidgetDesignConfigurator.class.getName()); if (service != null) { if (event.getType() == EventType.ENABLED) { - service.configure(getWidget(), (YEmbeddable) getCastedModel(), - true); + service.configure(getWidget(), (YEmbeddable) getCastedModel(), true); } else { - service.configure(getWidget(), (YEmbeddable) getCastedModel(), - false); + service.configure(getWidget(), (YEmbeddable) getCastedModel(), false); } } } @@ -321,6 +375,8 @@ } setupDropTarget(component, (YLayout) model); + + initialize(component, model); } /** @@ -332,30 +388,34 @@ * the y layout */ protected void setupDropTarget(Component component, YLayout yLayout) { - IDropTargetStrategy strategy = getViewContext().getService( - IDropTargetStrategy.class.getName()); + IDropTargetStrategy strategy = getViewContext().getService(IDropTargetStrategy.class.getName()); if (strategy != null) { strategy.setupDropTarget(getViewContext(), component, yLayout); } } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#updateSpacings() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation# + * updateSpacings() */ @Override public void updateSpacings() { if (getModel() instanceof YSpacingable) { - ((SpacingHandler) getWidget()) - .setSpacing(((YSpacingable) getModel()).isSpacing()); + ((SpacingHandler) getWidget()).setSpacing(((YSpacingable) getModel()).isSpacing()); } if (getModel() instanceof YMarginable) { - ((MarginHandler) getWidget()).setMargin(((YMarginable) getModel()) - .isMargin()); + ((MarginHandler) getWidget()).setMargin(((YMarginable) getModel()).isMargin()); } } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalDispose() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#internalDispose() */ @Override protected void internalDispose() {
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java index b20ade6..edf1c4f 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java
@@ -10,6 +10,7 @@ */ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common; +import java.util.Date; import java.util.HashSet; import java.util.Locale; import java.util.Set; @@ -35,12 +36,17 @@ import org.eclipse.osbp.ecview.core.common.context.IViewContext; import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart; import org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent; +import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage; +import org.eclipse.osbp.ecview.core.common.model.core.YBlurNotifier; +import org.eclipse.osbp.ecview.core.common.model.core.YContextClickEvent; import org.eclipse.osbp.ecview.core.common.model.core.YEditable; import org.eclipse.osbp.ecview.core.common.model.core.YElement; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint; +import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableEvent; import org.eclipse.osbp.ecview.core.common.model.core.YEnable; +import org.eclipse.osbp.ecview.core.common.model.core.YFocusNotifier; import org.eclipse.osbp.ecview.core.common.model.core.YFocusable; import org.eclipse.osbp.ecview.core.common.model.core.YVisibleable; import org.eclipse.osbp.ecview.core.common.model.core.util.CoreModelUtil; @@ -77,6 +83,9 @@ import com.vaadin.data.Property.ValueChangeNotifier; import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.Converter.ConversionException; +import com.vaadin.event.ContextClickEvent.ContextClickNotifier; +import com.vaadin.event.FieldEvents.BlurNotifier; +import com.vaadin.event.FieldEvents.FocusNotifier; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractSelect; import com.vaadin.ui.Button; @@ -94,14 +103,12 @@ * @param <A> * the generic type */ -@SuppressWarnings("restriction") -public abstract class AbstractVaadinWidgetPresenter<A extends Component> - extends AbstractDisposable implements IWidgetPresentation<A>, - ILocaleChangedService.LocaleListener { +@SuppressWarnings({ "restriction", "rawtypes" }) +public abstract class AbstractVaadinWidgetPresenter<A extends Component> extends AbstractDisposable + implements IWidgetPresentation<A>, ILocaleChangedService.LocaleListener { /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(AbstractVaadinWidgetPresenter.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractVaadinWidgetPresenter.class); /** * See {@link IConstants#CSS_CLASS_CONTROL_BASE}. @@ -137,6 +144,8 @@ private AbstractVaadinWidgetPresenter<A>.LabelAdapter labelAdapter; + private Component component; + /** * Instantiates a new abstract vaadin widget presenter. * @@ -234,6 +243,18 @@ */ protected abstract void doUpdateLocale(Locale locale); + protected void doSetStyle(String style) { + if (component != null && style != null) { + component.addStyleName(style); + } + } + + protected void doUnSetStyle(String style) { + if (component != null && style != null) { + component.removeStyleName(style); + } + } + /* * (non-Javadoc) * @@ -306,8 +327,9 @@ * the model */ protected void setupComponent(Component component, YElement model) { - IInitializerService service = getViewContext().getService( - IInitializerService.class.getName()); + this.component = component; + + IInitializerService service = getViewContext().getService(IInitializerService.class.getName()); if (service != null) { service.initialize(component, model); } @@ -320,8 +342,7 @@ IWidgetDesignConfigurator cService = getViewContext() .getService(IWidgetDesignConfigurator.class.getName()); if (cService != null && getWidget() != null) { - cService.configure(getWidget(), (YEmbeddable) getModel(), - designService.isDesignMode()); + cService.configure(getWidget(), (YEmbeddable) getModel(), designService.isDesignMode()); } } } @@ -347,11 +368,9 @@ * the event */ protected void configureForDesignMode(DesignEvent event) { - IWidgetDesignConfigurator service = getViewContext().getService( - IWidgetDesignConfigurator.class.getName()); + IWidgetDesignConfigurator service = getViewContext().getService(IWidgetDesignConfigurator.class.getName()); if (service != null && getWidget() != null) { - service.configure(getWidget(), (YEmbeddable) getModel(), - event.getType() == EventType.ENABLED); + service.configure(getWidget(), (YEmbeddable) getModel(), event.getType() == EventType.ENABLED); } } @@ -365,8 +384,7 @@ * @param container * the container */ - protected void createBindings(YEmbeddable yEmbeddable, - AbstractComponent widget, AbstractComponent container) { + protected void createBindings(YEmbeddable yEmbeddable, AbstractComponent widget, AbstractComponent container) { ensureBindingManager(); applyDefaults(yEmbeddable); @@ -381,8 +399,7 @@ } if (yEmbeddable instanceof YEditable) { - registerBinding(createBindingsEditable((YEditable) yEmbeddable, - widget)); + registerBinding(createBindingsEditable((YEditable) yEmbeddable, widget)); } // createBindingsCaption(yEmbeddable, widget); @@ -398,8 +415,7 @@ * the model * @return Binding - the created binding */ - protected Binding createBindings(IObservableValue target, - IObservableValue model) { + protected Binding createBindings(IObservableValue target, IObservableValue model) { ensureBindingManager(); return bindingManger.bindValue(target, model); @@ -418,12 +434,10 @@ * the model to target * @return Binding - the created binding */ - protected Binding createBindings(IObservableValue target, - IObservableValue model, UpdateValueStrategy targetToModel, + protected Binding createBindings(IObservableValue target, IObservableValue model, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { ensureBindingManager(); - return bindingManger.bindValue(target, model, targetToModel, - modelToTarget); + return bindingManger.bindValue(target, model, targetToModel, modelToTarget); } /** @@ -435,8 +449,7 @@ * the model * @return Binding - the created binding */ - protected Binding createBindings(IObservableList target, - IObservableList model) { + protected Binding createBindings(IObservableList target, IObservableList model) { ensureBindingManager(); return bindingManger.bindList(target, model); @@ -448,9 +461,7 @@ protected void ensureBindingManager() { if (bindingManger == null) { bindingManger = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); } } @@ -463,15 +474,12 @@ * the abstract component * @return Binding - the created binding */ - protected Binding createBindingsEditable(YEditable yEditable, - AbstractComponent abstractComponent) { + protected Binding createBindingsEditable(YEditable yEditable, AbstractComponent abstractComponent) { ensureBindingManager(); if (abstractComponent instanceof Property.ReadOnlyStatusChangeNotifier) { - return bindingManger.bindReadonly(yEditable, - (Property.ReadOnlyStatusChangeNotifier) abstractComponent); + return bindingManger.bindReadonly(yEditable, (Property.ReadOnlyStatusChangeNotifier) abstractComponent); } else { - return bindingManger.bindReadonlyOneway(yEditable, - abstractComponent); + return bindingManger.bindReadonlyOneway(yEditable, abstractComponent); } } @@ -497,8 +505,7 @@ * the abstract component * @return Binding - the created binding */ - protected Binding createBindingsVisiblility(YVisibleable yVisibleable, - AbstractComponent abstractComponent) { + protected Binding createBindingsVisiblility(YVisibleable yVisibleable, AbstractComponent abstractComponent) { ensureBindingManager(); return bindingManger.bindVisible(yVisibleable, abstractComponent); } @@ -512,12 +519,9 @@ * the abstract component * @return Binding - the created binding */ - protected Binding createBindingsEnabled(YEnable yEnable, - AbstractComponent abstractComponent) { + protected Binding createBindingsEnabled(YEnable yEnable, AbstractComponent abstractComponent) { IBindingManager bindingManger = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); // bind enabled return bindingManger.bindEnabled(yEnable, abstractComponent); @@ -535,8 +539,7 @@ * the field * @return Binding - the created binding */ - protected Binding createBindings_Value(EObject model, - EStructuralFeature modelFeature, Field<?> field) { + protected Binding createBindings_Value(EObject model, EStructuralFeature modelFeature, Field<?> field) { return createBindingsValue(model, modelFeature, field, null, null); } @@ -555,21 +558,15 @@ * the model to target * @return Binding - the created binding */ - protected Binding createBindingsValue(EObject model, - EStructuralFeature modelFeature, Field<?> field, + protected Binding createBindingsValue(EObject model, EStructuralFeature modelFeature, Field<?> field, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeValue(field); - return bindingManager.bindValue(uiObservable, modelObservable, - targetToModel, modelToTarget); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeValue(field); + return bindingManager.bindValue(uiObservable, modelObservable, targetToModel, modelToTarget); } return null; } @@ -589,18 +586,13 @@ * the model to target * @return Binding - the created binding */ - protected Binding createBindingsButtonImage(EObject model, - EStructuralFeature modelFeature, Button field) { + protected Binding createBindingsButtonImage(EObject model, EStructuralFeature modelFeature, Button field) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeIcon(field); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeIcon(field); return bindingManager.bindValue(uiObservable, modelObservable, new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); @@ -621,18 +613,14 @@ * the property * @return the binding */ - protected Binding createBindingsByAccessor(EObject model, - EStructuralFeature modelFeature, Field<?> field, String property) { + protected Binding createBindingsByAccessor(EObject model, EStructuralFeature modelFeature, Field<?> field, + String property) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinProperties.accessor( - Slider.class, property).observe(field); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinProperties.accessor(Slider.class, property).observe(field); return bindingManager.bindValue(uiObservable, modelObservable, new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); @@ -640,6 +628,19 @@ return null; } + protected Binding createBindingsByAccessor(EObject model, EStructuralFeature modelFeature, Object field, + String property, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { + IBindingManager bindingManager = getViewContext() + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); + if (bindingManager != null) { + // bind the value of yText to textRidget + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinProperties.accessor(field.getClass(), property).observe(field); + return bindingManager.bindValue(uiObservable, modelObservable, targetToModel, modelToTarget); + } + return null; + } + /** * Creates a binding for the value attribute from the ECView-UI-model to the * UI element. @@ -652,8 +653,7 @@ * the field * @return Binding - the created binding */ - protected Binding createBindingsButtonClick(EObject model, - EStructuralFeature modelFeature, Button field) { + protected Binding createBindingsButtonClick(EObject model, EStructuralFeature modelFeature, Button field) { return createBindingsButtonClick(model, modelFeature, field, null, null); } @@ -672,21 +672,15 @@ * the model to target * @return Binding - the created binding */ - protected Binding createBindingsButtonClick(EObject model, - EStructuralFeature modelFeature, Button field, + protected Binding createBindingsButtonClick(EObject model, EStructuralFeature modelFeature, Button field, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeButtonClick(field); - return bindingManager.bindValue(uiObservable, modelObservable, - targetToModel, modelToTarget); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeButtonClick(field); + return bindingManager.bindValue(uiObservable, modelObservable, targetToModel, modelToTarget); } return null; } @@ -703,8 +697,7 @@ * the field * @return Binding - the created binding */ - protected Binding createBindings_Value(EObject model, - EStructuralFeature modelFeature, ValueChangeNotifier field) { + protected Binding createBindings_Value(EObject model, EStructuralFeature modelFeature, ValueChangeNotifier field) { return createBindingsValue(model, modelFeature, field, null, null); } @@ -723,21 +716,15 @@ * the model to target * @return Binding - the created binding */ - protected Binding createBindingsValue(EObject model, - EStructuralFeature modelFeature, ValueChangeNotifier field, + protected Binding createBindingsValue(EObject model, EStructuralFeature modelFeature, ValueChangeNotifier field, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeValue(field); - return bindingManager.bindValue(uiObservable, modelObservable, - targetToModel, modelToTarget); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeValue(field); + return bindingManager.bindValue(uiObservable, modelObservable, targetToModel, modelToTarget); } return null; } @@ -758,19 +745,14 @@ * the type of selected object * @return Binding - the created binding */ - protected Binding createBindingsSelection(EObject model, - EStructuralFeature modelFeature, final AbstractSelect field, - Class<?> type) { + protected Binding createBindingsSelection(EObject model, EStructuralFeature modelFeature, + final AbstractSelect field, Class<?> type) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeSingleSelection(field, type); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeSingleSelection(field, type); // create a modelToTarget update strategy with a validator // @@ -788,8 +770,7 @@ Converter converter = field.getConverter(); if (converter != null) { try { - convertedValue = converter.convertToPresentation( - value, converter.getPresentationType(), + convertedValue = converter.convertToPresentation(value, converter.getPresentationType(), getLocale()); } catch (ConversionException e) { LOGGER.error("{}", e); @@ -804,16 +785,14 @@ } }); - final Binding binding = bindingManager.bindValue(uiObservable, - modelObservable, null, modelToTarget); + final Binding binding = bindingManager.bindValue(uiObservable, modelObservable, null, modelToTarget); registerBinding(binding); // now bind the validation state to an observable value. If the // doSetValue is called, we check whether the set operation was // successfully. Otherwise we send the target value back to the // model. - Binding validationBinding = bindingManager.bindValue( - binding.getValidationStatus(), + Binding validationBinding = bindingManager.bindValue(binding.getValidationStatus(), new AbstractObservableValue() { @Override @@ -857,22 +836,16 @@ * the type contained in the selection result * @return Binding - the created binding */ - protected Binding createBindingsMultiSelection(EObject model, - EStructuralFeature modelFeature, final AbstractSelect field, - Class<?> collectionType) { + protected Binding createBindingsMultiSelection(EObject model, EStructuralFeature modelFeature, + final AbstractSelect field, Class<?> collectionType) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableList modelObservable = EMFProperties.list(modelFeature) - .observe(getModel()); - IVaadinObservableList uiObservable = VaadinObservables - .observeMultiSelectionAsList(field, collectionType); + IObservableList modelObservable = EMFProperties.list(modelFeature).observe(getModel()); + IVaadinObservableList uiObservable = VaadinObservables.observeMultiSelectionAsList(field, collectionType); - final Binding binding = bindingManager.bindList(uiObservable, - modelObservable, null, null); + final Binding binding = bindingManager.bindList(uiObservable, modelObservable, null, null); registerBinding(binding); return binding; @@ -894,11 +867,9 @@ * the type of the collection contents * @return Binding - the created binding */ - protected Binding createBindings_ContainerContents(EObject model, - EStructuralFeature modelFeature, + protected Binding createBindings_ContainerContents(EObject model, EStructuralFeature modelFeature, Container.ItemSetChangeNotifier field, Class<?> collectionType) { - return createBindingsContainerContents(model, modelFeature, field, - collectionType, null, null); + return createBindingsContainerContents(model, modelFeature, field, collectionType, null, null); } /** @@ -919,55 +890,37 @@ * the update strategy * @return Binding - the created binding */ - protected Binding createBindingsContainerContents(EObject model, - EStructuralFeature modelFeature, - Container.ItemSetChangeNotifier field, Class<?> collectionType, - UpdateListStrategy targetToModel, UpdateListStrategy modelToTarget) { + protected Binding createBindingsContainerContents(EObject model, EStructuralFeature modelFeature, + Container.ItemSetChangeNotifier field, Class<?> collectionType, UpdateListStrategy targetToModel, + UpdateListStrategy modelToTarget) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableList modelObservable = EMFProperties.list(modelFeature) - .observe(getModel()); - IObservableList uiObservable = VaadinObservables - .observeContainerItemSetContents(field, collectionType); - return bindingManager.bindList(uiObservable, modelObservable, - targetToModel, modelToTarget); + IObservableList modelObservable = EMFProperties.list(modelFeature).observe(getModel()); + IObservableList uiObservable = VaadinObservables.observeContainerItemSetContents(field, collectionType); + return bindingManager.bindList(uiObservable, modelObservable, targetToModel, modelToTarget); } return null; } - protected Binding createBindingsContainerContents(EObject model, - EStructuralFeature modelFeature, - Container.ItemSetChangeNotifier field, Class<?> collectionType, - boolean containerReadonly) { + protected Binding createBindingsContainerContents(EObject model, EStructuralFeature modelFeature, + Container.ItemSetChangeNotifier field, Class<?> collectionType, boolean containerReadonly) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableList modelObservable = EMFProperties.list(modelFeature) - .observe(getModel()); - IObservableList uiObservable = VaadinObservables - .observeContainerItemSetContents(field, collectionType); + IObservableList modelObservable = EMFProperties.list(modelFeature).observe(getModel()); + IObservableList uiObservable = VaadinObservables.observeContainerItemSetContents(field, collectionType); if (containerReadonly) { - return bindingManager - .bindList(uiObservable, modelObservable, - new UpdateListStrategy( - UpdateListStrategy.POLICY_UPDATE), - new UpdateListStrategy( - UpdateListStrategy.POLICY_NEVER)); + return bindingManager.bindList(uiObservable, modelObservable, + new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE), + new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER)); } else { - return bindingManager - .bindList(uiObservable, modelObservable, - new UpdateListStrategy( - UpdateListStrategy.POLICY_UPDATE), - new UpdateListStrategy( - UpdateListStrategy.POLICY_UPDATE)); + return bindingManager.bindList(uiObservable, modelObservable, + new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE), + new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE)); } } return null; @@ -1055,8 +1008,7 @@ * the bindable value * @return the i observable */ - protected IObservable internalGetObservableEndpoint( - YEmbeddableBindingEndpoint bindableValue) { + protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { throw new UnsupportedOperationException("Must be overridden!"); } @@ -1074,13 +1026,14 @@ /* * (non-Javadoc) * - * @see - * org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#internalDispose - * () + * @see org.eclipse.osbp.runtime.common.dispose.AbstractDisposable# + * internalDispose () */ @Override protected void internalDispose() { unregisterFromLocaleChangedService(); + + component = null; } /** @@ -1101,6 +1054,36 @@ focusable.setTabIndex(yFocusable.getTabIndex()); } } + + if (component instanceof FocusNotifier && model instanceof YFocusNotifier) { + ((FocusNotifier) component).addFocusListener(e -> { + YEmbeddableEvent event = CoreModelFactory.eINSTANCE.createYEmbeddableEvent(); + event.setTime(new Date()); + event.setEmbeddable((YEmbeddable) getModel()); + event.setRawEvent(e); + ((YFocusNotifier) model).setLastFocusEvent(event); + }); + } + + if (component instanceof BlurNotifier && model instanceof YBlurNotifier) { + ((BlurNotifier) component).addBlurListener(e -> { + YEmbeddableEvent event = CoreModelFactory.eINSTANCE.createYEmbeddableEvent(); + event.setTime(new Date()); + event.setEmbeddable((YEmbeddable) getModel()); + event.setRawEvent(e); + ((YBlurNotifier) model).setLastBlurEvent(event); + }); + } + + if (component instanceof ContextClickNotifier && model instanceof YEmbeddable) { + ((ContextClickNotifier) component).addContextClickListener(e -> { + YContextClickEvent event = CoreModelFactory.eINSTANCE.createYContextClickEvent(); + event.setTime(new Date()); + event.setEmbeddable((YEmbeddable) getModel()); + event.setRawEvent(e); + ((YEmbeddable) model).setLastContextClick(event); + }); + } } /** @@ -1133,8 +1116,7 @@ * Locale change events are catched by that class. */ protected void registerAtLocaleChangedService() { - localeChangedService = getViewContext().getService( - ILocaleChangedService.ID); + localeChangedService = getViewContext().getService(ILocaleChangedService.ID); localeChangedService.addLocaleListener(this); } @@ -1163,11 +1145,9 @@ * Send a dispose lifecycle event to all registered listeners. */ protected void sendDisposedLifecycleEvent() { - ILifecycleService service = getViewContext().getService( - ILifecycleService.class.getName()); + ILifecycleService service = getViewContext().getService(ILifecycleService.class.getName()); if (service != null) { - service.notifyLifecycle(new LifecycleEvent(getEditpart(), - ILifecycleEvent.TYPE_DISPOSED)); + service.notifyLifecycle(new LifecycleEvent(getEditpart(), ILifecycleEvent.TYPE_DISPOSED)); } } @@ -1175,11 +1155,9 @@ * Send a rendered lifecycle event to all registered listeners. */ protected void sendRenderedLifecycleEvent() { - ILifecycleService service = getViewContext().getService( - ILifecycleService.class.getName()); + ILifecycleService service = getViewContext().getService(ILifecycleService.class.getName()); if (service != null) { - service.notifyLifecycle(new LifecycleEvent(getEditpart(), - ILifecycleEvent.TYPE_RENDERED)); + service.notifyLifecycle(new LifecycleEvent(getEditpart(), ILifecycleEvent.TYPE_RENDERED)); } } @@ -1187,11 +1165,9 @@ * Send a rendered lifecycle event to all registered listeners. */ protected void sendUnrenderedLifecycleEvent() { - ILifecycleService service = getViewContext().getService( - ILifecycleService.class.getName()); + ILifecycleService service = getViewContext().getService(ILifecycleService.class.getName()); if (service != null) { - service.notifyLifecycle(new LifecycleEvent(getEditpart(), - ILifecycleEvent.TYPE_UNRENDERED)); + service.notifyLifecycle(new LifecycleEvent(getEditpart(), ILifecycleEvent.TYPE_UNRENDERED)); } } @@ -1257,8 +1233,7 @@ return LayoutDragMode.NONE; } - return service.isDesignMode() ? LayoutDragMode.CLONE - : LayoutDragMode.NONE; + return service.isDesignMode() ? LayoutDragMode.CLONE : LayoutDragMode.NONE; } /** @@ -1287,8 +1262,7 @@ designService.removeListener((IDesignListener) this); } - IWidgetDesignConfigurator service = getViewContext().getService( - IWidgetDesignConfigurator.class.getName()); + IWidgetDesignConfigurator service = getViewContext().getService(IWidgetDesignConfigurator.class.getName()); if (service != null && getWidget() != null) { service.configure(getWidget(), (YEmbeddable) getModel(), false); } @@ -1537,8 +1511,7 @@ public void applyForegroundColor(YVisibilityProperties yProps) { YColor yColor = yProps.getForegroundColor(); if (yColor != null) { - component.addStyleName("l-foreground-" - + yColor.getName().toLowerCase()); + component.addStyleName("l-foreground-" + yColor.getName().toLowerCase()); } } @@ -1551,19 +1524,24 @@ public void applyBackgroundColor(YVisibilityProperties yProps) { YColor yColor = yProps.getBackgroundColor(); if (yColor != null) { - component.addStyleName("l-background-" - + yColor.getName().toLowerCase()); + component.addStyleName("l-background-" + yColor.getName().toLowerCase()); } } } private class LabelAdapter extends AdapterImpl { - @Override public void notifyChanged(Notification msg) { if (msg.getFeature() == CoreModelPackage.Literals.YEMBEDDABLE__LABEL_I1_8N_KEY || msg.getFeature() == CoreModelPackage.Literals.YEMBEDDABLE__LABEL) { doUpdateLocale(getLocale()); + } else if (msg.getFeature() == CoreModelPackage.Literals.YCSS_ABLE__CSS_CLASS) { + if (msg.getEventType() == Notification.SET) { + doUnSetStyle(msg.getOldStringValue()); + doSetStyle(msg.getNewStringValue()); + } else { + doUnSetStyle(msg.getOldStringValue()); + } } }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/FilteringComponentEmbeddable.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/FilteringComponentEmbeddable.java new file mode 100644 index 0000000..28852bc --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/FilteringComponentEmbeddable.java
@@ -0,0 +1,186 @@ +package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common; + +import java.util.Locale; +import java.util.function.Consumer; + +import javax.annotation.PreDestroy; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.osbp.ecview.core.common.beans.AbstractSlot; +import org.eclipse.osbp.ecview.core.common.context.ContextException; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; +import org.eclipse.osbp.ecview.core.common.model.core.YAlignment; +import org.eclipse.osbp.ecview.core.common.model.core.YView; +import org.eclipse.osbp.ecview.core.common.util.ECViewUtil; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelFactory; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; +import org.eclipse.osbp.ecview.core.extension.model.extension.YFilteringComponent; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayoutCellStyle; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class FilteringComponentEmbeddable<T> extends CustomComponent { + + private static final Logger LOGGER = LoggerFactory.getLogger(FilteringComponentEmbeddable.class); + + private final Class<T> type; + private final int depth; + + private boolean hideGrid; + private IViewContext viewContext; + private Consumer<T> acceptConsumer; + private YFilteringComponent yFilteringComp; + private int filterCols; + + private Consumer<Filter> acceptFilterConsumer; + + public FilteringComponentEmbeddable(Class<T> type, int depth) { + this(type, depth, 2); + } + + public FilteringComponentEmbeddable(Class<T> type, int depth, int filterCols) { + this.type = type; + this.depth = depth; + this.filterCols = filterCols; + } + + /** + * This consumer forwards the accept operation. Eg to forward the selection + * to the EventBroker. + * + * @param acceptConsumer + */ + public void setAcceptCallback(Consumer<T> acceptConsumer) { + this.acceptConsumer = acceptConsumer; + } + + /** + * If the filter is accepted, then this consumer is called. + * + * @param acceptFilterConsumer + */ + public void setFilterAcceptedCallback(Consumer<Filter> acceptFilterConsumer) { + this.acceptFilterConsumer = acceptFilterConsumer; + } + + /** + * Hides the grid. + * @return + */ + public boolean isHideGrid() { + return hideGrid; + } + + /** + * Hides the grid. + * @param hideGrid + */ + public void setHideGrid(boolean hideGrid) { + this.hideGrid = hideGrid; + } + + public void init(Locale locale) { + VerticalLayout content = new VerticalLayout(); + content.setMargin(true); + content.setSpacing(true); + setCompositionRoot(content); + + VerticalLayout renderTarget = new VerticalLayout(); + + content.addComponent(renderTarget); + content.setExpandRatio(renderTarget, 1.0f); + + YView yView = createViewModel(); + + VaadinRenderer renderer = new VaadinRenderer(); + try { + viewContext = renderer.render(renderTarget, yView, null); + } catch (ContextException e1) { + LOGGER.error("{}", e1); + } + viewContext.setLocale(locale); + + // create the bean slot eager + AbstractSlot slot = (AbstractSlot) viewContext.createBeanSlot(yFilteringComp.getSelectionBeanSlotName(), type); + slot.addPropertyChangeListener(e -> { + if (acceptConsumer != null) { + @SuppressWarnings("unchecked") + T selection = (T) viewContext.getBean(yFilteringComp.getSelectionBeanSlotName()); + acceptConsumer.accept(selection); + } + }); + } + + /** + * Returns the filter. + * + * @return + */ + public Filter getFilter() { + return (Filter) yFilteringComp.getFilter(); + } + + private YView createViewModel() { + + CoreModelFactory coreModelFactory = CoreModelFactory.eINSTANCE; + ExtensionModelFactory modelFactory = ExtensionModelFactory.eINSTANCE; + + YView view = coreModelFactory.createYView(); + view.setMargin(false); + + YVerticalLayout content = modelFactory.createYVerticalLayout(); + view.setContent(content); + + content.setMargin(false); + content.setSpacing(false); + + yFilteringComp = modelFactory.createYFilteringComponent(); + yFilteringComp.setMargin(false); + yFilteringComp.setSpacing(false); + yFilteringComp.setHideGrid(hideGrid); + + CustomAdapter adapter = new CustomAdapter(); + yFilteringComp.eAdapters().add(adapter); + + content.getElements().add(yFilteringComp); + YVerticalLayoutCellStyle cellStyle = content.addCellStyle(yFilteringComp); + cellStyle.setAlignment(YAlignment.FILL_FILL); + + yFilteringComp.setFilterCols(filterCols); + ECViewUtil.fill(type, depth, yFilteringComp); + + return view; + } + + @PreDestroy + public void dispose() { + if (viewContext != null) { + viewContext.dispose(); + viewContext = null; + } + } + + public IViewContext getViewContext() { + return viewContext; + } + + class CustomAdapter extends AdapterImpl { + @Override + public void notifyChanged(Notification notification) { + if (notification.getFeature() == ExtensionModelPackage.Literals.YFILTERING_COMPONENT__FILTER) { + if (acceptFilterConsumer != null) { + acceptFilterConsumer.accept(getFilter()); + } + } + } + } +}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/KanbanBoardEmbeddable.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/KanbanBoardEmbeddable.java new file mode 100644 index 0000000..8eec13f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/KanbanBoardEmbeddable.java
@@ -0,0 +1,152 @@ +package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common; + +import java.util.Locale; +import java.util.function.Consumer; + +import javax.annotation.PreDestroy; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.osbp.ecview.core.common.context.ContextException; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; +import org.eclipse.osbp.ecview.core.common.model.core.YAlignment; +import org.eclipse.osbp.ecview.core.common.model.core.YView; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelFactory; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; +import org.eclipse.osbp.ecview.core.extension.model.extension.YKanban; +import org.eclipse.osbp.ecview.core.extension.model.extension.YKanbanEvent; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayoutCellStyle; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class KanbanBoardEmbeddable extends CustomComponent { + + private static final Logger LOGGER = LoggerFactory.getLogger(KanbanBoardEmbeddable.class); + + private final Class<?> type; + private final String dialogId; + private final String cardId; + + private IViewContext viewContext; + private YKanban yKanban; + private Consumer<YKanbanEvent> doubleClickConsumer; + private Consumer<YKanbanEvent> stateChangedConsumer; + + public KanbanBoardEmbeddable(Class<?> type, String dialogId, String cardId) { + this.type = type; + this.dialogId = dialogId; + this.cardId = cardId; + } + + public void init(Locale locale) { + VerticalLayout content = new VerticalLayout(); + content.setMargin(true); + content.setSpacing(true); + setCompositionRoot(content); + + VerticalLayout renderTarget = new VerticalLayout(); + + content.addComponent(renderTarget); + content.setExpandRatio(renderTarget, 1.0f); + + YView yView = createViewModel(); + + VaadinRenderer renderer = new VaadinRenderer(); + try { + viewContext = renderer.render(renderTarget, yView, null); + } catch (ContextException e1) { + LOGGER.error("{}", e1); + } + viewContext.setLocale(locale); + } + + private YView createViewModel() { + + CoreModelFactory coreModelFactory = CoreModelFactory.eINSTANCE; + ExtensionModelFactory modelFactory = ExtensionModelFactory.eINSTANCE; + + YView view = coreModelFactory.createYView(); + view.setMargin(false); + + YVerticalLayout content = modelFactory.createYVerticalLayout(); + view.setContent(content); + + content.setMargin(false); + content.setSpacing(false); + + yKanban = modelFactory.createYKanban(); + yKanban.setCardECViewId(cardId); + yKanban.setEditDialogId(dialogId); + + content.getElements().add(yKanban); + YVerticalLayoutCellStyle cellStyle = content.addCellStyle(yKanban); + cellStyle.setAlignment(YAlignment.FILL_FILL); + + yKanban.setType(type); + yKanban.setTypeQualifiedName(type.getCanonicalName()); + + yKanban.eAdapters().add(new AdapterCustom()); + + return view; + } + + public Consumer<YKanbanEvent> getDoubleClickConsumer() { + return doubleClickConsumer; + } + + public void setDoubleClickConsumer(Consumer<YKanbanEvent> doubleClickConsumer) { + this.doubleClickConsumer = doubleClickConsumer; + } + + public Consumer<YKanbanEvent> getStateChangedConsumer() { + return stateChangedConsumer; + } + + public void setStateChangedConsumer(Consumer<YKanbanEvent> stateChangedConsumer) { + this.stateChangedConsumer = stateChangedConsumer; + } + + @PreDestroy + public void dispose() { + if (viewContext != null) { + viewContext.dispose(); + viewContext = null; + } + } + + public IViewContext getViewContext() { + return viewContext; + } + + /** + * Refreshes the given card. + * + * @param dto + */ + public void refreshCard(Object dto) { + yKanban.setToRefresh(new YKanbanEvent(dto)); + } + + private class AdapterCustom extends AdapterImpl { + @Override + public void notifyChanged(Notification msg) { + if (msg.getFeature() == ExtensionModelPackage.Literals.YKANBAN__STATE_CHANGED) { + if (stateChangedConsumer != null) { + stateChangedConsumer.accept((YKanbanEvent) msg.getNewValue()); + } + } else if (msg.getFeature() == ExtensionModelPackage.Literals.YKANBAN__DOUBLE_CLICKED) { + if (doubleClickConsumer != null) { + doubleClickConsumer.accept((YKanbanEvent) msg.getNewValue()); + } + } + } + } + +}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java index 3868196..1a5acab 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java
@@ -15,15 +15,26 @@ import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.emf.databinding.EMFObservables; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.osbp.ecview.core.common.beans.InMemoryBeanProvider; +import org.eclipse.osbp.ecview.core.common.context.ContextException; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; +import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory; +import org.eclipse.osbp.ecview.core.common.model.core.YAlignment; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint; +import org.eclipse.osbp.ecview.core.common.model.core.YView; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelFactory; import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; import org.eclipse.osbp.ecview.core.extension.model.extension.YBeanReferenceField; +import org.eclipse.osbp.ecview.core.extension.model.extension.YFilteringComponent; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout; +import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayoutCellStyle; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBeanReferenceFieldEditpart; import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraints; import org.eclipse.osbp.runtime.common.state.ISharedStateContext; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util; import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService; @@ -37,9 +48,14 @@ import com.vaadin.data.Container.Filter; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.Field; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; // TODO: Auto-generated Javadoc /** @@ -54,7 +70,9 @@ private final ModelAccess modelAccess; /** The field. */ - private CustomField<?> field; + private CustomField<Object> field; + + private DialogHandleImpl dialogHandle; /** * Constructor. @@ -74,11 +92,13 @@ @Override public Component doCreateWidget(Object parent) { if (field == null) { - IBeanSearchServiceFactory searchServiceFactory = getViewContext().getService(IBeanSearchServiceFactory.class.getName()); + IBeanSearchServiceFactory searchServiceFactory = getViewContext() + .getService(IBeanSearchServiceFactory.class.getName()); IBeanSearchService<?> service = getSearchService(searchServiceFactory); ISharedStateContext sharedState = getViewContext().getService(ISharedStateContext.class.getName()); - field = new CustomField(getEditpart().getId(), "", modelAccess.yField.getType(), service, createFilter(), sharedState); + field = new CustomField(getEditpart().getId(), "", modelAccess.yField.getType(), service, createFilter(), + sharedState); field.addStyleName(CSS_CLASS_CONTROL); field.setNullRepresentation(""); @@ -99,7 +119,6 @@ } field.setNullSelectionAllowed(!modelAccess.yField.isRequired()); - // creates the binding for the field createBindings(modelAccess.yField, field); @@ -107,6 +126,12 @@ field.addStyleName(modelAccess.getCssClass()); } + if (modelAccess.yField.getFilteringComponent() != null) { + dialogHandle = new DialogHandleImpl(); + field.setDialogHandle(dialogHandle); + field.setUseDialog(true); + } + applyCaptions(); initializeField(field); @@ -157,7 +182,8 @@ if (inMemoryProviderClass != null) { try { InMemoryBeanProvider provider = inMemoryProviderClass.newInstance(); - StatefulInMemoryBeanSearchService tempService = new StatefulInMemoryBeanSearchService(modelAccess.yField.getType()); + StatefulInMemoryBeanSearchService tempService = new StatefulInMemoryBeanSearchService( + modelAccess.yField.getType()); tempService.addBeans(provider.getBeans()); service = tempService; } catch (InstantiationException e) { @@ -239,7 +265,8 @@ */ protected IObservableValue internalGetValueEndpoint() { // return the observable value for text - return EMFObservables.observeValue(castEObject(getModel()), ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE); + return EMFObservables.observeValue(castEObject(getModel()), + ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE); } /** @@ -252,7 +279,8 @@ */ protected void createBindings(YBeanReferenceField yField, BeanReferenceField<?> field) { // create the model binding from ridget to ECView-model - registerBinding(createBindings_Value(castEObject(getModel()), ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE, field)); + registerBinding(createBindings_Value(castEObject(getModel()), + ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE, field)); super.createBindings(yField, field, null); } @@ -304,6 +332,7 @@ } field = null; + dialogHandle = null; } } @@ -402,7 +431,7 @@ * the generic type */ @SuppressWarnings("serial") - private class CustomField<M> extends BeanReferenceField<M> { + private class CustomField<M> extends BeanReferenceField<M> implements Component.Focusable { /** * Instantiates a new custom field. @@ -420,17 +449,16 @@ * @param sharedState * the shared state */ - public CustomField(String id, Object propertyId, Class<M> type, IBeanSearchService<M> searchService, Filter filter, - ISharedStateContext sharedState) { + public CustomField(String id, Object propertyId, Class<M> type, IBeanSearchService<M> searchService, + Filter filter, ISharedStateContext sharedState) { super(id, propertyId, type, searchService, filter, sharedState); } /* * (non-Javadoc) * - * @see - * org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanReferenceField - * #initContent() + * @see org.eclipse.osbp.runtime.web.vaadin.components.fields. + * BeanReferenceField #initContent() */ @Override protected Component initContent() { @@ -458,4 +486,78 @@ return message; } } + + class DialogHandleImpl implements BeanReferenceField.DialogHandle { + + CoreModelFactory coreModelFactory = CoreModelFactory.eINSTANCE; + ExtensionModelFactory modelFactory = ExtensionModelFactory.eINSTANCE; + private IViewContext dialogViewContext; + + @Override + public void open() { + YView yView = getViewModel(); + + Window window = new Window(); + window.setWidth("1350px"); + window.setHeight("750px"); + window.setClosable(true); + window.setModal(true); + VerticalLayout content = new VerticalLayout(); + content.setMargin(true); + content.setSpacing(true); + content.setSizeFull(); + window.setContent(content); + + VerticalLayout renderTarget = new VerticalLayout(); + renderTarget.setMargin(true); + renderTarget.setSpacing(true); + renderTarget.setSizeFull(); + content.addComponent(renderTarget); + content.setExpandRatio(renderTarget, 1.0f); + + UI ui = BeanReferenceFieldPresentation.this.field.getUI(); + ui.addWindow(window); + + VaadinRenderer renderer = new VaadinRenderer(); + try { + dialogViewContext = renderer.render(renderTarget, yView, null); + } catch (ContextException e1) { + e1.printStackTrace(); + } + + Button accept = new Button("accept", e -> { + window.close(); + Object selection = dialogViewContext + .getBean(modelAccess.yField.getFilteringComponent().getSelectionBeanSlotName()); + field.setValue(selection); + }); + content.addComponent(accept); + content.setComponentAlignment(accept, Alignment.BOTTOM_RIGHT); + + window.center(); + + dialogViewContext.setLocale(getLocale()); + + } + + protected YView getViewModel() { + YView yView = coreModelFactory.createYView(); + YVerticalLayout yContent = modelFactory.createYVerticalLayout(); + yView.setContent(yContent); + + YFilteringComponent comp = EcoreUtil.copy(modelAccess.yField.getFilteringComponent()); + yContent.getElements().add(comp); + YVerticalLayoutCellStyle cellStyle = yContent.addCellStyle(comp); + cellStyle.setAlignment(YAlignment.FILL_FILL); + return yView; + } + + @Override + public void close() { + if (dialogViewContext != null) { + dialogViewContext.dispose(); + } + } + } + }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java index fcddbdf..5474032 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java
@@ -66,7 +66,7 @@ } else { button.setId(getEditpart().getId()); } - + initialize(button, getCastedModel()); // creates the binding for the field
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java index 47b7a52..7fd33f5 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java
@@ -50,19 +50,17 @@ * This presenter is responsible to render a combo box on the given layout. */ @SuppressWarnings("restriction") -public class ComboBoxPresentation extends - AbstractFieldWidgetPresenter<Component> { +public class ComboBoxPresentation extends AbstractFieldWidgetPresenter<Component> { /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(ComboBoxPresentation.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ComboBoxPresentation.class); /** The model access. */ private final ModelAccess modelAccess; - + /** The combo. */ private LazyLoadingComboBox combo; - + /** The property. */ @SuppressWarnings("rawtypes") private ObjectProperty property; @@ -103,8 +101,7 @@ } try { - property = new ObjectProperty(null, - modelAccess.yField.getType()); + property = new ObjectProperty(null, modelAccess.yField.getModelSelectionType()); combo.setPropertyDataSource(property); if (modelAccess.yField.getType() != null) { @@ -114,41 +111,33 @@ combo.setContainerDataSource(datasource); } else { IBeanSearchServiceFactory factory = getViewContext() - .getService( - IBeanSearchServiceFactory.class - .getName()); + .getService(IBeanSearchServiceFactory.class.getName()); if (factory != null) { ISharedStateContext sharedState = getViewContext() - .getService( - ISharedStateContext.class.getName()); + .getService(ISharedStateContext.class.getName()); BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer( - factory.createService(modelAccess.yField - .getType()), - modelAccess.yField.getType(), sharedState); + factory.createService(modelAccess.yField.getType()), modelAccess.yField.getType(), + sharedState); combo.setContainerDataSource(datasource); } } } - String itemCaptionProperty = modelAccess.yField - .getCaptionProperty(); - if (itemCaptionProperty != null - && !itemCaptionProperty.equals("")) { + String itemCaptionProperty = modelAccess.yField.getCaptionProperty(); + if (itemCaptionProperty != null && !itemCaptionProperty.equals("")) { combo.setItemCaptionPropertyId(itemCaptionProperty); combo.setItemCaptionMode(ItemCaptionMode.PROPERTY); Container container = combo.getContainerDataSource(); if (container instanceof Container.Sortable) { Container.Sortable sortable = (Sortable) container; - sortable.sort(new Object[] { itemCaptionProperty }, - new boolean[] { true }); + sortable.sort(new Object[] { itemCaptionProperty }, new boolean[] { true }); } } else { combo.setItemCaptionMode(ItemCaptionMode.ID); } - String itemImageProperty = modelAccess.yField - .getImageProperty(); + String itemImageProperty = modelAccess.yField.getImageProperty(); if (itemImageProperty != null && !itemImageProperty.equals("")) { combo.setItemIconPropertyId(itemImageProperty); } @@ -170,8 +159,11 @@ return combo; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) */ @Override protected void doUpdateLocale(Locale locale) { @@ -186,27 +178,31 @@ * Applies the labels to the widgets. */ protected void applyCaptions() { - Util.applyCaptions(getI18nService(), modelAccess.getLabel(), - modelAccess.getLabelI18nKey(), getLocale(), combo); + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), combo); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#doGetField() */ @Override protected Field<?> doGetField() { return combo; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse. + * osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint) */ @Override - protected IObservable internalGetObservableEndpoint( - YEmbeddableBindingEndpoint bindableValue) { + protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { if (bindableValue == null) { - throw new IllegalArgumentException( - "BindableValue must not be null!"); + throw new IllegalArgumentException("BindableValue must not be null!"); } if (bindableValue instanceof YEmbeddableCollectionEndpoint) { @@ -214,8 +210,7 @@ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) { return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue); } - throw new IllegalArgumentException("Not a valid input: " - + bindableValue); + throw new IllegalArgumentException("Not a valid input: " + bindableValue); } /** @@ -225,9 +220,7 @@ */ protected IObservableList internalGetCollectionEndpoint() { // return the observable value for text - return EMFProperties.list( - ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION).observe( - getModel()); + return EMFProperties.list(ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION).observe(getModel()); } /** @@ -237,16 +230,13 @@ * the y endpoint * @return the i observable value */ - protected IObservableValue internalGetSelectionEndpoint( - YEmbeddableSelectionEndpoint yEndpoint) { + protected IObservableValue internalGetSelectionEndpoint(YEmbeddableSelectionEndpoint yEndpoint) { - String attributePath = ECViewModelBindable.getAttributePath( - ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, - yEndpoint.getAttributePath()); + String attributePath = ECViewModelBindable + .getAttributePath(ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, yEndpoint.getAttributePath()); // return the observable value for text - return ECViewModelBindable.observeValue(castEObject(getModel()), - attributePath, modelAccess.yField.getType(), + return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yField.getType(), modelAccess.yField.getEmfNsURI()); } @@ -259,30 +249,38 @@ * the field */ protected void createBindings(YComboBox yField, LazyLoadingComboBox field) { - // create the model binding from ridget to ECView-model - registerBinding(createBindings_ContainerContents( - castEObject(getModel()), - ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION, field, - yField.getType())); + + if (!modelAccess.yField.isUseBeanService()) { + // create the model binding from ridget to ECView-model + registerBinding(createBindings_ContainerContents(castEObject(getModel()), + ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION, field, yField.getType())); + } // create the model binding from ridget to ECView-model registerBinding(createBindingsSelection(castEObject(getModel()), - ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, field, - yField.getType())); + ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, field, yField.getModelSelectionType())); super.createBindings(yField, field, null); } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * getWidget() */ @Override public Component getWidget() { return combo; } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * isRendered() */ @Override public boolean isRendered() { @@ -327,7 +325,7 @@ * A helper class. */ private static class ModelAccess { - + /** The y field. */ private final YComboBox yField; @@ -386,8 +384,7 @@ * @return the label */ public String getLabel() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabel() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null; } /** @@ -396,8 +393,7 @@ * @return the label i18n key */ public String getLabelI18nKey() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabelI18nKey() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null; } } @@ -407,16 +403,18 @@ */ @SuppressWarnings("serial") private static class CustomComboBox extends LazyLoadingComboBox { - + /** The item icon property id. */ private Object itemIconPropertyId; - /* (non-Javadoc) - * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) */ @Override - public void setItemIconPropertyId(Object propertyId) - throws IllegalArgumentException { + public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { if (propertyId == null) { super.setItemIconPropertyId(propertyId); } else if (!getContainerPropertyIds().contains(propertyId)) { @@ -428,23 +426,25 @@ } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId() */ public Object getItemIconPropertyId() { - return itemIconPropertyId != null ? itemIconPropertyId : super - .getItemIconPropertyId(); + return itemIconPropertyId != null ? itemIconPropertyId : super.getItemIconPropertyId(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object) */ public Resource getItemIcon(Object itemId) { if (itemIconPropertyId == null) { return super.getItemIcon(itemId); } else { - final Property<?> ip = getContainerProperty(itemId, - getItemIconPropertyId()); + final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId()); if (ip == null) { return null; }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java index 371d1c3..9c8d514 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java
@@ -12,9 +12,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.Date; -import java.util.List; import java.util.Locale; import org.eclipse.core.databinding.Binding; @@ -424,9 +422,9 @@ public Info getInfo(YDateTimeDatatype yDt, Locale locale) { if (yDt == null) { - DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, locale); + DateFormat formatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); return new IDateFormatProvider.Info(((SimpleDateFormat)formatter).toPattern(), - YDateTimeResolution.MINUTE); + YDateTimeResolution.DAY); } DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale); @@ -465,13 +463,13 @@ dateFormat = filterFormat(pattern, "yyyy.MM.dd"); break; case HOUR: - dateFormat = filterFormat(pattern, "yyyy.MM.dd HH"); + dateFormat = filterFormat(pattern, "yyyy.MM.dd hhHH"); break; case MINUTE: - dateFormat = filterFormat(pattern, "yyyy.MM.dd HH:mm"); + dateFormat = filterFormat(pattern, "yyyy.MM.dd hhHH:mm"); break; case SECOND: - dateFormat = filterFormat(pattern, "yyyy.MM.dd HH:mm:ss"); + dateFormat = filterFormat(pattern, "yyyy.MM.dd hhHH:mm:ss"); break; default: throw new IllegalArgumentException(resolution @@ -520,7 +518,7 @@ // create a replacement pattern to remove remaining separators without formatting function // rule: each separator must be surrounded by any filter-letter or blank to be valid String invalidSeparators = "(?!["+filter+" ])([.:])(?!["+filter+" ])"; - return localizedPattern.replaceAll("[^"+filter+",.: ]", "").replaceAll(invalidBlanks, "").replaceAll(invalidSeparators, ""); + return localizedPattern.replaceAll("[^"+filter+",.: ]", "").replaceAll(invalidBlanks, "").trim().replaceAll(invalidSeparators, ""); } /**
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java index 157b22b..2b4ac1b 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java
@@ -50,18 +50,17 @@ /** * This presenter is responsible to render a text area on the given layout. */ -public class DecimalFieldPresentation extends - AbstractFieldWidgetPresenter<Component> { +public class DecimalFieldPresentation extends AbstractFieldWidgetPresenter<Component> { /** The model access. */ private final ModelAccess modelAccess; - + /** The decimal field. */ private CustomField decimalField; - + /** The binding_value to ui. */ private Binding binding_valueToUI; - + /** The property. */ private ObjectProperty<Double> property; @@ -99,16 +98,6 @@ property = new ObjectProperty<Double>(0d, Double.class); decimalField.setPropertyDataSource(property); - decimalField - .addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (binding_valueToUI != null) { - updateUiToECViewModel(); - } - } - }); - if (modelAccess.isCssClassValid()) { decimalField.addStyleName(modelAccess.getCssClass()); } @@ -127,16 +116,23 @@ return decimalField; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#getDefaultConverter() */ @Override protected Converter<?, ?> getDefaultConverter() { return new DecimalConverter(); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doUpdateConverter(com.vaadin.data.util.converter.Converter) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#doUpdateConverter(com.vaadin.data.util. + * converter.Converter) */ @SuppressWarnings("rawtypes") protected void doUpdateConverter(Converter converter) { @@ -179,8 +175,11 @@ } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) */ @Override protected void doUpdateLocale(Locale locale) { @@ -188,7 +187,7 @@ applyCaptions(); // tell the number field about the locale change - if(decimalField != null) { + if (decimalField != null) { decimalField.setLocale(locale); } } @@ -197,34 +196,38 @@ * Applies the labels to the widgets. */ protected void applyCaptions() { - Util.applyCaptions(getI18nService(), modelAccess.getLabel(), - modelAccess.getLabelI18nKey(), getLocale(), decimalField); + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), + decimalField); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#doGetField() */ @Override protected Field<?> doGetField() { return decimalField; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse. + * osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint) */ @Override - protected IObservable internalGetObservableEndpoint( - YEmbeddableBindingEndpoint bindableValue) { + protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { if (bindableValue == null) { - throw new IllegalArgumentException( - "BindableValue must not be null!"); + throw new IllegalArgumentException("BindableValue must not be null!"); } if (bindableValue instanceof YEmbeddableValueEndpoint) { return internalGetValueEndpoint(); } - throw new IllegalArgumentException("Not a valid input: " - + bindableValue); + throw new IllegalArgumentException("Not a valid input: " + bindableValue); } /** @@ -247,12 +250,11 @@ * the field */ protected void createBindings(YDecimalField yField, DecimalField field) { - // create the model binding from ridget to ECView-model - - binding_valueToUI = createModelBinding(castEObject(getModel()), - ExtensionModelPackage.Literals.YDECIMAL_FIELD__VALUE, field, - null, null); - + // create the value binding from widget to ECView-model + binding_valueToUI = createBindings_Value(castEObject(getModel()), + ExtensionModelPackage.Literals.YDECIMAL_FIELD__VALUE, field); + + registerBinding(binding_valueToUI); super.createBindings(yField, field, null); @@ -273,35 +275,37 @@ * the model to target * @return the binding */ - protected Binding createModelBinding(EObject model, - EStructuralFeature modelFeature, AbstractField<?> field, + protected Binding createModelBinding(EObject model, EStructuralFeature modelFeature, AbstractField<?> field, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { IBindingManager bindingManager = getViewContext() - .getService( - org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class - .getName()); + .getService(org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class.getName()); if (bindingManager != null) { // bind the value of yText to textRidget - IObservableValue modelObservable = EMFObservables.observeValue( - model, modelFeature); - IObservableValue uiObservable = VaadinObservables - .observeConvertedValue(field); - return bindingManager.bindValue(uiObservable, modelObservable, - targetToModel, modelToTarget); + IObservableValue modelObservable = EMFObservables.observeValue(model, modelFeature); + IObservableValue uiObservable = VaadinObservables.observeConvertedValue(field); + return bindingManager.bindValue(uiObservable, modelObservable, targetToModel, modelToTarget); } return null; } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * getWidget() */ @Override public Component getWidget() { return decimalField; } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * isRendered() */ @Override public boolean isRendered() { @@ -353,8 +357,7 @@ binding_valueToUI.updateTargetToModel(); } - Binding domainToEObjectBinding = ModelUtil - .getValueBinding((YValueBindable) getModel()); + Binding domainToEObjectBinding = ModelUtil.getValueBinding((YValueBindable) getModel()); if (domainToEObjectBinding != null) { domainToEObjectBinding.updateTargetToModel(); } @@ -364,7 +367,7 @@ * A helper class. */ private static class ModelAccess { - + /** The y field. */ private final YDecimalField yField; @@ -423,8 +426,7 @@ * @return the label */ public String getLabel() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabel() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null; } /** @@ -433,8 +435,7 @@ * @return the label i18n key */ public String getLabelI18nKey() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabelI18nKey() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null; } } @@ -454,7 +455,9 @@ super("", converter); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.ui.AbstractField#getErrorMessage() */ @Override @@ -468,5 +471,9 @@ reportValidationError(message); return message; } + + public void clear() { + setValue("0.0"); + } } }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java index 7259883..3994f1e 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java
@@ -103,7 +103,8 @@ combo.setPropertyDataSource(property); if (modelAccess.yField.getType() != null) { - BeanItemContainer<EnumOptionBean> datasource = createDatasource((Class<? extends Enum<?>>) modelAccess.yField.getType()); + BeanItemContainer<EnumOptionBean> datasource = createDatasource( + (Class<? extends Enum<?>>) modelAccess.yField.getType()); combo.setContainerDataSource(datasource); } @@ -133,7 +134,8 @@ /* * (non-Javadoc) * - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter() + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#getDefaultConverter() */ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @@ -161,7 +163,8 @@ /* * (non-Javadoc) * - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) */ @Override protected void doUpdateLocale(Locale locale) { @@ -175,14 +178,19 @@ /** * Applies the labels to the widgets. */ + @SuppressWarnings("unchecked") protected void applyCaptions() { Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), combo); + + EnumOptionBeanHelper.updateLocale((BeanItemContainer<EnumOptionBean>) combo.getContainerDataSource(), + getI18nService(), getLocale()); } /* * (non-Javadoc) * - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField() + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractFieldWidgetPresenter#doGetField() */ @Override protected Field<?> doGetField() { @@ -192,9 +200,9 @@ /* * (non-Javadoc) * - * @see - * org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core - * .YEmbeddableBindingEndpoint) + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse. + * osbp.ecview.core.common.model.core .YEmbeddableBindingEndpoint) */ @Override protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { @@ -228,10 +236,12 @@ */ protected IObservableValue internalGetSelectionEndpoint(YEmbeddableSelectionEndpoint yEndpoint) { - String attributePath = ECViewModelBindable.getAttributePath(ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, yEndpoint.getAttributePath()); + String attributePath = ECViewModelBindable + .getAttributePath(ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, yEndpoint.getAttributePath()); // return the observable value for text - return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yField.getType(), modelAccess.yField.getEmfNsURI()); + return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yField.getType(), + modelAccess.yField.getEmfNsURI()); } /** @@ -244,7 +254,8 @@ */ protected void createBindings(YEnumComboBox yField, ComboBox field) { // create the model binding from ridget to ECView-model - registerBinding(createBindingsSelection(castEObject(getModel()), ExtensionModelPackage.Literals.YENUM_COMBO_BOX__SELECTION, field, yField.getType())); + registerBinding(createBindingsSelection(castEObject(getModel()), + ExtensionModelPackage.Literals.YENUM_COMBO_BOX__SELECTION, field, yField.getType())); super.createBindings(yField, field, null); } @@ -252,7 +263,9 @@ /* * (non-Javadoc) * - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget() + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * getWidget() */ @Override public Component getWidget() { @@ -262,7 +275,9 @@ /* * (non-Javadoc) * - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered() + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * isRendered() */ @Override public boolean isRendered() { @@ -380,7 +395,8 @@ } /** - * Converts the string value of the item icon property to {@link ThemeResource}. + * Converts the string value of the item icon property to + * {@link ThemeResource}. */ @SuppressWarnings("serial") private class CustomComboBox extends ComboBox { @@ -407,7 +423,8 @@ /* * (non-Javadoc) * - * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) + * @see + * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) */ @Override public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { @@ -447,7 +464,8 @@ final Object icon = ip.getValue(); try { if (icon instanceof String) { - IThemeResourceService themeResourceService = getViewContext().getService(IThemeResourceService.class.getName()); + IThemeResourceService themeResourceService = getViewContext() + .getService(IThemeResourceService.class.getName()); return themeResourceService.getThemeResource((String) icon, ThemeResourceType.ICON); } } catch (Exception e) {
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java index 129718a..ce0db66 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java
@@ -196,9 +196,13 @@ /** * Applies the labels to the widgets. */ + @SuppressWarnings("unchecked") protected void applyCaptions() { Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), list); + + EnumOptionBeanHelper.updateLocale((BeanItemContainer<EnumOptionBean>) list.getContainerDataSource(), + getI18nService(), getLocale()); } /* (non-Javadoc)
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java index eabd432..a52ead5 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java
@@ -198,9 +198,13 @@ /** * Applies the labels to the widgets. */ + @SuppressWarnings("unchecked") protected void applyCaptions() { Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), optionsGroup); + + EnumOptionBeanHelper.updateLocale((BeanItemContainer<EnumOptionBean>) optionsGroup.getContainerDataSource(), + getI18nService(), getLocale()); } /* (non-Javadoc)
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FilteringComponentPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FilteringComponentPresentation.java new file mode 100644 index 0000000..f0dd3bb --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FilteringComponentPresentation.java
@@ -0,0 +1,439 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal; + +import java.util.Date; +import java.util.Locale; + +import org.eclipse.core.databinding.Binding; +import org.eclipse.core.databinding.UpdateValueStrategy; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; +import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart; +import org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; +import org.eclipse.osbp.ecview.core.extension.model.extension.YFilterDescriptor; +import org.eclipse.osbp.ecview.core.extension.model.extension.YFilterTableDescriptor; +import org.eclipse.osbp.ecview.core.extension.model.extension.YFilteringComponent; +import org.eclipse.osbp.runtime.common.util.BeanUtils; +import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractEmbeddedWidgetPresenter; +import org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2.FilteringComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This presenter is responsible to render a text field on the given layout. + */ +public class FilteringComponentPresentation<T> extends AbstractEmbeddedWidgetPresenter<FilteringComponent<T>> + implements IFilterProvidingPresentation { + + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(FilteringComponentPresentation.class); + + private FilteringComponent<T> layout; + private ModelAccess modelAccess; + + private int currentChildIndex; + + private Adapter adapter; + + private Binding filterBinding; + + /** + * The constructor. + * + * @param editpart + * The editpart of that editpart. + */ + public FilteringComponentPresentation(IElementEditpart editpart) { + super((IEmbeddableEditpart) editpart); + this.modelAccess = new ModelAccess((YFilteringComponent) editpart.getModel()); + } + + @Override + protected void doUpdateLocale(Locale locale) { + // no need to set the locale to the ui elements. Is handled by vaadin + // internally. + + // update the captions + applyCaptions(); + } + + /** + * Applies the labels to the widgets. + */ + protected void applyCaptions() { + } + + /** + * Is called to refresh the UI. The element will be removed from the layout + * and added to it again afterwards. + */ + protected void refreshUI() { + + // iterate all elements and build the child element + // + currentChildIndex = 0; + + unrenderChildren(); + renderChildren(); + } + + private void addFilter(YFilterDescriptor child) { + currentChildIndex++; + switch (child.getType()) { + case COMPARE: + if (isString(child)) { + layout.addCompareTextComponent(child.getPropertyPath(), currentChildIndex); + } else if (isDecimal(child)) { + layout.addCompareDecimalComponent(child.getPropertyPath(), toDecimalType(child), currentChildIndex); + } else if (isDate(child)) { + layout.addCompareDateComponent(child.getPropertyPath(), currentChildIndex); + } else if (isBoolean(child)) { + layout.addCompareBooleanComponent(child.getPropertyPath(), currentChildIndex); + } + break; + case RANGE: + if (isString(child)) { + layout.addBetweenTextComponent(child.getPropertyPath(), currentChildIndex); + } else if (isDecimal(child)) { + layout.addBetweenDecimalComponent(child.getPropertyPath(), toCompareType(child), currentChildIndex); + } else if (isDate(child)) { + layout.addBetweenDateComponent(child.getPropertyPath(), currentChildIndex); + } + break; + } + } + + private void addColumn(YFilterTableDescriptor desc) { + layout.addGridColumn(desc.getPropertyPath()); + } + + private Class<?> getType(YFilterDescriptor child) { + Class<?> rootType = modelAccess.yLayout.getType(); + return BeanUtils.getNestedFieldType(rootType, child.getPropertyPath()); + } + + private boolean isBoolean(YFilterDescriptor child) { + Class<?> type = getType(child); + return type == Boolean.class || type == Boolean.TYPE; + } + + private boolean isDate(YFilterDescriptor child) { + Class<?> type = getType(child); + return Date.class.isAssignableFrom(type); + } + + private boolean isDecimal(YFilterDescriptor child) { + Class<?> type = getType(child); + return type != String.class && type != Boolean.class && type != Boolean.TYPE + && (type.isPrimitive() || Number.class.isAssignableFrom(type)); + } + + private boolean isString(YFilterDescriptor child) { + Class<?> type = getType(child); + return type == String.class; + } + + @SuppressWarnings("unchecked") + private <X extends Number & Comparable<?>> Class<X> toCompareType(YFilterDescriptor child) { + return (Class<X>) getType(child); + } + + @SuppressWarnings("unchecked") + private Class<? extends Number> toDecimalType(YFilterDescriptor child) { + return (Class<? extends Number>) getType(child); + } + + @SuppressWarnings("unchecked") + @Override + public FilteringComponent<T> doCreateWidget(Object parent) { + if (layout == null) { + + layout = new FiltersComponentCustom(getViewContext(), (Class<T>) modelAccess.yLayout.getType(), + modelAccess.yLayout.getFilterCols(), modelAccess.yLayout.isHideGrid()); + setupComponent(layout, getCastedModel()); + + associateWidget(layout, modelAccess.yLayout); + + if (modelAccess.isCssIdValid()) { + layout.setId(modelAccess.getCssID()); + } else { + layout.setId(getEditpart().getId()); + } + + if (modelAccess.isCssClassValid()) { + layout.addStyleName(modelAccess.getCssClass()); + } else { + layout.addStyleName(CSS_CLASS_CONTROL); + } + + // creates the binding for the field + createBindings(modelAccess.yLayout, layout); + + // initialize all children + refreshUI(); + + adapter = new Adapter(modelAccess.yLayout); + + // create the bean slot eager + getViewContext().createBeanSlot(modelAccess.yLayout.getSelectionBeanSlotName(), + modelAccess.yLayout.getType()); + + // set the selection into the proper beanslot + layout.setSelectionConsumer((s) -> { + getViewContext().setBean(modelAccess.yLayout.getSelectionBeanSlotName(), s); + }); + } + + return layout; + } + + protected void createBindings(YFilteringComponent yField, FilteringComponent<T> field) { + { + // filter property + UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER); + UpdateValueStrategy targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_ON_REQUEST); + filterBinding = createBindingsByAccessor(castEObject(getModel()), + ExtensionModelPackage.Literals.YFILTERING_COMPONENT__FILTER, layout, "filter", targetToModel, + modelToTarget); + registerBinding(filterBinding); + } + + { + // apply filter property + UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE); + UpdateValueStrategy targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER); + Binding binding = createBindingsByAccessor(castEObject(getModel()), + ExtensionModelPackage.Literals.YFILTERING_COMPONENT__APPLY_FILTER, this, "applyFilter", + targetToModel, modelToTarget); + registerBinding(binding); + } + + { + // reset filter property + UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE); + UpdateValueStrategy targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER); + Binding binding = createBindingsByAccessor(castEObject(getModel()), + ExtensionModelPackage.Literals.YFILTERING_COMPONENT__RESET_FILTER, this, "resetFilter", + targetToModel, modelToTarget); + registerBinding(binding); + } + + super.createBindings(yField, field, null); + } + + // helper methods for binding + public void setApplyFilter(Object value) { + layout.applyFilters(); + } + + // helper methods for binding + public Object getApplyFilter() { + return new Date(); + } + + // helper methods for binding + public void setResetFilter(Object value) { + layout.resetAllFilters(); + } + + // helper methods for binding + public Object getResetFilter() { + return new Date(); + } + + protected void renderChildren() { + for (YFilterDescriptor desc : modelAccess.yLayout.getFilterDescriptors()) { + addFilter(desc); + } + + for (YFilterTableDescriptor desc : modelAccess.yLayout.getTableDescriptors()) { + addColumn(desc); + } + } + + protected void unrenderChildren() { + layout.removeAllComponents(); + } + + @Override + public Object getFilter() { + return layout.getFilter(); + } + + @Override + public FilteringComponent<T> getWidget() { + return layout; + } + + @Override + public boolean isRendered() { + return layout != null; + } + + @Override + protected void internalDispose() { + try { + unrender(); + } finally { + super.internalDispose(); + } + } + + @Override + public void doUnrender() { + if (layout != null) { + + filterBinding.dispose(); + filterBinding = null; + + adapter.dispose(); + adapter = null; + + // unbind all active bindings + unbind(); + + // remove assocations + unassociateWidget(layout); + + unrenderChildren(); + + layout.dispose(); + layout = null; + } + } + + @Override + public void notify(DesignEvent event) { + // nothing to do + } + + /** + * An internal helper class. + */ + private static class ModelAccess { + private final YFilteringComponent yLayout; + + public ModelAccess(YFilteringComponent yLayout) { + super(); + this.yLayout = yLayout; + } + + /** + * @return + * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass() + */ + public String getCssClass() { + return yLayout.getCssClass(); + } + + /** + * Returns true, if the css class is not null and not empty. + * + * @return + */ + public boolean isCssClassValid() { + return getCssClass() != null && !getCssClass().equals(""); + } + + /** + * @return + * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID() + */ + public String getCssID() { + return yLayout.getCssID(); + } + + /** + * Returns true, if the css id is not null and not empty. + * + * @return + */ + public boolean isCssIdValid() { + return getCssID() != null && !getCssID().equals(""); + } + + } + + class Adapter extends AdapterImpl { + + final YFilteringComponent component; + + Adapter(YFilteringComponent component) { + this.component = component; + component.eAdapters().add(this); + } + + @Override + public void notifyChanged(Notification msg) { + if (msg.getFeature() == ExtensionModelPackage.Literals.YFILTERING_COMPONENT__FILTER_DESCRIPTORS) { + refreshUI(); + } else if (msg.getFeature() == ExtensionModelPackage.Literals.YFILTERING_COMPONENT__TABLE_DESCRIPTORS) { + refreshUI(); + } + } + + void dispose() { + component.eAdapters().remove(this); + } + } + + @SuppressWarnings("serial") + class FiltersComponentCustom extends FilteringComponent<T> { + + public FiltersComponentCustom(IViewContext viewContext, Class<T> type, boolean hideGrid) { + super(viewContext, type, hideGrid); + } + + public FiltersComponentCustom(IViewContext viewContext, Class<T> rootType, int filterCols, boolean hideGrid) { + super(viewContext, rootType, filterCols, hideGrid); + } + + private Object resetFilters; + private Object applyFilters; + + // binding support + public Object getResetFilters() { + return resetFilters; + } + + // binding support + public void setResetFilters(Object resetFilters) { + this.resetFilters = resetFilters; + super.resetAllFilters(); + } + + // binding support + public Object getApplyFilters() { + return applyFilters; + } + + public void applyFilters() { + super.applyFilters(); + + // invoke the filter binding to update the model + filterBinding.updateTargetToModel(); + } + + // binding support + public void setApplyFilters(Object applyFilters) { + this.applyFilters = applyFilters; + + // invoke the filter binding to update the model + filterBinding.updateTargetToModel(); + } + } + +}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java index 720d42f..f94f8a5 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java
@@ -35,7 +35,6 @@ import com.vaadin.ui.ComponentContainer; import fi.jasoft.dragdroplayouts.DDHorizontalLayout; -import fi.jasoft.dragdroplayouts.drophandlers.DefaultHorizontalLayoutDropHandler; // TODO: Auto-generated Javadoc /**
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java index 3da2ff4..233aee1 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java
@@ -36,12 +36,11 @@ /** * This presenter is responsible to render a text area on the given layout. */ -public class ImagePresentation extends - AbstractEmbeddedWidgetPresenter<Component> { +public class ImagePresentation extends AbstractEmbeddedWidgetPresenter<Component> { /** The model access. */ private final ModelAccess modelAccess; - + /** The image. */ private Embedded image; @@ -87,7 +86,9 @@ } return image; } -//TODO: check the return type - the documentation and the implementation do not match + + // TODO: check the return type - the documentation and the implementation do + // not match /** * Creates the bindings from the ECView EMF model to the given UI element. * @@ -97,34 +98,43 @@ * the widget * @param container * the container - * - * return Binding - the created binding + * + * return Binding - the created binding */ - protected void createBindings(YImage yField, AbstractComponent widget, - AbstractComponent container) { + protected void createBindings(YImage yField, AbstractComponent widget, AbstractComponent container) { + // binding for YImage#value IObservableValue modelObservable = EMFObservables.observeValue(yField, ExtensionModelPackage.Literals.YIMAGE__VALUE); IObservableValue uiObservable = VaadinObservables.observeSource(image); - IConverter stringToResourceConverter = new Converter(String.class, - Resource.class) { + IConverter stringToResourceConverter = new Converter(String.class, Resource.class) { @Override public Object convert(Object fromObject) { - return (fromObject != null && !fromObject.equals("")) ? new ThemeResource( - (String) fromObject) : null; + return (fromObject != null && !fromObject.equals("")) ? new ThemeResource((String) fromObject) : null; } }; registerBinding(createBindings(uiObservable, modelObservable, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), - new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE) - .setConverter(stringToResourceConverter))); + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE).setConverter(stringToResourceConverter))); + + // binding for YImage#resource + IObservableValue resModelObservable = EMFObservables.observeValue(yField, + ExtensionModelPackage.Literals.YIMAGE__RESOURCE); + IObservableValue resUiObservable = VaadinObservables.observeSource(image); + + registerBinding(createBindings(resUiObservable, resModelObservable, + new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE))); super.createBindings(yField, widget, container); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common. + * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale) */ @Override protected void doUpdateLocale(Locale locale) { @@ -139,20 +149,27 @@ * Applies the labels to the widgets. */ protected void applyCaptions() { - Util.applyCaptions(getI18nService(), modelAccess.getLabel(), - modelAccess.getLabelI18nKey(), getLocale(), image); + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), image); } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * getWidget() */ @Override public Component getWidget() { return image; } - /* (non-Javadoc) - * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * isRendered() */ @Override public boolean isRendered() { @@ -196,7 +213,7 @@ * A helper class. */ private static class ModelAccess { - + /** The y field. */ private final YImage yField;
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/KanbanPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/KanbanPresentation.java new file mode 100644 index 0000000..585bffb --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/KanbanPresentation.java
@@ -0,0 +1,460 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal; + +import java.util.Locale; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.osbp.ecview.core.common.context.ContextException; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; +import org.eclipse.osbp.ecview.core.common.extender.IECViewCache; +import org.eclipse.osbp.ecview.core.common.model.core.YView; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelFactory; +import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; +import org.eclipse.osbp.ecview.core.extension.model.extension.YKanban; +import org.eclipse.osbp.ecview.core.extension.model.extension.YKanbanEvent; +import org.eclipse.osbp.ecview.core.extension.model.extension.YKanbanVisibilityProcessor; +import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IKanbanEditpart; +import org.eclipse.osbp.runtime.common.annotations.DtoUtils; +import org.eclipse.osbp.runtime.common.state.ISharedStateContext; +import org.eclipse.osbp.runtime.common.util.BeanUtils; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.FilteringComponentEmbeddable; +import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util; +import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory; +import org.eclipse.osbp.vaadin.addons.kanban.KanbanBoard; +import org.eclipse.osbp.vaadin.addons.kanban.KanbanBoard.FilterChangedListener; +import org.eclipse.osbp.vaadin.addons.kanban.KanbanCard; + +import com.vaadin.data.Container.Filter; +import com.vaadin.server.ErrorMessage; +import com.vaadin.server.ThemeResource; +import com.vaadin.ui.Component; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.VerticalLayout; + +/** + * This presenter is responsible to render a list on the given layout. + */ +public class KanbanPresentation extends AbstractVaadinWidgetPresenter<Component> { + + /** The model access. */ + private final ModelAccess modelAccess; + + /** The KanbanBoard */ + private CustomKanbanBoard kanban; + + @SuppressWarnings("rawtypes") + private FilteringComponentEmbeddable filteringComponent; + + private CustomDropAdapter dropAdapter; + + private CustomFilterProvider filterProvider; + + private CustomCardAdapter cardAdapter; + + private YView cardView; + + private AdapterCustom modelAdapter; + + /** The property. */ + + /** + * Constructor. + * + * @param editpart + * The editpart of that presenter + */ + public KanbanPresentation(IElementEditpart editpart) { + super((IKanbanEditpart) editpart); + this.modelAccess = new ModelAccess((YKanban) editpart.getModel()); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public Component doCreateWidget(Object parent) { + if (kanban == null) { + + findCardView(); + + kanban = new CustomKanbanBoard(); + kanban.addStyleName(CSS_CLASS_CONTROL); + kanban.setImmediate(true); + kanban.setDoubleClickListener(this::cardDoubleClicked); + setupComponent(kanban, getCastedModel()); + associateWidget(kanban, modelAccess.yField); + + if (modelAccess.isCssIdValid()) { + kanban.setId(modelAccess.getCssID()); + } else { + kanban.setId(getEditpart().getId()); + } + + if (modelAccess.yField.getType() != null) { + + modelAdapter = new AdapterCustom(); + modelAccess.yField.eAdapters().add(modelAdapter); + + dropAdapter = new CustomDropAdapter(); + filterProvider = new CustomFilterProvider(); + cardAdapter = new CustomCardAdapter(); + + filteringComponent = new FilteringComponentEmbeddable(modelAccess.yField.getType(), 2); + filteringComponent.setHideGrid(true); + filteringComponent.init(getLocale()); + filteringComponent.setFilterAcceptedCallback(e -> filterProvider.notifyChangedFilter()); + + kanban.initialize(getPermittedStates(), dropAdapter, cardAdapter, filterProvider); + + IBeanSearchServiceFactory factory = getViewContext() + .getService(IBeanSearchServiceFactory.class.getName()); + if (factory != null) { + ISharedStateContext sharedState = getViewContext().getService(ISharedStateContext.class.getName()); + BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer( + factory.createService(modelAccess.yField.getType()), modelAccess.yField.getType(), + sharedState); + kanban.setContainerDatasource(datasource); + } + } + + // creates the binding for the field + createBindings(modelAccess.yField, kanban); + + if (modelAccess.isCssClassValid()) { + kanban.addStyleName(modelAccess.getCssClass()); + } + + applyCaptions(); + + initialize(kanban, modelAccess.yField); + } + return kanban; + } + + private void cardDoubleClicked(KanbanCard card) { + Object dto = card.getDto(); + modelAccess.yField.setDoubleClicked(new YKanbanEvent(dto)); + } + + private void cardStateChanged(Enum<?> sourceState, Enum<?> targetState, Object dto) { + modelAccess.yField.setStateChanged(new YKanbanEvent(dto, sourceState, targetState)); + } + + private void findCardView() { + IECViewCache ecviewCache = getViewContext().getService(IECViewCache.class.getName()); + cardView = ecviewCache.getView(modelAccess.yField.getCardECViewId()); + } + + protected Enum<?>[] getPermittedStates() { + Enum<?>[] result = BeanUtils.getKanbanStateEnumLiterals(modelAccess.yField.getType()); + return result; + } + + @Override + protected void doUpdateLocale(Locale locale) { + // no need to set the locale to the ui elements. Is handled by vaadin + // internally. + + // update the captions + applyCaptions(); + } + + /** + * Applies the labels to the widgets. + */ + protected void applyCaptions() { + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), + kanban); + } + + /** + * Creates the bindings for the given values. + * + * @param yField + * the y field + * @param field + * the field + */ + protected void createBindings(YKanban yField, KanbanBoard field) { + super.createBindings(yField, field, null); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * getWidget() + */ + @Override + public Component getWidget() { + return kanban; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation# + * isRendered() + */ + @Override + public boolean isRendered() { + return kanban != null; + } + + /** + * {@inheritDoc} + */ + @Override + public void doUnrender() { + if (kanban != null) { + + modelAccess.yField.eAdapters().remove(modelAdapter); + modelAdapter = null; + + // unbind all active bindings + unbind(); + + Component parent = ((Component) kanban.getParent()); + if (parent != null && parent instanceof ComponentContainer) { + ((ComponentContainer) parent).removeComponent(kanban); + } + + // remove assocations + unassociateWidget(kanban); + + kanban = null; + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void internalDispose() { + try { + unrender(); + } finally { + super.internalDispose(); + } + } + + /** + * A helper class. + */ + private static class ModelAccess { + + /** The y field. */ + private final YKanban yField; + + /** + * Instantiates a new model access. + * + * @param yField + * the y field + */ + public ModelAccess(YKanban yField) { + super(); + this.yField = yField; + } + + /** + * Gets the css class. + * + * @return the css class + * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass() + */ + public String getCssClass() { + return yField.getCssClass(); + } + + /** + * Returns true, if the css class is not null and not empty. + * + * @return true, if is css class valid + */ + public boolean isCssClassValid() { + return getCssClass() != null && !getCssClass().equals(""); + } + + /** + * Gets the css id. + * + * @return the css id + * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID() + */ + public String getCssID() { + return yField.getCssID(); + } + + /** + * Returns true, if the css id is not null and not empty. + * + * @return true, if is css id valid + */ + public boolean isCssIdValid() { + return getCssID() != null && !getCssID().equals(""); + } + + /** + * Returns the label. + * + * @return the label + */ + public String getLabel() { + return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null; + } + + /** + * Returns the label. + * + * @return the label i18n key + */ + public String getLabelI18nKey() { + return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null; + } + } + + /** + * Converts the string value of the item icon property to + * {@link ThemeResource}. + */ + @SuppressWarnings("serial") + private class CustomKanbanBoard extends KanbanBoard { + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractField#getErrorMessage() + */ + @Override + public ErrorMessage getErrorMessage() { + if (isDisposed()) { + // after disposal, Vaadin will call this method once. + return null; + } + + ErrorMessage message = super.getErrorMessage(); + return message; + } + } + + private class CustomDropAdapter implements KanbanBoard.DropAdapter { + + @Override + public boolean dropAllowed(Enum<?> sourceState, Enum<?> targetState, Object itemId) { + return true; + } + + @Override + public boolean drop(Enum<?> sourceState, Enum<?> targetState, Object dto) { + cardStateChanged(sourceState, targetState, dto); + return true; + } + + } + + private class CustomFilterProvider implements KanbanBoard.FilterProvider { + + private FilterChangedListener listener; + + @Override + public Component getFilterComponent() { + return filteringComponent; + } + + @Override + public void setFilterChangedListener(FilterChangedListener listener) { + this.listener = listener; + } + + private void notifyChangedFilter() { + if (listener != null) { + listener.filterChanged(); + } + } + + @Override + public Filter getFilter() { + return filteringComponent.getFilter(); + } + + } + + private class CustomCardAdapter implements KanbanBoard.KanbanCardAdapter { + + @Override + public KanbanCard createCard(Object itemId) { + KanbanCard card = new CustomKanbanCard(DtoUtils.getIdValue(itemId).toString(), + BeanUtils.getKanbanState(itemId), itemId, cardView); + return card; + } + } + + @SuppressWarnings("serial") + private class CustomKanbanCard extends KanbanCard { + + private YView yView; + + public CustomKanbanCard(String id, Enum<?> cardState, Object dto, YView yView) { + super(id, cardState, dto); + this.yView = yView; + + initCard(); + } + + private void initCard() { + VerticalLayout content = new VerticalLayout(); + content.addStyleName("o-kanban-card-content"); + content.setSizeFull(); + content.setMargin(false); + content.setSpacing(false); + content.setEnabled(false); + + setContent(content); + try { + YView cardView = EcoreUtil.copy(yView); + + // add a vp for autobinded cards + if (cardView.getTags().contains("autobinded")) { + YKanbanVisibilityProcessor vp = ExtensionModelFactory.eINSTANCE.createYKanbanVisibilityProcessor(); + cardView.getVisibilityProcessors().add(vp); + } + + IViewContext context = new VaadinRenderer().render(content, cardView, null); + context.setBean(IViewContext.MAIN_BEAN_SLOT, dto); + } catch (ContextException e) { + e.printStackTrace(); + } + } + } + + private class AdapterCustom extends AdapterImpl { + @Override + public void notifyChanged(Notification msg) { + if (msg.getFeature() == ExtensionModelPackage.Literals.YKANBAN__TO_REFRESH) { + YKanbanEvent event = (YKanbanEvent) msg.getNewValue(); + if (event != null) { + kanban.refresh(event.dto); + } + } + } + } +}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java index e6d976a..d5511b1 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java
@@ -445,5 +445,9 @@ reportValidationError(message); return message; } + + public void clear() { + setValue("0"); + } } }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java index 18e0c25..46e2e59 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java
@@ -171,11 +171,15 @@ * @param field * the field */ - protected void createBindings(YPasswordField yField, PasswordField field) { + protected void createBindings(final YPasswordField yField, PasswordField field) { // create the model binding from ridget to ECView-model registerBinding(createBindings_Value(castEObject(getModel()), ExtensionModelPackage.Literals.YPASSWORD_FIELD__VALUE, text)); + field.addTextChangeListener(e -> { + yField.setLastTextChange(e.getText()); + }); + super.createBindings(yField, field, null); }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java index 5ef0a0b..71e4971 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java
@@ -29,10 +29,12 @@ import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumComboBoxEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumListEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumOptionsGroupEditpart; +import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IFilteringComponentEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IFormLayoutEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IGridLayoutEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IHorizontalLayoutEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IImageEditpart; +import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IKanbanEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ILabelEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IListEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IMasterDetailEditpart; @@ -55,10 +57,12 @@ import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITreeEditpart; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IVerticalLayoutEditpart; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; +import org.osgi.service.component.annotations.Component; /** * The presenter factory. */ +@Component(immediate = true, service = { IPresentationFactory.class }) public class PresenterFactory implements IPresentationFactory { public PresenterFactory() { @@ -71,7 +75,7 @@ return presentationURI != null && presentationURI.equals(VaadinRenderer.UI_KIT_URI); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public <A extends IWidgetPresentation<?>> A createPresentation(IViewContext uiContext, IElementEditpart editpart) throws IllegalArgumentException { @@ -155,9 +159,13 @@ return (A) new AbsoluteLayoutPresentation(editpart); } else if (editpart instanceof IPasswordFieldEditpart) { return (A) new PasswordFieldPresentation(editpart); + } else if (editpart instanceof IFilteringComponentEditpart) { + return (A) new FilteringComponentPresentation(editpart); + } else if (editpart instanceof IKanbanEditpart) { + return (A) new KanbanPresentation(editpart); } - throw new IllegalArgumentException(String.format("No presenter available for editpart %s[%s]", editpart.getClass().getName(), - editpart.getId())); + throw new IllegalArgumentException(String.format("No presenter available for editpart %s[%s]", + editpart.getClass().getName(), editpart.getId())); } }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java index 4416115..358b884 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java
@@ -39,6 +39,7 @@ import com.vaadin.data.util.ObjectProperty; import com.vaadin.server.ErrorMessage; import com.vaadin.ui.Component; +import com.vaadin.ui.Component.Focusable; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.Field; @@ -46,11 +47,9 @@ /** * This presenter is responsible to render a text field on the given layout. */ -public class SuggestTextFieldPresentation extends - AbstractFieldWidgetPresenter<Component> { +public class SuggestTextFieldPresentation extends AbstractFieldWidgetPresenter<Component> { - private static final Logger LOGGER = LoggerFactory - .getLogger(SuggestTextFieldPresentation.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SuggestTextFieldPresentation.class); /** The model access. */ private final ModelAccess modelAccess; @@ -67,6 +66,10 @@ /** The value binding. */ private Binding valueBinding; + private Binding keyBinding; + + private boolean updateBinding; + /** * Constructor. * @@ -75,8 +78,7 @@ */ public SuggestTextFieldPresentation(IElementEditpart editpart) { super((ISuggestTextFieldEditpart) editpart); - this.modelAccess = new ModelAccess( - (YSuggestTextField) editpart.getModel()); + this.modelAccess = new ModelAccess((YSuggestTextField) editpart.getModel()); } /** @@ -111,8 +113,7 @@ text.addSelectionChangedListener(new SuggestTextField.SelectionChangedListener() { @Override - public void selectionChanged( - SuggestTextField.SelectionChangedEvent event) { + public void selectionChanged(SuggestTextField.SelectionChangedEvent event) { Object itemId = event.getItemId(); internalSetLastSuggestion(itemId); } @@ -122,22 +123,18 @@ IBeanSearchServiceFactory factory = getViewContext() .getService(IBeanSearchServiceFactory.class.getName()); if (factory != null) { - ISharedStateContext sharedState = getViewContext() - .getService(ISharedStateContext.class.getName()); + ISharedStateContext sharedState = getViewContext().getService(ISharedStateContext.class.getName()); BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer( - factory.createService(modelAccess.yField.getType()), - modelAccess.yField.getType(), sharedState); + factory.createService(modelAccess.yField.getType()), modelAccess.yField.getType(), + sharedState); text.setContainerDataSource(datasource); - text.setCaptionPropertyId(modelAccess.yField - .getItemCaptionProperty()); - text.setFilterPropertyId(modelAccess.yField - .getItemFilterProperty()); + text.setCaptionPropertyId(modelAccess.yField.getItemCaptionProperty()); + text.setFilterPropertyId(modelAccess.yField.getItemFilterProperty()); String uuidProp = modelAccess.yField.getItemUUIDProperty(); if (uuidProp != null && !uuidProp.equals("")) { - text.setUniqueIdPropertyId(modelAccess.yField - .getItemUUIDProperty()); + text.setUniqueIdPropertyId(modelAccess.yField.getItemUUIDProperty()); } } } @@ -175,8 +172,7 @@ * Applies the labels to the widgets. */ protected void applyCaptions() { - Util.applyCaptions(getI18nService(), modelAccess.getLabel(), - modelAccess.getLabelI18nKey(), getLocale(), text); + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), text); } /* @@ -199,18 +195,15 @@ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint) */ @Override - protected IObservable internalGetObservableEndpoint( - YEmbeddableBindingEndpoint bindableValue) { + protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { if (bindableValue == null) { - throw new IllegalArgumentException( - "BindableValue must not be null!"); + throw new IllegalArgumentException("BindableValue must not be null!"); } if (bindableValue instanceof YEmbeddableValueEndpoint) { return internalGetValueEndpoint(); } - throw new IllegalArgumentException("Not a valid input: " - + bindableValue); + throw new IllegalArgumentException("Not a valid input: " + bindableValue); } /** @@ -232,8 +225,7 @@ * @param field * the field */ - protected void createBindings(YSuggestTextField yField, - SuggestTextField field) { + protected void createBindings(YSuggestTextField yField, SuggestTextField field) { updateValueBinding(field); super.createBindings(yField, field, null); @@ -252,29 +244,49 @@ unregisterBinding(valueBinding); } + if (keyBinding != null) { + unregisterBinding(keyBinding); + } + if (field == null) { return; } - field.setSuggestionEnabled(modelAccess.yField.isUseSuggestions()); + try { + updateBinding = true; - if (modelAccess.yField.isUseSuggestions()) { - // in suggest mode do not update from UI to model - valueBinding = createBindingsValue(castEObject(getModel()), - ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE, - field.getTextField(), new UpdateValueStrategy( - UpdateValueStrategy.POLICY_NEVER), - new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); - } else { - valueBinding = createBindingsValue(castEObject(getModel()), - ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE, - field.getTextField(), new UpdateValueStrategy( - UpdateValueStrategy.POLICY_UPDATE), - new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); + // suppress suggestions + field.setSuggestionEnabled(false); + + if (modelAccess.yField.isUseSuggestions()) { + // in suggest mode do not update from UI to model + keyBinding = createBindingsByAccessor(castEObject(getModel()), + ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__KEYS, field, "keys", + new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); + valueBinding = createBindingsValue(castEObject(getModel()), + ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE, field.getTextField(), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); + } else { + keyBinding = createBindingsByAccessor(castEObject(getModel()), + ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__KEYS, field, "keys", + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); + valueBinding = createBindingsValue(castEObject(getModel()), + ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE, field.getTextField(), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), + new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); + } + + field.setSuggestionEnabled(modelAccess.yField.isUseSuggestions()); + + // create the model binding from model to ECView-model + registerBinding(valueBinding); + registerBinding(keyBinding); + } finally { + updateBinding = false; } - - // create the model binding from ridget to ECView-model - registerBinding(valueBinding); } /* @@ -389,13 +401,14 @@ } protected void internalSetLastSuggestion(Object itemId) { - IReloadRequestService service = getViewContext() - .getService(IReloadRequestService.class.getName()); + IReloadRequestService service = getViewContext().getService(IReloadRequestService.class.getName()); if (service != null && itemId != null) { - service.requestReload(getCastedModel(), - itemId); + service.requestReload(getCastedModel(), itemId); } modelAccess.yField.setLastSuggestion(itemId); + if (itemId != null) { + modelAccess.yField.setEvent(YSuggestTextFieldEvents.SELECTED); + } } /** @@ -478,7 +491,9 @@ * The Class CustomTextField. */ @SuppressWarnings("serial") - private class CustomTextField extends SuggestTextField { + private class CustomTextField extends SuggestTextField implements Focusable { + + private int tabIndex; /* * (non-Javadoc) @@ -497,6 +512,48 @@ return message; } + @Override + public void focus() { + if (getTextField() != null) { + getTextField().focus(); + } + } + + @Override + protected TextFieldCustom createTextField() { + return new TextFieldCustom() { + @Override + public ErrorMessage getErrorMessage() { + if (isDisposed()) { + // after disposal, Vaadin will call this method once. + return null; + } + + ErrorMessage message = super.getErrorMessage(); + reportValidationError(message); + return message; + } + }; + } + + @Override + public void setSuggestionEnabled(boolean suggestionEnabled) { + super.setSuggestionEnabled(suggestionEnabled); + + if (!updateBinding) { + modelAccess.yField.setUseSuggestions(suggestionEnabled); + } + } + + public int getTabIndex() { + return tabIndex; + } + + @Override + public void setTabIndex(int tabIndex) { + this.tabIndex = tabIndex; + } + } /** @@ -518,8 +575,7 @@ } else if (msg.getFeature() == ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__AUTO_HIDE_POPUP) { text.setAutoHide(msg.getNewBooleanValue()); } else if (msg.getFeature() == ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__EVENT) { - YSuggestTextFieldEvents event = (YSuggestTextFieldEvents) msg - .getNewValue(); + YSuggestTextFieldEvents event = (YSuggestTextFieldEvents) msg.getNewValue(); if (event != null) { doExecuteEvent(event); }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java index 1875af6..75ab089 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java
@@ -15,12 +15,21 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Map.Entry; import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; import org.eclipse.emf.databinding.EMFProperties; +import org.eclipse.osbp.blob.component.BlobComponent; +import org.eclipse.osbp.dsl.semantic.dto.util.NamingConventionsUtil; import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart; import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart; @@ -32,6 +41,8 @@ import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint; import org.eclipse.osbp.ecview.core.common.model.core.YFlatAlignment; import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatadescription; +import org.eclipse.osbp.ecview.core.common.notification.ILifecycleEvent; +import org.eclipse.osbp.ecview.core.common.notification.ILifecycleService; import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory; import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable; import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage; @@ -40,8 +51,13 @@ import org.eclipse.osbp.ecview.core.extension.model.extension.YSortColumn; import org.eclipse.osbp.ecview.core.extension.model.extension.YTable; import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITableEditpart; +import org.eclipse.osbp.ecview.extension.api.ILayoutingStrategy; import org.eclipse.osbp.runtime.common.annotations.DtoUtils; import org.eclipse.osbp.runtime.common.annotations.PropertiesUtil; +import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent; +import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherCommand; +import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherDataTag; +import org.eclipse.osbp.runtime.common.event.IEventDispatcher; import org.eclipse.osbp.runtime.common.i18n.I18nUtil; import org.eclipse.osbp.runtime.common.i18n.II18nService; import org.eclipse.osbp.runtime.common.state.ISharedStateContext; @@ -49,22 +65,29 @@ import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util; import org.eclipse.osbp.runtime.web.vaadin.common.converter.StringToFormattedNumberConverter; import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer; +import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItem; import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer; import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService; import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanToUniqueHashIdProvider; import org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable; import org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble; import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; +import org.eclipse.osbp.ui.api.customfields.IBlobService; import com.vaadin.data.Container; import com.vaadin.data.Container.Filter; import com.vaadin.data.Container.Filterable; import com.vaadin.data.Item; import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; import com.vaadin.data.util.ObjectProperty; import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.ConverterUtil; +import com.vaadin.server.ClientConnector; +import com.vaadin.server.ClientConnector.AttachEvent; +import com.vaadin.server.ClientConnector.DetachEvent; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; import com.vaadin.server.ThemeResource; @@ -78,13 +101,13 @@ import com.vaadin.ui.Table.RowHeaderMode; import com.vaadin.ui.UI; -// TODO: Auto-generated Javadoc /** * This presenter is responsible to render a table on the given layout. */ -@SuppressWarnings("restriction") +@SuppressWarnings({ "restriction", "serial" }) public class TablePresentation extends AbstractFieldWidgetPresenter<Component> - implements IFilterablePresentation, IRefreshRowsPresentation { + implements IFilterablePresentation, IRefreshRowsPresentation, ClientConnector.DetachListener, + ClientConnector.AttachListener, IEventDispatcher.Receiver { /** The model access. */ private final ModelAccess modelAccess; @@ -101,6 +124,12 @@ private boolean containerReadonly; + private AdapterCustom adapter; + + private IEventDispatcher eventDispatcher; + + private IBlobService blobService; + /** * Constructor. * @@ -110,6 +139,8 @@ public TablePresentation(IElementEditpart editpart) { super((ITableEditpart) editpart); this.modelAccess = new ModelAccess((YTable) editpart.getModel()); + adapter = new AdapterCustom(); + this.modelAccess.yField.eAdapters().add(adapter); } /** @@ -119,7 +150,6 @@ @Override public Component doCreateWidget(Object parent) { if (table == null) { - table = new CustomTable(); table.addStyleName(CSS_CLASS_CONTROL); table.setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI); @@ -127,6 +157,36 @@ table.setImmediate(true); setupComponent(table, getCastedModel()); + table.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { + Class<?> bean = modelAccess.yField.getType(); + if (bean != null) { + eventDispatcher = getViewContext().getService(IEventDispatcher.class.getName()); + blobService = getViewContext().getService(IBlobService.class.getName()); + String topic = NamingConventionsUtil.toFqnEntityName(bean.getName()) + "." + + DtoUtils.getIdField(bean).getName(); + EventDispatcherEvent evnt = new EventDispatcherEvent(EventDispatcherCommand.SELECT, topic, + toString()); + Object value = table.getValue(); + if (value != null) { + if (table.getContainerDataSource() instanceof DeepResolvingBeanItemContainer) { + DeepResolvingBeanItemContainer container = (DeepResolvingBeanItemContainer) table + .getContainerDataSource(); + DeepResolvingBeanItem<?> item = container.getItem(value); + if (item != null) { + evnt.addItem(EventDispatcherDataTag.ID, DtoUtils.getIdValue(item.getBean())); + eventDispatcher.sendEvent(evnt); + } + } + } else { + evnt.addItem(EventDispatcherDataTag.ID, null); + eventDispatcher.sendEvent(evnt); + } + } + } + }); + associateWidget(table, modelAccess.yField); if (modelAccess.isCssIdValid()) { table.setId(modelAccess.getCssID()); @@ -138,8 +198,7 @@ property = new ObjectProperty(new HashSet(), Set.class); } else { if (modelAccess.yField.getType() != null) { - property = new ObjectProperty(null, - modelAccess.yField.getType()); + property = new ObjectProperty(null, modelAccess.yField.getType()); } else { property = new ObjectProperty(null, Object.class); } @@ -155,19 +214,15 @@ if (modelAccess.yField.getType() != null) { IBeanSearchService<?> service = null; IBeanSearchServiceFactory factory = getViewContext() - .getService( - IBeanSearchServiceFactory.class.getName()); + .getService(IBeanSearchServiceFactory.class.getName()); if (factory != null) { - service = factory.createService(modelAccess.yField - .getType()); + service = factory.createService(modelAccess.yField.getType()); } - if (modelAccess.yField.isUseBeanService() - && service != null) { + if (modelAccess.yField.isUseBeanService() && service != null) { ISharedStateContext sharedState = getViewContext() .getService(ISharedStateContext.class.getName()); - BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer( - service, modelAccess.yField.getType(), - sharedState); + BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(service, + modelAccess.yField.getType(), sharedState); table.setContainerDataSource(datasource); containerReadonly = true; } else { @@ -179,15 +234,13 @@ } else { IndexedContainer container = new IndexedContainer(); container.addContainerProperty("for", String.class, null); - container.addContainerProperty("preview", String.class, - null); + container.addContainerProperty("preview", String.class, null); container.addItem(new String[] { "Some value", "other" }); table.setContainerDataSource(container); } } - String itemImageProperty = modelAccess.yField - .getItemImageProperty(); + String itemImageProperty = modelAccess.yField.getItemImageProperty(); if (itemImageProperty != null && !itemImageProperty.equals("")) { table.setItemIconPropertyId(itemImageProperty); table.setRowHeaderMode(RowHeaderMode.EXPLICIT); @@ -228,23 +281,19 @@ Class<?> type = modelAccess.yField.getType(); // set the visible columns and icons - List<String> columns = new ArrayList<String>(); - Collection<?> propertyIds = table.getContainerDataSource() - .getContainerPropertyIds(); + List<String> columns = new ArrayList<>(); + Collection<?> propertyIds = table.getContainerDataSource().getContainerPropertyIds(); if (!modelAccess.yField.getColumns().isEmpty()) { for (YColumn yColumn : modelAccess.yField.getColumns()) { - if (yColumn.isVisible() - && propertyIds.contains(yColumn.getPropertyPath()) - || isNestedColumn(yColumn)) { + if (yColumn.isVisible() && propertyIds.contains(yColumn.getPropertyPath()) || isNestedColumn(yColumn)) { columns.add(yColumn.getPropertyPath()); } } // add nested properties if (table.getContainerDataSource() instanceof INestedPropertyAble) { - INestedPropertyAble<?> container = (INestedPropertyAble<?>) table - .getContainerDataSource(); + INestedPropertyAble<?> container = (INestedPropertyAble<?>) table.getContainerDataSource(); for (String property : columns) { if (property.contains(".")) { container.addNestedContainerProperty(property); @@ -255,8 +304,7 @@ table.setVisibleColumns(columns.toArray(new Object[columns.size()])); table.setColumnCollapsingAllowed(true); - II18nService i18nService = getViewContext().getService( - II18nService.class.getName()); + II18nService i18nService = getViewContext().getService(II18nService.class.getName()); IResourceProvider resourceProvider = (IResourceProvider) getViewContext() .getService(IResourceProvider.class.getName()); // traverse the columns again and set other properties @@ -266,14 +314,11 @@ String columnId = yColumn.getPropertyPath(); table.setColumnHeader(columnId, getColumnHeader(yColumn)); - table.setColumnAlignment(columnId, - toAlign(yColumn.getAlignment())); + table.setColumnAlignment(columnId, toAlign(yColumn.getAlignment())); table.setColumnCollapsed(columnId, yColumn.isCollapsed()); - table.setColumnCollapsible(columnId, - yColumn.isCollapsible()); + table.setColumnCollapsible(columnId, yColumn.isCollapsible()); if (yColumn.getExpandRatio() >= 0) { - table.setColumnExpandRatio(columnId, - yColumn.getExpandRatio()); + table.setColumnExpandRatio(columnId, yColumn.getExpandRatio()); } // Boolean check to display a checkbox instead of the // boolean value as String. @@ -281,74 +326,86 @@ // check to avoid an IllegalArgumentException adding an // already existing ColumnGenerator. if (table.getColumnGenerator(columnId) == null) { - table.addGeneratedColumn(columnId, - new Table.ColumnGenerator() { - public Component generateCell( - Table source, Object itemId, - Object columnId) { - Item item = table.getItem(itemId); - CheckBox box = new CheckBox(); - box.setEnabled(false); - Boolean value = (Boolean) item - .getItemProperty(columnId) - .getValue(); - box.setValue(value); - return box; - } - }); + table.addGeneratedColumn(columnId, new Table.ColumnGenerator() { + @Override + public Component generateCell(Table source, Object itemId, Object columnId) { + Item item = table.getItem(itemId); + CheckBox box = new CheckBox(); + box.setEnabled(false); + Boolean value = (Boolean) item.getItemProperty(columnId).getValue(); + box.setValue(value); + return box; + } + }); } } // -------------- - if (yColumn.getIcon() != null - && !yColumn.getIcon().equals("")) { + if (yColumn.getIcon() != null && !yColumn.getIcon().equals("")) { if (i18nService != null) { - String translation = i18nService.getValue(yColumn - .getIcon(), UI.getCurrent().getLocale()); + String translation = i18nService.getValue(yColumn.getIcon(), UI.getCurrent().getLocale()); if (translation != null && !translation.equals("")) { - Resource icon = resourceProvider - .getResource(translation); + Resource icon = resourceProvider.getResource(translation); if (icon != null) { table.setColumnIcon(columnId, icon); } } } else { - table.setColumnIcon(columnId, resourceProvider - .getResource(yColumn.getIcon())); + table.setColumnIcon(columnId, resourceProvider.getResource(yColumn.getIcon())); } } + // Blob check to display a blob image + if ((yColumn.getType() == String.class) + && ((yColumn.getProperties() != null) && (!yColumn.getProperties().isEmpty()))) { + Stream<Entry<String, String>> propertyStream = yColumn.getProperties().stream() + .filter(prop -> prop.getKey().equalsIgnoreCase(ILayoutingStrategy.PROPERTY_BLOB)); + // Only if one 'Blob' or 'blob' property entry exists + if (propertyStream.count() == 1) { + String displayResolution = yColumn.getProperties().stream() + .filter(prop -> prop.getKey().equalsIgnoreCase(ILayoutingStrategy.PROPERTY_BLOB)) + .map(p -> p.getValue()).collect(Collectors.joining()); + // check to avoid an IllegalArgumentException adding + // an + // already existing ColumnGenerator. + if (table.getColumnGenerator(columnId) == null) { + table.addGeneratedColumn(columnId, new Table.ColumnGenerator() { + + @Override + public Component generateCell(Table source, Object itemId, Object columnId) { + Item item = table.getItem(itemId); + BlobComponent blob = new BlobComponent(blobService, (String) item.getItemProperty(columnId).getValue(), Integer.parseInt(displayResolution)); + return blob; + } + }); + } + } + } + } } // apply the converters // - for (YColumn yColumn : modelAccess.yField.getColumns()) { + for ( + + YColumn yColumn : modelAccess.yField.getColumns()) { if (yColumn.getConverter() == null) { // try to derive the converter from the datatype property at // field level String columnId = yColumn.getPropertyPath(); - Class<?> resultClass = table.getContainerDataSource() - .getType(columnId); + Class<?> resultClass = table.getContainerDataSource().getType(columnId); if (Number.class.isAssignableFrom(resultClass) - && PropertiesUtil.hasKey(type, columnId, - "decimalformat")) { - String format = PropertiesUtil.getValue(type, columnId, - "decimalformat"); + && PropertiesUtil.hasKey(type, columnId, "decimalformat")) { + String format = PropertiesUtil.getValue(type, columnId, "decimalformat"); if (format != null && !format.isEmpty()) { - table.setConverter( - columnId, - new StringToFormattedNumberConverter( - format, - (Class<? extends Number>) resultClass)); + table.setConverter(columnId, new StringToFormattedNumberConverter(format, + (Class<? extends Number>) resultClass)); } } } else { @SuppressWarnings("rawtypes") - Converter converter = (Converter) DelegatingConverterFactory - .getInstance().createConverter( - getViewContext(), - (IConverterEditpart) ElementEditpart - .getEditpart(getViewContext(), - yColumn.getConverter())); + Converter converter = (Converter) DelegatingConverterFactory.getInstance().createConverter( + getViewContext(), + (IConverterEditpart) ElementEditpart.getEditpart(getViewContext(), yColumn.getConverter())); if (converter != null) { String columnId = yColumn.getPropertyPath(); table.setConverter(columnId, converter); @@ -371,13 +428,11 @@ table.setCellStyleGenerator(new Table.CellStyleGenerator() { @Override - public String getStyle(Table source, Object itemId, - Object propertyId) { + public String getStyle(Table source, Object itemId, Object propertyId) { if (itemId == null || propertyId == null) { return ""; } - if (Number.class.isAssignableFrom(source - .getContainerDataSource().getType(propertyId))) { + if (Number.class.isAssignableFrom(source.getContainerDataSource().getType(propertyId))) { return " v-align-right"; } return ""; @@ -430,30 +485,36 @@ // add the nested sort columns to the container if (isNestedColumn(yColumn)) { if (table.getContainerDataSource() instanceof INestedPropertyAble) { - INestedPropertyAble<?> container = (INestedPropertyAble<?>) table - .getContainerDataSource(); - container.addNestedContainerProperty(yColumn - .getPropertyPath()); + INestedPropertyAble<?> container = (INestedPropertyAble<?>) table.getContainerDataSource(); + container.addNestedContainerProperty(yColumn.getPropertyPath()); } } sortCol.add(yColumn.getPropertyPath()); sortDirection.add(yColumn.isAsc()); } - Container.Sortable sortable = (Container.Sortable) table - .getContainerDataSource(); + Container.Sortable sortable = (Container.Sortable) table.getContainerDataSource(); boolean[] asc = new boolean[sortDirection.size()]; for (int i = 0; i < sortDirection.size(); i++) { asc[i] = sortDirection.get(i); } - sortable.sort(sortCol.toArray(new String[sortCol.size()]), asc); - - if (!sortCol.isEmpty()) { - table.setSortContainerPropertyId(sortCol.get(0)); - table.setSortAscending(asc[0]); + ILifecycleService lfService = getViewContext().getService(ILifecycleService.class.getName()); + if(!lfService.getState().equals(ILifecycleEvent.TYPE_RENDERING)) { + sortable.sort(sortCol.toArray(new String[sortCol.size()]), asc); + if (!sortCol.isEmpty()) { + table.setSortContainerPropertyId(sortCol.get(0)); + table.setSortAscending(asc[0]); + } } + + } + } + + public void doSort() { + if (table != null) { + table.sort(); } } @@ -481,8 +542,7 @@ * @return true, if is nested column */ protected boolean isNestedColumn(YColumn yColumn) { - return yColumn.getPropertyPath() != null - && yColumn.getPropertyPath().contains("."); + return yColumn.getPropertyPath() != null && yColumn.getPropertyPath().contains("."); } /** @@ -493,8 +553,7 @@ * @return true, if is nested column */ protected boolean isNestedColumn(YSortColumn yColumn) { - return yColumn.getPropertyPath() != null - && yColumn.getPropertyPath().contains("."); + return yColumn.getPropertyPath() != null && yColumn.getPropertyPath().contains("."); } /** @@ -571,8 +630,7 @@ applyColumns(); } - Util.applyCaptions(getI18nService(), modelAccess.getLabel(), - modelAccess.getLabelI18nKey(), getLocale(), table); + Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), table); } /* @@ -589,11 +647,9 @@ filterable.removeAllContainerFilters(); if (filter != null) { filterable.addContainerFilter((Filter) filter); - } else { - if (container instanceof ILazyRefreshFilterable) { - ILazyRefreshFilterable lazyFilterable = (ILazyRefreshFilterable) container; - lazyFilterable.refreshFilters(); - } + } else if (container instanceof ILazyRefreshFilterable) { + ILazyRefreshFilterable lazyFilterable = (ILazyRefreshFilterable) container; + lazyFilterable.removeAllContainerFilters(); } } } @@ -618,11 +674,9 @@ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint) */ @Override - protected IObservable internalGetObservableEndpoint( - YEmbeddableBindingEndpoint bindableValue) { + protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) { if (bindableValue == null) { - throw new IllegalArgumentException( - "BindableValue must not be null!"); + throw new IllegalArgumentException("BindableValue must not be null!"); } if (bindableValue instanceof YEmbeddableCollectionEndpoint) { @@ -632,8 +686,7 @@ } else if (bindableValue instanceof YEmbeddableMultiSelectionEndpoint) { return internalGetMultiSelectionEndpoint(); } - throw new IllegalArgumentException("Not a valid input: " - + bindableValue); + throw new IllegalArgumentException("Not a valid input: " + bindableValue); } /** @@ -643,9 +696,7 @@ */ protected IObservableList internalGetCollectionEndpoint() { // return the observable value for text - return EMFProperties.list( - ExtensionModelPackage.Literals.YTABLE__COLLECTION).observe( - getModel()); + return EMFProperties.list(ExtensionModelPackage.Literals.YTABLE__COLLECTION).observe(getModel()); } /** @@ -655,16 +706,13 @@ * the y endpoint * @return the i observable value */ - protected IObservableValue internalGetSelectionEndpoint( - YEmbeddableSelectionEndpoint yEndpoint) { + protected IObservableValue internalGetSelectionEndpoint(YEmbeddableSelectionEndpoint yEndpoint) { - String attributePath = ECViewModelBindable.getAttributePath( - ExtensionModelPackage.Literals.YTABLE__SELECTION, + String attributePath = ECViewModelBindable.getAttributePath(ExtensionModelPackage.Literals.YTABLE__SELECTION, yEndpoint.getAttributePath()); // return the observable value for text - return ECViewModelBindable.observeValue(castEObject(getModel()), - attributePath, modelAccess.yField.getType(), + return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yField.getType(), modelAccess.yField.getEmfNsURI()); } @@ -675,9 +723,7 @@ */ protected IObservableList internalGetMultiSelectionEndpoint() { // return the observable value for text - return EMFProperties.list( - ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION) - .observe(getModel()); + return EMFProperties.list(ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION).observe(getModel()); } /** @@ -690,23 +736,18 @@ */ protected void createBindings(YTable yField, Table field) { // create the model binding from ridget to ECView-model - registerBinding(createBindingsContainerContents( - castEObject(getModel()), - ExtensionModelPackage.Literals.YTABLE__COLLECTION, field, - yField.getType(), containerReadonly)); + registerBinding(createBindingsContainerContents(castEObject(getModel()), + ExtensionModelPackage.Literals.YTABLE__COLLECTION, field, yField.getType(), containerReadonly)); // create the model binding from ridget to ECView-model if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) { // create the model binding from ridget to ECView-model - registerBinding(createBindingsMultiSelection( - castEObject(getModel()), - ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION, - field, yField.getType())); + registerBinding(createBindingsMultiSelection(castEObject(getModel()), + ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION, field, yField.getType())); } else { // create the model binding from ridget to ECView-model registerBinding(createBindingsSelection(castEObject(getModel()), - ExtensionModelPackage.Literals.YTABLE__SELECTION, field, - yField.getType())); + ExtensionModelPackage.Literals.YTABLE__SELECTION, field, yField.getType())); } @@ -747,7 +788,7 @@ // unbind all active bindings unbind(); - Component parent = ((Component) table.getParent()); + Component parent = (table.getParent()); if (parent != null && parent instanceof ComponentContainer) { ((ComponentContainer) parent).removeComponent(table); } @@ -766,6 +807,9 @@ protected void internalDispose() { try { unrender(); + + modelAccess.yField.eAdapters().remove(adapter); + } finally { super.internalDispose(); } @@ -834,8 +878,7 @@ * @return the label */ public String getLabel() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabel() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null; } /** @@ -844,8 +887,7 @@ * @return the label i18n key */ public String getLabelI18nKey() { - return yField.getDatadescription() != null ? yField - .getDatadescription().getLabelI18nKey() : null; + return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null; } } @@ -858,6 +900,47 @@ /** The item icon property id. */ private Object itemIconPropertyId; + private String itemIdHash; + private boolean updateMode; + + private Timer sortTimer; + private boolean isSorting; + + @SuppressWarnings("unchecked") + CustomTable() { + addValueChangeListener(e -> { + if (getContainerDataSource() instanceof IBeanToUniqueHashIdProvider) { + IBeanToUniqueHashIdProvider<Object> hashIdProvider = (IBeanToUniqueHashIdProvider<Object>) getContainerDataSource(); + Object selection = e.getProperty().getValue(); + this.itemIdHash = hashIdProvider.getUniqueHashId(selection); + } + }); + addItemSetChangeListener(e -> { + if (isSorting || getSortContainerPropertyId() == null || getUI() == null) { + return; + } + if (sortTimer != null) { + sortTimer.cancel(); + } + sortTimer = new Timer(); + sortTimer.schedule(new TimerTask() { + @Override + public void run() { + try { + isSorting = true; + getUI().accessSynchronously(() -> { + sort(); + if (modelAccess.yField.isScrollToBottom()) { + setCurrentPageFirstItemIndex(size() - 1); + } + }); + } finally { + isSorting = false; + } + } + }, 125); + }); + } /* * (non-Javadoc) @@ -866,8 +949,7 @@ * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) */ @Override - public void setItemIconPropertyId(Object propertyId) - throws IllegalArgumentException { + public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { if (propertyId == null) { super.setItemIconPropertyId(propertyId); } else if (!getContainerPropertyIds().contains(propertyId)) { @@ -884,9 +966,9 @@ * * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId() */ + @Override public Object getItemIconPropertyId() { - return itemIconPropertyId != null ? itemIconPropertyId : super - .getItemIconPropertyId(); + return itemIconPropertyId != null ? itemIconPropertyId : super.getItemIconPropertyId(); } /* @@ -894,12 +976,12 @@ * * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object) */ + @Override public Resource getItemIcon(Object itemId) { if (itemIconPropertyId == null) { return super.getItemIcon(itemId); } else { - final Property<?> ip = getContainerProperty(itemId, - getItemIconPropertyId()); + final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId()); if (ip == null) { return null; } @@ -917,9 +999,9 @@ * @see com.vaadin.ui.Table#formatPropertyValue(java.lang.Object, * java.lang.Object, com.vaadin.data.Property) */ + @Override @SuppressWarnings({ "unchecked", "rawtypes" }) - protected String formatPropertyValue(Object rowId, Object colId, - Property<?> property) { + protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) { if (property == null) { return ""; } @@ -928,23 +1010,18 @@ if (hasConverter(colId)) { converter = getConverter(colId); } else { - converter = (Converter) ConverterUtil.getConverter( - String.class, property.getType(), getSession()); + converter = (Converter) ConverterUtil.getConverter(String.class, property.getType(), getSession()); } Object value = property.getValue(); if (converter != null) { - return converter.convertToPresentation(value, String.class, - getLocale()); + return converter.convertToPresentation(value, String.class, getLocale()); } else { if (value instanceof Enum<?>) { - return I18nUtil.translateEnum(getI18nService(), value, - getLocale()); + return I18nUtil.translateEnum(getI18nService(), value, getLocale()); } else if (value instanceof Boolean) { - return I18nUtil.translateBoolean(getI18nService(), - (Boolean) value, getLocale()); + return I18nUtil.translateBoolean(getI18nService(), (Boolean) value, getLocale()); } else if (value instanceof Number) { - return I18nUtil.translateNumber(getI18nService(), - (Number) value, getLocale()); + return I18nUtil.translateNumber(getI18nService(), (Number) value, getLocale()); } } return (null != value) ? value.toString() : ""; @@ -978,5 +1055,77 @@ setValue(getCurrentPageFirstItemId()); } + + @Override + @SuppressWarnings("unchecked") + public void setContainerDataSource(Container newDataSource) { + super.setContainerDataSource(newDataSource); + + if (getContainerDataSource() instanceof DeepResolvingBeanItemContainer) { + @SuppressWarnings("rawtypes") + final DeepResolvingBeanItemContainer ds = (DeepResolvingBeanItemContainer) getContainerDataSource(); + ds.addItemSetChangeListener(e -> { + + // lazy update the table selection + if (!updateMode && itemIdHash != null) { + updateMode = true; + final String targetItemIdHash = itemIdHash; + getUI().accessSynchronously(() -> { + for (Object itemId : e.getContainer().getItemIds()) { + if (targetItemIdHash.equals(ds.getUniqueHashId(itemId))) { + table.setValue(itemId); + break; + } + } + updateMode = false; + }); + } + }); + } + } } -} + + private class AdapterCustom extends AdapterImpl { + @Override + public void notifyChanged(Notification notification) { + int featureId = notification.getFeatureID(YTable.class); + switch (notification.getEventType()) { + case Notification.SET: + if (featureId == ExtensionModelPackage.YTABLE__DO_SORT) { + doSort(); + } + break; + default: + + } + } + } + + @Override + public void receiveEvent(EventDispatcherEvent event) { + switch (event.getCommand()) { + case REFRESH: + // if(!event.getSender().equals("net.osbee.sample.foodmart.tables.CashRegister")) + // { + // if(event.getTopic().equals("net.osbee.sample.foodmart.entities.CashRegister")){ + refreshRows(); + // } + // } + break; + case SELECT: + break; + default: + break; + } + } + + @Override + public void attach(AttachEvent event) { + eventDispatcher.addEventReceiver(this); + } + + @Override + public void detach(DetachEvent event) { + eventDispatcher.removeEventReceiver(this); + } +} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java index 8bdf4a7..a12556b 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java
@@ -14,7 +14,6 @@ import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.databinding.EMFObservables; import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint; @@ -169,10 +168,14 @@ * @param field * the field */ - protected void createBindings(YTextArea yField, TextArea field) { + protected void createBindings(final YTextArea yField, TextArea field) { registerBinding(createBindings_Value(castEObject(getModel()), ExtensionModelPackage.Literals.YTEXT_AREA__VALUE, textArea)); + field.addTextChangeListener(e -> { + yField.setLastTextChange(e.getText()); + }); + super.createBindings(yField, field, null); }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java index 8a465e5..36ec67b 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java
@@ -71,7 +71,7 @@ text.setNullRepresentation(""); text.setImmediate(true); setupComponent(text, getCastedModel()); - + associateWidget(text, modelAccess.yField); if (modelAccess.isCssIdValid()) { text.setId(modelAccess.getCssID()); @@ -161,11 +161,15 @@ * @param field * the field */ - protected void createBindings(YTextField yField, TextField field) { + protected void createBindings(final YTextField yField, TextField field) { // create the model binding from ridget to ECView-model registerBinding(createBindings_Value(castEObject(getModel()), ExtensionModelPackage.Literals.YTEXT_FIELD__VALUE, text)); - + + field.addTextChangeListener(e -> { + yField.setLastTextChange(e.getText()); + }); + super.createBindings(yField, field, null); }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java index 7d0d296..0e7a449 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java
@@ -37,15 +37,16 @@ import org.eclipse.osbp.ecview.core.util.emf.ModelUtil; import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable; import org.eclipse.osbp.runtime.common.state.ISharedStateContext; -import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator; import org.eclipse.osbp.runtime.designer.api.IDesignerService; import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent; import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType; import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener; +import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services.WidgetAssocationsService; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services.WidgetMouseClickService; import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables; +import org.eclipse.osbp.vaadin.addons.suggesttext.SuggestTextField; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,6 +57,7 @@ import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.CssLayout; import com.vaadin.ui.GridLayout; +import com.vaadin.ui.TextField; import com.vaadin.ui.UI; import com.vaadin.ui.Window; @@ -365,6 +367,13 @@ .getWidget(); if (component instanceof Focusable) { ((Focusable) component).focus(); + + if(component instanceof TextField){ + ((TextField) component).selectAll(); + }else if(component instanceof SuggestTextField){ + SuggestTextField field = (SuggestTextField) component; + field.getTextField().selectAll(); + } } } }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java index a79a04b..c9ae475 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java
@@ -17,13 +17,12 @@ import org.eclipse.osbp.runtime.common.dispose.IDisposable; import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer; import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables; +import org.osgi.service.component.annotations.Component; -import com.vaadin.ui.Component; - -// TODO: Auto-generated Javadoc /** * The Class BindingManagerProvider. */ +@Component(immediate = true, service = { IServiceProvider.class }, property={"ecview.serviceprovider.level:String=view"}) public class BindingManagerProvider implements IServiceProvider { /* (non-Javadoc) @@ -55,7 +54,7 @@ IViewContext viewContext = (IViewContext) context; final BindingManager bindingManager = new BindingManager(viewContext, VaadinObservables.getRealm(VaadinObservables - .getUI((Component) viewContext.getRootLayout()))); + .getUI((com.vaadin.ui.Component) viewContext.getRootLayout()))); viewContext.addDisposeListener(new IDisposable.Listener() { @Override public void notifyDisposed(IDisposable notifier) {
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java index 66b1b1f..2887ec4 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java
@@ -13,8 +13,8 @@ public class EnumOptionBean { private final Enum<?> enumx; - private final String description; - private final String imagePath; + private String description; + private String imagePath; public EnumOptionBean(Enum<?> enumx, String description, String imagePath) { super(); @@ -44,4 +44,12 @@ return imagePath; } + public void setDescription(String description) { + this.description = description; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java index 69b2ac5..7713f81 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java
@@ -17,6 +17,8 @@ import org.eclipse.osbp.runtime.common.i18n.I18nUtil; import org.eclipse.osbp.runtime.common.i18n.II18nService; +import com.vaadin.data.util.BeanItemContainer; + // TODO: Auto-generated Javadoc /** * The Class EnumOptionBeanHelper. @@ -24,8 +26,9 @@ public class EnumOptionBeanHelper { /** - * Creates a list of enum options for the given enum. The services are used for internationalization und to find a proper image for the enum literal. Services and locale may be - * <code>null</code>. + * Creates a list of enum options for the given enum. The services are used + * for internationalization und to find a proper image for the enum literal. + * Services and locale may be <code>null</code>. * * @param enumClass * the enum class @@ -35,7 +38,8 @@ * the locale * @return the beans */ - public static List<EnumOptionBean> getBeans(Class<? extends Enum<?>> enumClass, II18nService i18nService, Locale locale) { + public static List<EnumOptionBean> getBeans(Class<? extends Enum<?>> enumClass, II18nService i18nService, + Locale locale) { // String enumName = enumClass.getCanonicalName(); String enumName = enumClass.getSimpleName(); @@ -44,7 +48,9 @@ for (Enum<?> literal : enumClass.getEnumConstants()) { String description = literal.name(); if (i18nService != null) { - // String temp = i18nService.getValue(I18nUtil.getI18nKey(enumName, literal), locale); + // String temp = + // i18nService.getValue(I18nUtil.getI18nKey(enumName, literal), + // locale); String temp = i18nService.getValue(literal.name(), locale); if (temp != null && !temp.equals("")) { description = temp; @@ -53,7 +59,9 @@ String imagePath = null; if (i18nService != null) { - // imagePath = i18nService.getValue(I18nUtil.getImageI18nKey(enumName, literal), locale); + // imagePath = + // i18nService.getValue(I18nUtil.getImageI18nKey(enumName, + // literal), locale); imagePath = I18nUtil.getImageI18nKey(enumName, literal); } @@ -63,4 +71,22 @@ return result; } + public static void updateLocale(BeanItemContainer<EnumOptionBean> beans, II18nService i18nService, Locale locale) { + + for (EnumOptionBean bean : beans.getItemIds()) { + + Enum<?> enumx = bean.getEnumx(); + + String description = enumx.name(); + if (i18nService != null) { + String temp = i18nService.getValue(enumx.name(), locale); + if (temp != null && !temp.equals("")) { + description = temp; + } + } + bean.setDescription(description); + } + + } + }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java index 516bfc6..dfcf135 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java
@@ -12,16 +12,16 @@ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services; import java.util.Map; - + import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart; import org.eclipse.osbp.ecview.core.common.model.core.YElement; +import org.eclipse.osbp.ecview.core.common.model.core.YFocusable; import org.eclipse.osbp.ecview.core.common.services.AbstractWidgetAssocationsService; import com.vaadin.ui.Component; -public class WidgetAssocationsService extends - AbstractWidgetAssocationsService<Component, YElement> { +public class WidgetAssocationsService extends AbstractWidgetAssocationsService<Component, YElement> { @Override public YElement getModelElement(String id) { @@ -42,4 +42,20 @@ return yElement != null ? ElementEditpart.findEditPartFor(yElement) : null; } + @Override + public YElement getModelElement(int layoutIdx) { + synchronized (associations) { + for (Map.Entry<Component, YElement> entry : associations.entrySet()) { + YElement yElement = entry.getValue(); + if (yElement instanceof YFocusable) { + int yElementLayoutIdx = ((YFocusable) yElement).getLayoutIdx(); + if (layoutIdx == yElementLayoutIdx) { + return yElement; + } + } + } + } + return null; + } + }
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java index ded2ef2..d714a18 100644 --- a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java +++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java
@@ -15,6 +15,7 @@ import java.util.Locale; import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable; +import org.eclipse.osbp.ecview.core.common.model.core.util.II18nConstants; import org.eclipse.osbp.ecview.core.common.model.visibility.VisibilityFactory; import org.eclipse.osbp.ecview.core.common.model.visibility.YColor; import org.eclipse.osbp.ecview.core.common.model.visibility.YVisibilityProperties; @@ -30,12 +31,13 @@ import com.vaadin.server.ErrorMessage; import com.vaadin.server.ErrorMessage.ErrorLevel; import com.vaadin.server.Resource; -import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Component; // TODO: Auto-generated Javadoc /** - * The Class Util. + * The Class Util. TODO - merge with + * org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util + * later */ public class Util { @@ -46,10 +48,8 @@ * the handler * @return the y visibility properties */ - public static YVisibilityProperties mapYProperties( - IVisibilityHandler handler) { - YVisibilityProperties yProps = VisibilityFactory.eINSTANCE - .createYVisibilityProperties(); + public static YVisibilityProperties mapYProperties(IVisibilityHandler handler) { + YVisibilityProperties yProps = VisibilityFactory.eINSTANCE.createYVisibilityProperties(); yProps.setBackgroundColor(mapYColor(handler.getBackgroundColor())); yProps.setBackgroundColorCode(handler.getBackgroundColorCode()); yProps.setBold(handler.isBold()); @@ -119,21 +119,28 @@ * @param component * the component */ - public static void applyCaptions(II18nService service, String label, - String i18nLabelKey, Locale locale, Component component) { - if(component != null) { + public static void applyCaptions(II18nService service, String label, String i18nLabelKey, Locale locale, + Component component) { + + if (II18nConstants.NO_CAPTION.equals(i18nLabelKey)) { + return; + } + + if (component != null) { if (service != null && isValid(i18nLabelKey)) { String translation = service.getValue(i18nLabelKey, locale); - if (translation == null || translation.equals("") || !i18nLabelKey.equals(label)) { - // caption must be set in all cases - even if it is null, else icon-only mode will not work + if (translation == null || translation.equals("")) { + // caption must be set in all cases - even if it is null, + // else icon-only mode will not work // if already set by other process then do not translate component.setCaption(label); } else { component.setCaption(translation); } - + } else { - // caption must be set in all cases - even if it is null, else icon-only mode will not work + // caption must be set in all cases - even if it is null, else + // icon-only mode will not work component.setCaption(label); } } @@ -152,8 +159,7 @@ * the locale * @return the caption */ - public static String getCaption(II18nService service, String label, - String i18nLabelKey, Locale locale) { + public static String getCaption(II18nService service, String label, String i18nLabelKey, Locale locale) { String result = i18nLabelKey; @@ -189,9 +195,8 @@ * @param component * the component */ - public static void applyCaptionIcons(II18nService service, - IResourceProvider provider, String i18nLabelKey, Locale locale, - Component component) { + public static void applyCaptionIcons(II18nService service, IResourceProvider provider, String i18nLabelKey, + Locale locale, Component component) { String iconKey = I18nUtil.getImageKey(i18nLabelKey); if (service != null && provider != null && isValid(iconKey)) { @@ -216,9 +221,8 @@ * @param callback * the callback */ - public static void applyCaptionIcons(II18nService service, - IResourceProvider provider, String i18nLabelKey, Locale locale, - ResourceCallback callback) { + public static void applyCaptionIcons(II18nService service, IResourceProvider provider, String i18nLabelKey, + Locale locale, ResourceCallback callback) { String iconKey = I18nUtil.getImageKey(i18nLabelKey); if (service != null && provider != null && isValid(iconKey)) { @@ -249,20 +253,17 @@ * the message * @return the list */ - public static List<org.eclipse.osbp.runtime.common.validation.IStatus> createStatus( - YEmbeddable yElement, ErrorMessage message) { + public static List<org.eclipse.osbp.runtime.common.validation.IStatus> createStatus(YEmbeddable yElement, + ErrorMessage message) { if (message == null) { return Collections.emptyList(); } String text = message.getFormattedHtmlMessage(); - IStatus status = Status.createStatus("", Util.class, - mapSeverity(message.getErrorLevel()), text); + IStatus status = Status.createStatus("", Util.class, mapSeverity(message.getErrorLevel()), text); status.putProperty(IStatus.PROP_FIELD_ID, yElement.getId()); - status.putProperty(IStatus.PROP_FIELD_I18N_KEY, - yElement.getLabelI18nKey()); - status.putProperty(IStatus.PROP_CREATOR, - "Presentation of " + yElement.getId()); + status.putProperty(IStatus.PROP_FIELD_I18N_KEY, yElement.getLabelI18nKey()); + status.putProperty(IStatus.PROP_CREATOR, "Presentation of " + yElement.getId()); return Collections.singletonList(status); }
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.classpath b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.classpath new file mode 100644 index 0000000..8b37caa --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.classpath
@@ -0,0 +1,8 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="src" path="xtend-gen/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.gitignore b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.gitignore
@@ -0,0 +1 @@ +/target/
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project index d2ef580..890b0a4 100644 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project
@@ -36,11 +36,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF index edd1d02..c1aedbf 100644 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF
@@ -4,14 +4,11 @@ Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.services.vaadin Bundle-Version: 0.9.0.qualifier Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.osbp.runtime.web.ecview.services.vaadin; - org.eclipse.osbp.ecview.core.common.context, - org.eclipse.osbp.ecview.core.common.model.core, - com.vaadin.ui";version="0.9.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.osbp.runtime.web.ecview.services.vaadin Bundle-Vendor: Eclipse OSBP -Require-Bundle: com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)", @@ -28,12 +25,12 @@ org.eclipse.osbp.dsl.entity.xtext;bundle-version="[0.9.0,0.10.0)", com.google.inject;bundle-version="3.0.0", org.junit;bundle-version="4.11.0", - org.eclipse.xtext;bundle-version="[2.7.3,2.8.0)", + org.eclipse.xtext;bundle-version="[2.11.0,2.12.0)", org.eclipse.osbp.xtext.builder.types.bundles;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)", - org.eclipse.xtend.lib;bundle-version="[2.7.3,2.8.0)", + org.eclipse.xtend.lib;bundle-version="[2.11.0,2.12.0)", com.google.guava;bundle-version="[10.0.0,19.0.0)", - org.eclipse.xtext.xbase.lib;bundle-version="[2.7.3,2.8.0)" + org.eclipse.xtext.xbase.lib;bundle-version="[2.11.0,2.12.0)" Import-Package: org.osgi.service.component;version="1.2.0", org.osgi.service.component.annotations;version="1.2.0" Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml,
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml index 4cb0533..b357108 100644 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml
@@ -4,8 +4,8 @@ <service> <provide interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.IECViewUIRenderService"/> </service> - <reference bind="bindDtoMetadataService" cardinality="1..1" interface="IDtoMetadataService" name="DtoMetadataService" policy="dynamic" unbind="unbindDtoMetadataService"/> + <reference bind="bindDtoMetadataService" cardinality="1..1" interface="org.eclipse.osbp.dsl.xtext.builder.participant.IDtoMetadataService" name="DtoMetadataService" policy="dynamic" unbind="unbindDtoMetadataService"/> <reference bind="bindDtoRenderingStrategy" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILDtoRenderStrategy" name="DtoRenderingStrategy" policy="dynamic" unbind="unbindDtoRenderingStrategy"/> - <reference bind="bindEntityMetadataService" cardinality="1..1" interface="IEntityMetadataService" name="EntityMetadataService" policy="dynamic" unbind="unbindEntityMetadataService"/> + <reference bind="bindEntityMetadataService" cardinality="1..1" interface="org.eclipse.osbp.dsl.xtext.builder.participant.IEntityMetadataService" name="EntityMetadataService" policy="dynamic" unbind="unbindEntityMetadataService"/> <reference bind="bindEntityRenderingStrategy" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILEntityRenderStrategy" name="EntityRenderingStrategy" policy="dynamic" unbind="unbindEntityRenderingStrategy"/> </scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/.gitignore b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/.gitignore new file mode 100644 index 0000000..096252c --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/.gitignore
@@ -0,0 +1,2 @@ +/.BeanHelper.xtendbin +/.EntityToUimodelFileGenerator.xtendbin
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/.gitignore b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/.gitignore new file mode 100644 index 0000000..5deff97 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/.gitignore
@@ -0,0 +1,4 @@ +/BeanHelper.java +/Bindings.java +/Counter.java +/EntityToUimodelFileGenerator.java
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java deleted file mode 100644 index 4332da3..0000000 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java +++ /dev/null
@@ -1,378 +0,0 @@ -/** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Florian Pirchner - Initial implementation - */ -package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl; - -import com.google.common.base.Objects; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationDef; -import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationTarget; -import org.eclipse.osbp.dsl.semantic.entity.LBean; -import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute; -import org.eclipse.osbp.dsl.semantic.entity.LBeanFeature; -import org.eclipse.osbp.dsl.semantic.entity.LEntity; -import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; -import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature; -import org.eclipse.osbp.dsl.semantic.entity.LOperation; -import org.eclipse.osbp.runtime.common.annotations.DomainDescription; -import org.eclipse.osbp.runtime.common.annotations.DomainKey; -import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.OperationExtensions; -import org.eclipse.xtext.common.types.JvmType; -import org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class BeanHelper { - /** - * @param bean the bean - * @return the caption property if it could be found. Null otherwise. - */ - public static String findCaptionProperty(final Object bean) { - boolean _equals = Objects.equal(bean, null); - if (_equals) { - return null; - } - if ((bean instanceof Class<?>)) { - return BeanHelper.findCaptionProperty(((Class<?>) bean)); - } else { - Class<?> _class = bean.getClass(); - return BeanHelper.findCaptionProperty(_class); - } - } - - /** - * @param beanClass the bean class - * @return the caption property if it could be found. Null otherwise. - */ - public static String findCaptionProperty(final Class<?> beanClass) { - boolean _equals = Objects.equal(beanClass, null); - if (_equals) { - return null; - } - Field[] _declaredFields = beanClass.getDeclaredFields(); - for (final Field field : _declaredFields) { - boolean _isAnnotationPresent = field.isAnnotationPresent(DomainKey.class); - if (_isAnnotationPresent) { - return field.getName(); - } - } - Field[] _fields = beanClass.getFields(); - for (final Field field_1 : _fields) { - boolean _isAnnotationPresent_1 = field_1.isAnnotationPresent(DomainKey.class); - if (_isAnnotationPresent_1) { - return field_1.getName(); - } - } - return null; - } - - /** - * @param lEntity the entity - * @return the caption property if it could be found. Null otherwise. - */ - public static String findCaptionProperty(final LEntity lEntity) { - String bestMatch = null; - boolean _equals = Objects.equal(lEntity, null); - if (_equals) { - return null; - } - List<LEntityAttribute> _allAttributes = lEntity.getAllAttributes(); - for (final LEntityAttribute field : _allAttributes) { - boolean _or = false; - boolean _or_1 = false; - boolean _or_2 = false; - boolean _or_3 = false; - boolean _isDomainKey = field.isDomainKey(); - if (_isDomainKey) { - _or_3 = true; - } else { - String _name = field.getName(); - boolean _equalsIgnoreCase = _name.equalsIgnoreCase("Name"); - _or_3 = _equalsIgnoreCase; - } - if (_or_3) { - _or_2 = true; - } else { - String _name_1 = field.getName(); - boolean _equalsIgnoreCase_1 = _name_1.equalsIgnoreCase("Number"); - _or_2 = _equalsIgnoreCase_1; - } - if (_or_2) { - _or_1 = true; - } else { - String _name_2 = field.getName(); - boolean _equalsIgnoreCase_2 = _name_2.equalsIgnoreCase("Description"); - _or_1 = _equalsIgnoreCase_2; - } - if (_or_1) { - _or = true; - } else { - boolean _isUuid = field.isUuid(); - _or = _isUuid; - } - if (_or) { - String _name_3 = field.getName(); - bestMatch = _name_3; - } - } - return bestMatch; - } - - /** - * @param lBean the bean - * @return the caption property if it could be found. Null otherwise. - */ - public static String findCaptionProperty(final LBean lBean) { - String bestMatch = null; - boolean _equals = Objects.equal(lBean, null); - if (_equals) { - return null; - } - List<LBeanAttribute> _allAttributes = lBean.getAllAttributes(); - for (final LBeanAttribute field : _allAttributes) { - boolean _or = false; - boolean _or_1 = false; - boolean _or_2 = false; - boolean _or_3 = false; - boolean _isDomainKey = field.isDomainKey(); - if (_isDomainKey) { - _or_3 = true; - } else { - String _name = field.getName(); - boolean _equalsIgnoreCase = _name.equalsIgnoreCase("Name"); - _or_3 = _equalsIgnoreCase; - } - if (_or_3) { - _or_2 = true; - } else { - String _name_1 = field.getName(); - boolean _equalsIgnoreCase_1 = _name_1.equalsIgnoreCase("Number"); - _or_2 = _equalsIgnoreCase_1; - } - if (_or_2) { - _or_1 = true; - } else { - String _name_2 = field.getName(); - boolean _equalsIgnoreCase_2 = _name_2.equalsIgnoreCase("Description"); - _or_1 = _equalsIgnoreCase_2; - } - if (_or_1) { - _or = true; - } else { - boolean _isUuid = field.isUuid(); - _or = _isUuid; - } - if (_or) { - String _name_3 = field.getName(); - bestMatch = _name_3; - } - } - return bestMatch; - } - - /** - * @param bean the bean - * @return the description property if it could be found. Null otherwise. - */ - public static String findDescriptionProperty(final Object bean) { - boolean _equals = Objects.equal(bean, null); - if (_equals) { - return null; - } - if ((bean instanceof Class<?>)) { - return BeanHelper.findDescriptionProperty(((Class<?>) bean)); - } else { - Class<?> _class = bean.getClass(); - return BeanHelper.findDescriptionProperty(_class); - } - } - - /** - * @param beanClass the beanClass - * @return the description property if it could be found. Null otherwise. - */ - public static String findDescriptionProperty(final Class<?> beanClass) { - boolean _equals = Objects.equal(beanClass, null); - if (_equals) { - return null; - } - Field[] _declaredFields = beanClass.getDeclaredFields(); - for (final Field field : _declaredFields) { - boolean _isAnnotationPresent = field.isAnnotationPresent(DomainDescription.class); - if (_isAnnotationPresent) { - return field.getName(); - } - } - Method[] _declaredMethods = beanClass.getDeclaredMethods(); - for (final Method method : _declaredMethods) { - boolean _isAnnotationPresent_1 = method.isAnnotationPresent(DomainDescription.class); - if (_isAnnotationPresent_1) { - String _name = method.getName(); - return OperationExtensions.toPropertyName(_name); - } - } - Field[] _fields = beanClass.getFields(); - for (final Field field_1 : _fields) { - boolean _isAnnotationPresent_2 = field_1.isAnnotationPresent(DomainDescription.class); - if (_isAnnotationPresent_2) { - return field_1.getName(); - } - } - Method[] _methods = beanClass.getMethods(); - for (final Method method_1 : _methods) { - boolean _isAnnotationPresent_3 = method_1.isAnnotationPresent(DomainDescription.class); - if (_isAnnotationPresent_3) { - String _name_1 = method_1.getName(); - return OperationExtensions.toPropertyName(_name_1); - } - } - return null; - } - - /** - * @param entity the entity - * @return the description property if it could be found. Null otherwise. - */ - public static String findDescriptionProperty(final LEntity entity) { - boolean _equals = Objects.equal(entity, null); - if (_equals) { - return null; - } - List<LEntityAttribute> _attributes = entity.getAttributes(); - for (final LEntityAttribute field : _attributes) { - boolean _isDomainDescription = field.isDomainDescription(); - if (_isDomainDescription) { - return field.getName(); - } - } - List<LOperation> _operations = entity.getOperations(); - for (final LOperation method : _operations) { - { - EList<LAnnotationDef> _annotations = method.getAnnotations(); - final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() { - public Boolean apply(final LAnnotationDef it) { - XAnnotation _annotation = it.getAnnotation(); - JvmType _annotationType = _annotation.getAnnotationType(); - String _qualifiedName = _annotationType.getQualifiedName(); - String _canonicalName = DomainDescription.class.getCanonicalName(); - return Boolean.valueOf(_qualifiedName.equals(_canonicalName)); - } - }; - final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function); - boolean _notEquals = (!Objects.equal(def, null)); - if (_notEquals) { - String _name = method.getName(); - return OperationExtensions.toPropertyName(_name); - } - } - } - List<LEntityAttribute> _allAttributes = entity.getAllAttributes(); - for (final LEntityAttribute field_1 : _allAttributes) { - boolean _isDomainDescription_1 = field_1.isDomainDescription(); - if (_isDomainDescription_1) { - return field_1.getName(); - } - } - List<LEntityFeature> _allFeatures = entity.getAllFeatures(); - for (final LEntityFeature method_1 : _allFeatures) { - if ((method_1 instanceof org.eclipse.osbp.dsl.semantic.common.types.LOperation)) { - EList<LAnnotationDef> _annotations = ((LAnnotationTarget)method_1).getAnnotations(); - final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() { - public Boolean apply(final LAnnotationDef it) { - XAnnotation _annotation = it.getAnnotation(); - JvmType _annotationType = _annotation.getAnnotationType(); - String _qualifiedName = _annotationType.getQualifiedName(); - String _canonicalName = DomainDescription.class.getCanonicalName(); - return Boolean.valueOf(_qualifiedName.equals(_canonicalName)); - } - }; - final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function); - boolean _notEquals = (!Objects.equal(def, null)); - if (_notEquals) { - String _name = method_1.getName(); - return OperationExtensions.toPropertyName(_name); - } - } - } - return null; - } - - /** - * @param bean the bean - * @return the description property if it could be found. Null otherwise. - */ - public static String findDescriptionProperty(final LBean bean) { - boolean _equals = Objects.equal(bean, null); - if (_equals) { - return null; - } - List<LBeanAttribute> _attributes = bean.getAttributes(); - for (final LBeanAttribute field : _attributes) { - boolean _isDomainDescription = field.isDomainDescription(); - if (_isDomainDescription) { - return field.getName(); - } - } - List<LOperation> _operations = bean.getOperations(); - for (final LOperation method : _operations) { - { - EList<LAnnotationDef> _annotations = method.getAnnotations(); - final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() { - public Boolean apply(final LAnnotationDef it) { - XAnnotation _annotation = it.getAnnotation(); - JvmType _annotationType = _annotation.getAnnotationType(); - String _qualifiedName = _annotationType.getQualifiedName(); - String _canonicalName = DomainDescription.class.getCanonicalName(); - return Boolean.valueOf(_qualifiedName.equals(_canonicalName)); - } - }; - final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function); - boolean _notEquals = (!Objects.equal(def, null)); - if (_notEquals) { - String _name = method.getName(); - return OperationExtensions.toPropertyName(_name); - } - } - } - List<LBeanAttribute> _allAttributes = bean.getAllAttributes(); - for (final LBeanAttribute field_1 : _allAttributes) { - boolean _isDomainDescription_1 = field_1.isDomainDescription(); - if (_isDomainDescription_1) { - return field_1.getName(); - } - } - List<LBeanFeature> _allFeatures = bean.getAllFeatures(); - for (final LBeanFeature method_1 : _allFeatures) { - if ((method_1 instanceof org.eclipse.osbp.dsl.semantic.common.types.LOperation)) { - EList<LAnnotationDef> _annotations = ((LAnnotationTarget)method_1).getAnnotations(); - final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() { - public Boolean apply(final LAnnotationDef it) { - XAnnotation _annotation = it.getAnnotation(); - JvmType _annotationType = _annotation.getAnnotationType(); - String _qualifiedName = _annotationType.getQualifiedName(); - String _canonicalName = DomainDescription.class.getCanonicalName(); - return Boolean.valueOf(_qualifiedName.equals(_canonicalName)); - } - }; - final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function); - boolean _notEquals = (!Objects.equal(def, null)); - if (_notEquals) { - String _name = method_1.getName(); - return OperationExtensions.toPropertyName(_name); - } - } - } - return null; - } -}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java deleted file mode 100644 index febd15f..0000000 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java +++ /dev/null
@@ -1,26 +0,0 @@ -/** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Klemens Edler - Initial implementation - */ -package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl; - -@SuppressWarnings("all") -public class Bindings { - public String bindingList; - - public Bindings(final String bindingList) { - this.bindingList = bindingList; - } - - public String add(final String string) { - String _concat = this.bindingList.concat("\n"); - String _concat_1 = _concat.concat(string); - return this.bindingList = _concat_1; - } -}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java deleted file mode 100644 index db1b944..0000000 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java +++ /dev/null
@@ -1,20 +0,0 @@ -/** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Klemens Edler - Initial implementation - */ -package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl; - -@SuppressWarnings("all") -public class Counter { - public int value; - - public Counter(final int value) { - this.value = value; - } -}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java deleted file mode 100644 index 24fb505..0000000 --- a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java +++ /dev/null
@@ -1,850 +0,0 @@ -/** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Klemens Edler - Initial implementation - */ -package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl; - -import com.google.common.base.Objects; -import java.util.List; -import javax.inject.Inject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.osbp.dsl.semantic.common.types.LDataType; -import org.eclipse.osbp.dsl.semantic.common.types.LMultiplicity; -import org.eclipse.osbp.dsl.semantic.common.types.LReference; -import org.eclipse.osbp.dsl.semantic.common.types.LScalarType; -import org.eclipse.osbp.dsl.semantic.common.types.LType; -import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage; -import org.eclipse.osbp.dsl.semantic.common.types.LUpperBound; -import org.eclipse.osbp.dsl.semantic.entity.LBean; -import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute; -import org.eclipse.osbp.dsl.semantic.entity.LBeanReference; -import org.eclipse.osbp.dsl.semantic.entity.LEntity; -import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; -import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature; -import org.eclipse.osbp.dsl.semantic.entity.LEntityReference; -import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.BeanHelper; -import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.Bindings; -import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.Counter; -import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.TypeHelper; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.common.types.JvmType; -import org.eclipse.xtext.common.types.JvmTypeReference; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -/** - * This generator automatically creates a generic .uimodel-file from a given entity. - */ -@SuppressWarnings("all") -public class EntityToUimodelFileGenerator { - @Inject - private TypeHelper typeHelper; - - private Bindings bindings = new Bindings(""); - - private Counter counter = new Counter(0); - - public CharSequence getContent(final LEntity entity) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _toUimodelName = this.getToUimodelName(entity); - _builder.append(_toUimodelName, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import "); - EObject _eContainer = entity.eContainer(); - String _name = ((LTypedPackage) _eContainer).getName(); - _builder.append(_name, ""); - _builder.append(".*"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("ideview "); - String _name_1 = entity.getName(); - _builder.append(_name_1, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("datasource ds: "); - String _toEntityFQN = this.getToEntityFQN(entity); - _builder.append(_toEntityFQN, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("horizontalLayout "); - String _name_2 = entity.getName(); - _builder.append(_name_2, "\t"); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("form leftForm {"); - _builder.newLine(); - { - EList<LEntityFeature> _features = entity.getFeatures(); - for(final LEntityFeature feature : _features) { - { - if (((this.counter.value % 2) == 0)) { - { - if ((feature instanceof LEntityAttribute)) { - { - LScalarType _type = ((LEntityAttribute)feature).getType(); - if ((_type instanceof LDataType)) { - _builder.append("\t\t\t"); - String _toAttributeUiField = this.getToAttributeUiField(((LEntityAttribute)feature)); - _builder.append(_toAttributeUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t\t"); - String _toBeanRefUiField = this.getToBeanRefUiField(((LEntityAttribute)feature)); - _builder.append(_toBeanRefUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } else { - if ((feature instanceof LReference)) { - _builder.append("\t\t\t"); - String _toEntityRefUiField = this.getToEntityRefUiField(feature); - _builder.append(_toEntityRefUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - _builder.append("\t\t\t"); - _builder.append(this.counter.value = (this.counter.value + 1), "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append(this.counter.value = 0, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("form rightForm {"); - _builder.newLine(); - { - EList<LEntityFeature> _features_1 = entity.getFeatures(); - for(final LEntityFeature feature_1 : _features_1) { - { - if (((this.counter.value % 2) == 1)) { - { - if ((feature_1 instanceof LEntityAttribute)) { - { - LScalarType _type_1 = ((LEntityAttribute)feature_1).getType(); - if ((_type_1 instanceof LDataType)) { - _builder.append("\t\t\t"); - String _toAttributeUiField_1 = this.getToAttributeUiField(((LEntityAttribute)feature_1)); - _builder.append(_toAttributeUiField_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t\t"); - String _toBeanRefUiField_1 = this.getToBeanRefUiField(((LEntityAttribute)feature_1)); - _builder.append(_toBeanRefUiField_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } else { - if ((feature_1 instanceof LReference)) { - _builder.append("\t\t\t"); - String _toEntityRefUiField_1 = this.getToEntityRefUiField(feature_1); - _builder.append(_toEntityRefUiField_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - _builder.append("\t\t\t"); - _builder.append(this.counter.value = (this.counter.value + 1), "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append(this.bindings.bindingList, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder; - } - - public String getToUimodelName(final LEntity entity) { - EObject _eContainer = entity.eContainer(); - String _name = ((LTypedPackage) _eContainer).getName(); - return (_name + ".uimodel"); - } - - public String getToEntityFQN(final LEntity entity) { - EObject _eContainer = entity.eContainer(); - String _name = ((LTypedPackage) _eContainer).getName(); - String _plus = (_name + "."); - String _name_1 = entity.getName(); - return (_plus + _name_1); - } - - public String getToAttributeUiField(final LEntityAttribute attribute) { - LScalarType _type = attribute.getType(); - final LDataType datatype = ((LDataType) _type); - boolean _isDate = datatype.isDate(); - if (_isDate) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("bind ds."); - String _name = attribute.getName(); - _builder.append(_name, ""); - _builder.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder.append("leftform"); - } else { - _builder.append("rightform"); - } - } - _builder.append("."); - String _name_1 = attribute.getName(); - _builder.append(_name_1, ""); - _builder.append("].value"); - this.bindings.add(_builder.toString()); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("datefield "); - String _name_2 = attribute.getName(); - _builder_1.append(_name_2, ""); - _builder_1.newLineIfNotEmpty(); - return _builder_1.toString(); - } else { - JvmTypeReference _jvmTypeReference = datatype.getJvmTypeReference(); - JvmType _type_1 = _jvmTypeReference.getType(); - boolean _isString = this.typeHelper.isString(_type_1); - if (_isString) { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("bind ds."); - String _name_3 = attribute.getName(); - _builder_2.append(_name_3, ""); - _builder_2.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_2.append("leftform"); - } else { - _builder_2.append("rightform"); - } - } - _builder_2.append("."); - String _name_4 = attribute.getName(); - _builder_2.append(_name_4, ""); - _builder_2.append("].value"); - this.bindings.add(_builder_2.toString()); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("textfield "); - String _name_5 = attribute.getName(); - _builder_3.append(_name_5, ""); - _builder_3.newLineIfNotEmpty(); - return _builder_3.toString(); - } else { - JvmTypeReference _jvmTypeReference_1 = datatype.getJvmTypeReference(); - JvmType _type_2 = _jvmTypeReference_1.getType(); - boolean _isBoolean = this.typeHelper.isBoolean(_type_2); - if (_isBoolean) { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("bind ds."); - String _name_6 = attribute.getName(); - _builder_4.append(_name_6, ""); - _builder_4.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_4.append("leftform"); - } else { - _builder_4.append("rightform"); - } - } - _builder_4.append("."); - String _name_7 = attribute.getName(); - _builder_4.append(_name_7, ""); - _builder_4.append("].value"); - this.bindings.add(_builder_4.toString()); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("checkbox "); - String _name_8 = attribute.getName(); - _builder_5.append(_name_8, ""); - _builder_5.newLineIfNotEmpty(); - return _builder_5.toString(); - } else { - JvmTypeReference _jvmTypeReference_2 = datatype.getJvmTypeReference(); - JvmType _type_3 = _jvmTypeReference_2.getType(); - boolean _isNumber = this.typeHelper.isNumber(_type_3); - if (_isNumber) { - JvmTypeReference _jvmTypeReference_3 = datatype.getJvmTypeReference(); - JvmType _type_4 = _jvmTypeReference_3.getType(); - boolean _isDecimal = this.typeHelper.isDecimal(_type_4); - if (_isDecimal) { - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("bind ds."); - String _name_9 = attribute.getName(); - _builder_6.append(_name_9, ""); - _builder_6.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_6.append("leftform"); - } else { - _builder_6.append("rightform"); - } - } - _builder_6.append("."); - String _name_10 = attribute.getName(); - _builder_6.append(_name_10, ""); - _builder_6.append("].value"); - this.bindings.add(_builder_6.toString()); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("decimalField "); - String _name_11 = attribute.getName(); - _builder_7.append(_name_11, ""); - _builder_7.newLineIfNotEmpty(); - return _builder_7.toString(); - } else { - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("bind ds."); - String _name_12 = attribute.getName(); - _builder_8.append(_name_12, ""); - _builder_8.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_8.append("leftform"); - } else { - _builder_8.append("rightform"); - } - } - _builder_8.append("."); - String _name_13 = attribute.getName(); - _builder_8.append(_name_13, ""); - _builder_8.append("].value"); - this.bindings.add(_builder_8.toString()); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("numericField "); - String _name_14 = attribute.getName(); - _builder_9.append(_name_14, ""); - _builder_9.newLineIfNotEmpty(); - return _builder_9.toString(); - } - } - } - } - } - return null; - } - - public String getToEntityRefUiField(final LEntityFeature feature) { - final LEntityReference ref = ((LEntityReference) feature); - LMultiplicity _multiplicity = ref.getMultiplicity(); - LUpperBound _upper = _multiplicity.getUpper(); - boolean _equals = Objects.equal(_upper, LUpperBound.ONE); - if (_equals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("bind ds."); - String _name = feature.getName(); - _builder.append(_name, ""); - _builder.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder.append("leftform"); - } else { - _builder.append("rightform"); - } - } - _builder.append("."); - String _name_1 = feature.getName(); - _builder.append(_name_1, ""); - _builder.append("].value"); - this.bindings.add(_builder.toString()); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("referenceField "); - String _name_2 = feature.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append(" {"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("type "); - LEntity _type = ref.getType(); - String _name_3 = _type.getName(); - _builder_1.append(_name_3, "\t"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("captionField "); - EObject _eContainer = feature.eContainer(); - String _findCaptionProperty = BeanHelper.findCaptionProperty(((LEntity) _eContainer)); - _builder_1.append(_findCaptionProperty, "\t"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("}"); - _builder_1.newLine(); - return _builder_1.toString(); - } - LMultiplicity _multiplicity_1 = ref.getMultiplicity(); - LUpperBound _upper_1 = _multiplicity_1.getUpper(); - boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY); - if (_equals_1) { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("bind ds."); - String _name_4 = feature.getName(); - _builder_2.append(_name_4, ""); - _builder_2.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_2.append("leftform"); - } else { - _builder_2.append("rightform"); - } - } - _builder_2.append("."); - String _name_5 = feature.getName(); - _builder_2.append(_name_5, ""); - _builder_2.append("].collection"); - this.bindings.add(_builder_2.toString()); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("table "); - String _name_6 = feature.getName(); - _builder_3.append(_name_6, ""); - _builder_3.append(" {"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("type "); - LEntity _type_1 = ref.getType(); - String _name_7 = _type_1.getName(); - _builder_3.append(_name_7, "\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("columns {"); - _builder_3.newLine(); - _builder_3.append("\t\t"); - _builder_3.append("column "); - EObject _eContainer_1 = feature.eContainer(); - String _findCaptionProperty_1 = BeanHelper.findCaptionProperty(((LEntity) _eContainer_1)); - _builder_3.append(_findCaptionProperty_1, "\t\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t\t"); - _builder_3.append("column "); - EObject _eContainer_2 = feature.eContainer(); - String _findDescriptionProperty = BeanHelper.findDescriptionProperty(((LEntity) _eContainer_2)); - _builder_3.append(_findDescriptionProperty, "\t\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("}"); - _builder_3.newLine(); - _builder_3.append("}"); - _builder_3.newLine(); - return _builder_3.toString(); - } - return null; - } - - public String getToBeanRefUiField(final LEntityAttribute attribute) { - final LScalarType type = attribute.getType(); - if ((type instanceof LBean)) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("panel "); - String _name = attribute.getName(); - _builder.append(_name, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("content horizontalLayout {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("form {"); - _builder.newLine(); - { - List<LBeanAttribute> _allAttributes = ((LBean)type).getAllAttributes(); - for(final LBeanAttribute feature : _allAttributes) { - { - if ((feature instanceof LBeanAttribute)) { - { - LScalarType _type = feature.getType(); - if ((_type instanceof LDataType)) { - _builder.append("\t\t\t"); - String _toBeanAttributeUiField = this.getToBeanAttributeUiField(feature); - _builder.append(_toBeanAttributeUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t\t"); - String _toBeantoBeanRefUiField = this.getToBeantoBeanRefUiField(feature); - _builder.append(_toBeantoBeanRefUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } else { - if ((feature instanceof LReference)) { - _builder.append("\t\t\t"); - String _toBeanReferenceUiField = this.getToBeanReferenceUiField(feature); - _builder.append(_toBeanReferenceUiField, "\t\t\t"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder.toString(); - } - return null; - } - - public String getToBeantoBeanRefUiField(final LBeanAttribute attribute) { - final LBeanReference ref = ((LBeanReference) attribute); - LMultiplicity _multiplicity = ref.getMultiplicity(); - LUpperBound _upper = _multiplicity.getUpper(); - boolean _equals = Objects.equal(_upper, LUpperBound.ONE); - if (_equals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("bind ds."); - String _name = attribute.getName(); - _builder.append(_name, ""); - _builder.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder.append("leftform"); - } else { - _builder.append("rightform"); - } - } - _builder.append("."); - String _name_1 = attribute.getName(); - _builder.append(_name_1, ""); - _builder.append("].value"); - this.bindings.add(_builder.toString()); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("referenceField "); - String _name_2 = attribute.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append(" {"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("type "); - LType _type = ref.getType(); - String _name_3 = _type.getName(); - _builder_1.append(_name_3, "\t"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("captionField "); - EObject _eContainer = attribute.eContainer(); - String _findCaptionProperty = BeanHelper.findCaptionProperty(((LBean) _eContainer)); - _builder_1.append(_findCaptionProperty, "\t"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("}"); - _builder_1.newLine(); - return _builder_1.toString(); - } - LMultiplicity _multiplicity_1 = ref.getMultiplicity(); - LUpperBound _upper_1 = _multiplicity_1.getUpper(); - boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY); - if (_equals_1) { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("bind ds."); - String _name_4 = attribute.getName(); - _builder_2.append(_name_4, ""); - _builder_2.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_2.append("leftform"); - } else { - _builder_2.append("rightform"); - } - } - _builder_2.append("."); - String _name_5 = attribute.getName(); - _builder_2.append(_name_5, ""); - _builder_2.append("].collection"); - this.bindings.add(_builder_2.toString()); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("table "); - String _name_6 = attribute.getName(); - _builder_3.append(_name_6, ""); - _builder_3.append(" {"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("type "); - LType _type_1 = ref.getType(); - String _name_7 = _type_1.getName(); - _builder_3.append(_name_7, "\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("columns {"); - _builder_3.newLine(); - _builder_3.append("\t\t"); - _builder_3.append("column "); - EObject _eContainer_1 = attribute.eContainer(); - String _findCaptionProperty_1 = BeanHelper.findCaptionProperty(((LBean) _eContainer_1)); - _builder_3.append(_findCaptionProperty_1, "\t\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t\t"); - _builder_3.append("column "); - EObject _eContainer_2 = attribute.eContainer(); - String _findDescriptionProperty = BeanHelper.findDescriptionProperty(((LBean) _eContainer_2)); - _builder_3.append(_findDescriptionProperty, "\t\t"); - _builder_3.newLineIfNotEmpty(); - _builder_3.append("\t"); - _builder_3.append("}"); - _builder_3.newLine(); - _builder_3.append("}"); - _builder_3.newLine(); - return _builder_3.toString(); - } - return null; - } - - public String getToBeanAttributeUiField(final LBeanAttribute attribute) { - LScalarType _type = attribute.getType(); - final LDataType datatype = ((LDataType) _type); - EObject _eContainer = attribute.eContainer(); - String _name = ((LBean) _eContainer).getName(); - final String beanName = StringExtensions.toFirstLower(_name); - boolean _isDate = datatype.isDate(); - if (_isDate) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("bind ds."); - _builder.append(beanName, ""); - _builder.append("."); - String _name_1 = attribute.getName(); - _builder.append(_name_1, ""); - _builder.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder.append("leftform"); - } else { - _builder.append("rightform"); - } - } - _builder.append("."); - _builder.append(beanName, ""); - _builder.append("."); - String _name_2 = attribute.getName(); - _builder.append(_name_2, ""); - _builder.append("].value"); - this.bindings.add(_builder.toString()); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("datefield "); - String _name_3 = attribute.getName(); - _builder_1.append(_name_3, ""); - _builder_1.newLineIfNotEmpty(); - return _builder_1.toString(); - } else { - JvmTypeReference _jvmTypeReference = datatype.getJvmTypeReference(); - JvmType _type_1 = _jvmTypeReference.getType(); - boolean _isString = this.typeHelper.isString(_type_1); - if (_isString) { - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("bind ds."); - _builder_2.append(beanName, ""); - _builder_2.append("."); - String _name_4 = attribute.getName(); - _builder_2.append(_name_4, ""); - _builder_2.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_2.append("leftform"); - } else { - _builder_2.append("rightform"); - } - } - _builder_2.append("."); - _builder_2.append(beanName, ""); - _builder_2.append("."); - String _name_5 = attribute.getName(); - _builder_2.append(_name_5, ""); - _builder_2.append("].value"); - this.bindings.add(_builder_2.toString()); - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("textfield "); - String _name_6 = attribute.getName(); - _builder_3.append(_name_6, ""); - _builder_3.newLineIfNotEmpty(); - return _builder_3.toString(); - } else { - JvmTypeReference _jvmTypeReference_1 = datatype.getJvmTypeReference(); - JvmType _type_2 = _jvmTypeReference_1.getType(); - boolean _isBoolean = this.typeHelper.isBoolean(_type_2); - if (_isBoolean) { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("bind ds."); - _builder_4.append(beanName, ""); - _builder_4.append("."); - String _name_7 = attribute.getName(); - _builder_4.append(_name_7, ""); - _builder_4.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_4.append("leftform"); - } else { - _builder_4.append("rightform"); - } - } - _builder_4.append("."); - _builder_4.append(beanName, ""); - _builder_4.append("."); - String _name_8 = attribute.getName(); - _builder_4.append(_name_8, ""); - _builder_4.append("].value"); - this.bindings.add(_builder_4.toString()); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("checkbox "); - String _name_9 = attribute.getName(); - _builder_5.append(_name_9, ""); - _builder_5.newLineIfNotEmpty(); - return _builder_5.toString(); - } else { - JvmTypeReference _jvmTypeReference_2 = datatype.getJvmTypeReference(); - JvmType _type_3 = _jvmTypeReference_2.getType(); - boolean _isNumber = this.typeHelper.isNumber(_type_3); - if (_isNumber) { - JvmTypeReference _jvmTypeReference_3 = datatype.getJvmTypeReference(); - JvmType _type_4 = _jvmTypeReference_3.getType(); - boolean _isDecimal = this.typeHelper.isDecimal(_type_4); - if (_isDecimal) { - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("bind ds."); - _builder_6.append(beanName, ""); - _builder_6.append("."); - String _name_10 = attribute.getName(); - _builder_6.append(_name_10, ""); - _builder_6.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_6.append("leftform"); - } else { - _builder_6.append("rightform"); - } - } - _builder_6.append("."); - _builder_6.append(beanName, ""); - _builder_6.append("."); - String _name_11 = attribute.getName(); - _builder_6.append(_name_11, ""); - _builder_6.append("].value"); - this.bindings.add(_builder_6.toString()); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("decimalField "); - String _name_12 = attribute.getName(); - _builder_7.append(_name_12, ""); - _builder_7.newLineIfNotEmpty(); - return _builder_7.toString(); - } else { - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("bind ds."); - _builder_8.append(beanName, ""); - _builder_8.append("."); - String _name_13 = attribute.getName(); - _builder_8.append(_name_13, ""); - _builder_8.append(" <--> [this."); - { - if (((this.counter.value % 2) == 0)) { - _builder_8.append("leftform"); - } else { - _builder_8.append("rightform"); - } - } - _builder_8.append("."); - _builder_8.append(beanName, ""); - _builder_8.append("."); - String _name_14 = attribute.getName(); - _builder_8.append(_name_14, ""); - _builder_8.append("].value"); - this.bindings.add(_builder_8.toString()); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("numericField "); - String _name_15 = attribute.getName(); - _builder_9.append(_name_15, ""); - _builder_9.newLineIfNotEmpty(); - return _builder_9.toString(); - } - } - } - } - } - return null; - } - - public String getToBeanReferenceUiField(final LBeanAttribute attribute) { - final LBeanReference ref = ((LBeanReference) attribute); - LMultiplicity _multiplicity = ref.getMultiplicity(); - LUpperBound _upper = _multiplicity.getUpper(); - boolean _equals = Objects.equal(_upper, LUpperBound.ONE); - if (_equals) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("referenceField "); - String _name = attribute.getName(); - _builder.append(_name, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("type "); - LType _type = ref.getType(); - String _name_1 = _type.getName(); - _builder.append(_name_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("captionField uuid"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - return _builder.toString(); - } - LMultiplicity _multiplicity_1 = ref.getMultiplicity(); - LUpperBound _upper_1 = _multiplicity_1.getUpper(); - boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY); - if (_equals_1) { - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("table "); - String _name_2 = attribute.getName(); - _builder_1.append(_name_2, ""); - _builder_1.append(" {"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("type "); - LType _type_1 = ref.getType(); - String _name_3 = _type_1.getName(); - _builder_1.append(_name_3, "\t"); - _builder_1.newLineIfNotEmpty(); - _builder_1.append("\t"); - _builder_1.append("columns {"); - _builder_1.newLine(); - _builder_1.append("\t\t"); - _builder_1.append("column uuid"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("}"); - _builder_1.newLine(); - _builder_1.append("}"); - _builder_1.newLine(); - return _builder_1.toString(); - } - return null; - } - - public String toDocu(final EObject element) { - return ""; - } -}
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml index 0193f50..bca4aa7 100644 --- a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml
@@ -14,7 +14,8 @@ id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin"> <description> %description
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.testbase/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml b/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml index bc81646..3e1e2ed 100644 --- a/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml
@@ -1,20 +1,69 @@ <?xml version="1.0" encoding="UTF-8"?> -<!--#======================================================================= --> -<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) --> -<!--# All rights reserved. This program and the accompanying materials --> -<!--# are made available under the terms of the Eclipse Public License v1.0 --> -<!--# which accompanies this distribution, and is available at --> -<!--# http://www.eclipse.org/legal/epl-v10.html --> -<!--# --> -<!--# Contributors: --> -<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation --> -<!--#======================================================================= --> - -<feature - id="org.eclipse.osbp.runtime.web.feature.testbase" - label="%featureName" - version="0.9.0.qualifier" - provider-name="%providerName"> + <!--#======================================================================= + --><!--# + Copyright + (c) + 2011, + 2016 + - + Loetz + GmbH&Co.KG + (69115 + Heidelberg, + Germany) + --><!--# + All + rights + reserved. + This + program + and + the + accompanying + materials + --><!--# + are + made + available + under + the + terms + of + the + Eclipse + Public + License + v1.0 + --><!--# + which + accompanies + this + distribution, + and + is + available + at + --><!--# + http://www.eclipse.org/legal/epl-v10.html + --><!--# + --><!--# + Contributors: + --><!--# + + + + + Christophe + Loetz + (Loetz + GmbH&Co.KG) + - + initial + API + and + implementation + --><!--#======================================================================= + --><feature id="org.eclipse.osbp.runtime.web.feature.testbase" label="%featureName" version="0.9.0.qualifier" provider-name="%providerName"> <description> %description @@ -39,4 +88,4 @@ version="0.0.0" unpack="false"/> -</feature> +</feature> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml index a1a08d5..7d48972 100644 --- a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml
@@ -10,11 +10,12 @@ <!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation --> <!--#======================================================================= --> -<feature - id="org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi" - label="%featureName" - version="0.9.0.qualifier" - provider-name="%providerName"> +<feature + id="org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi" + label="%featureName" + version="0.9.0.qualifier" + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.vaadin.osgi"> <description> %description @@ -40,4 +41,4 @@ version="0.0.0" unpack="false"/> -</feature> +</feature> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml index 8f83ec0..0d55732 100644 --- a/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml
@@ -14,7 +14,8 @@ id="org.eclipse.osbp.runtime.web.feature.vaadin.common" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.vaadin.common"> <description> %description @@ -28,6 +29,13 @@ %license </license> + <plugin + id="org.eclipse.osbp.runtime.web.common" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + <plugin id="org.eclipse.osbp.runtime.web.vaadin.common" download-size="0"
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml index 95d8879..d53c84c 100644 --- a/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml
@@ -14,7 +14,8 @@ id="org.eclipse.osbp.runtime.web.feature.vaadin.components" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.vaadin.components"> <description> %description
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml index 4a8f96a..6d7aaee 100644 --- a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml
@@ -14,7 +14,8 @@ id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.vaadin.databinding"> <description> %description
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml index 696de82..6570229 100644 --- a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml +++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml
@@ -14,7 +14,8 @@ id="org.eclipse.osbp.runtime.web.feature.vaadin.osgi" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.runtime.web.vaadin.osgi"> <description> %description
diff --git a/org.eclipse.osbp.runtime.web.target/.project b/org.eclipse.osbp.runtime.web.target/.project deleted file mode 100644 index 3060072..0000000 --- a/org.eclipse.osbp.runtime.web.target/.project +++ /dev/null
@@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.osbp.runtime.web.target</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - </natures> -</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target b/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target deleted file mode 100644 index 1c8de48..0000000 --- a/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target +++ /dev/null
@@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?pde version="3.8"?><target includeMode="feature" name="org.eclipse.osbp.runtime.web.target.kepler" sequenceNumber="36"> -<locations> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.apache.httpcomponents.httpcore.source" version="4.1.4.v201203221030"/> -<unit id="org.apache.httpcomponents.httpcore" version="4.1.4.v201203221030"/> -<unit id="org.apache.httpcomponents.httpcore.nio" version="4.1.0.v201101201700"/> -<unit id="org.apache.httpcomponents.httpcore.nio.source" version="4.1.0.v201101201700"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.apache.httpcomponents.httpclient" version="4.1.2.v201203221030"/> -<unit id="org.apache.httpcomponents.httpclient.source" version="4.1.2.v201203221030"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.0.1.201406272004"/> -<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20140221-1852"/> -<unit id="org.eclipse.platform.sdk" version="4.3.2.M20140221-1700"/> -<unit id="org.eclipse.emf.sdk.feature.group" version="2.9.2.v20140203-1126"/> -<repository location="http://download.eclipse.org/releases/kepler"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.junit.source" version="4.10.0.v4_10_0_v20120426-0900"/> -<unit id="org.junit" version="4.10.0.v4_10_0_v20120426-0900"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.osbp.dependencies.feature.security.shiro.feature.group" version="1.2.2"/> -<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.0.1.201405120903"/> -<unit id="org.eclipse.osbp.dependencies.feature.assert-utilities.feature.group" version="1.2.2"/> -<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.0.1.201405120903"/> -<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.1.9"/> -<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/> -<unit id="org.apache.commons.lang" version="2.6.0.v201205030909"/> -<unit id="org.apache.commons.collections" version="3.2.0.v201005080500"/> -<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.osbp.dsl.feature.entities.headless.feature.group" version="0.0.1.201406261127"/> -<unit id="org.eclipse.osbp.dsl.feature.dto.headless.source.feature.group" version="0.0.1.201406261127"/> -<unit id="org.eclipse.osbp.dsl.feature.entities.headless.source.feature.group" version="0.0.1.201406261127"/> -<unit id="org.eclipse.osbp.dsl.feature.common.headless.feature.group" version="0.0.1.201406261127"/> -<unit id="org.eclipse.osbp.dsl.feature.common.headless.source.feature.group" version="0.0.1.201406261127"/> -<unit id="org.eclipse.osbp.dsl.feature.dto.headless.feature.group" version="0.0.1.201406261127"/> -<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.xtext.redist.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.ui.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.runtime.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.xbase.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.examples.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.sdk.feature.group" version="2.6.1.v201406120726"/> -<unit id="org.eclipse.xtext.docs.feature.group" version="2.6.1.v201406120726"/> -<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases"/> -</location> -</locations> -</target>
diff --git a/org.eclipse.osbp.runtime.web.target/pom.xml b/org.eclipse.osbp.runtime.web.target/pom.xml deleted file mode 100644 index 0acc17f..0000000 --- a/org.eclipse.osbp.runtime.web.target/pom.xml +++ /dev/null
@@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--#======================================================================= --> -<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) --> -<!--# All rights reserved. This program and the accompanying materials --> -<!--# are made available under the terms of the Eclipse Public License v1.0 --> -<!--# which accompanies this distribution, and is available at --> -<!--# http://www.eclipse.org/legal/epl-v10.html --> -<!--# --> -<!--# Contributors: --> -<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation --> -<!--#======================================================================= --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.osbp.runtime.web</groupId> - <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId> - <version>0.9.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <artifactId>org.eclipse.osbp.runtime.web.target</artifactId> - <packaging>pom</packaging> -</project>
diff --git a/org.eclipse.osbp.runtime.web.testbase/.classpath b/org.eclipse.osbp.runtime.web.testbase/.classpath new file mode 100644 index 0000000..9e307bb --- /dev/null +++ b/org.eclipse.osbp.runtime.web.testbase/.classpath
@@ -0,0 +1,7 @@ +<?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.7"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="bin"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.testbase/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.testbase/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f42de36 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.testbase/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF index ae4e383..370753f 100644 --- a/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF
@@ -4,12 +4,12 @@ Bundle-Name: org.eclipse.osbp.runtime.web.testbase Created-By: ApacheMaven Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.external.org.slf4j;bundle-version="1.6.1", - com.vaadin.client-compiled;bundle-version="[7.5.7,7.7.0)", - com.vaadin.themes;bundle-version="[7.5.7,7.7.0)", - com.vaadin.push;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.external.org.slf4j;bundle-version="[7.7.6,7.8.0)", + com.vaadin.client-compiled;bundle-version="[7.7.6,7.8.0)", + com.vaadin.themes;bundle-version="[7.7.6,7.8.0)", + com.vaadin.push;bundle-version="[7.7.6,7.8.0)", org.eclipse.equinox.http.jetty;bundle-version="3.0.100", org.eclipse.jetty.http;bundle-version="8.1.11", org.eclipse.jetty.io;bundle-version="8.1.11",
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.classpath b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF index f7fce71..c5cd81a 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ org.eclipse.equinox.preferences;bundle-version="3.5.0", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Eclipse OSBP Service-Component: OSGI-INF/contextRegistryHelper.xml Import-Package: org.eclipse.osgi.service.datalocation;version="1.3.0",
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.classpath b/org.eclipse.osbp.runtime.web.vaadin.common/.classpath new file mode 100644 index 0000000..8b37caa --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.classpath
@@ -0,0 +1,8 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="src" path="xtend-gen/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.project b/org.eclipse.osbp.runtime.web.vaadin.common/.project index 71b78d9..b4eca00 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/.project +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.project
@@ -36,11 +36,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF index 9604984..71d57e0 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF
@@ -5,6 +5,7 @@ Bundle-Version: 0.9.0.qualifier Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.osbp.runtime.common.dispose;version="0.9.0", + org.eclipse.osbp.ui.api.datamart;version="0.9.0", org.osgi.framework;version="1.7.0", org.osgi.service.cm;version="1.4.0", org.osgi.service.component;version="1.2.0", @@ -21,7 +22,9 @@ org.eclipse.osbp.runtime.web.vaadin.databinding.container, com.vaadin.data, com.vaadin.data.util", - org.eclipse.osbp.runtime.web.vaadin.common.data.filter;version="0.9.0";uses:="com.vaadin.data,com.vaadin.data.util.filter", + org.eclipse.osbp.runtime.web.vaadin.common.data.filter;version="0.9.0"; + uses:="com.vaadin.data, + com.vaadin.data.util.filter", org.eclipse.osbp.runtime.web.vaadin.common.resource;version="0.9.0", org.eclipse.osbp.runtime.web.vaadin.common.resource.impl;version="0.9.0", org.eclipse.osbp.runtime.web.vaadin.common.services.filter;version="0.9.0", @@ -29,13 +32,15 @@ org.eclipse.osbp.runtime.web.vaadin.common.shortcuts;version="0.9.0", org.eclipse.osbp.runtime.web.vaadin.common.validator;version="0.9.0" Bundle-Vendor: Eclipse OSBP -Require-Bundle: com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", - org.eclipse.osbp.dsl.dto.lib;bundle-version="[0.9.0,0.10.0)", - org.eclipse.xtext.xbase.lib;bundle-version="[2.7.3,2.8.0)";resolution:=optional, org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)", + org.eclipse.osbp.dsl.dto.lib;bundle-version="[0.9.0,0.10.0)", + org.eclipse.xtext.xbase.lib;bundle-version="[2.11.0,2.12.0)";resolution:=optional, org.slf4j.api;bundle-version="1.7.2", - org.apache.commons.lang3 + org.apache.commons.lang3, + org.eclipse.osbp.dsl.dto.xtext;bundle-version="0.9.0", + org.eclipse.osbp.jpa.services;bundle-version="0.9.0" Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml, OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java index 4fc1b00..6566b8a 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java
@@ -37,7 +37,6 @@ import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.Property.ValueChangeNotifier; -import com.vaadin.data.util.AbstractInMemoryContainer; import com.vaadin.data.util.ItemSorter; import com.vaadin.data.util.MethodProperty.MethodException; import com.vaadin.data.util.NestedMethodProperty; @@ -81,10 +80,8 @@ */ @SuppressWarnings("serial") public abstract class AbstractDeepResolvingBeanContainer<IDTYPE, BEANTYPE> - extends - AbstractInMemoryContainer<IDTYPE, String, DeepResolvingBeanItem<BEANTYPE>> - implements ILazyRefreshFilterable, SimpleFilterable, Sortable, - ValueChangeListener, PropertySetChangeNotifier, + extends AbstractInMemoryContainerCustom<IDTYPE, String, DeepResolvingBeanItem<BEANTYPE>> + implements ILazyRefreshFilterable, SimpleFilterable, Sortable, ValueChangeListener, PropertySetChangeNotifier, IEnhancedFilterableContainer<IDTYPE>, INestedPropertyAble<BEANTYPE> { /** @@ -101,9 +98,8 @@ * the generic type * @since 6.5 */ - public static interface BeanIdResolver<IDTYPE, BEANTYPE> extends - Serializable { - + public static interface BeanIdResolver<IDTYPE, BEANTYPE> extends Serializable { + /** * Return the item identifier for a bean. * @@ -120,8 +116,7 @@ * The bean must have a getter for the property, and the getter must return * an object of type IDTYPE. */ - protected class PropertyBasedBeanIdResolver implements - BeanIdResolver<IDTYPE, BEANTYPE> { + protected class PropertyBasedBeanIdResolver implements BeanIdResolver<IDTYPE, BEANTYPE> { /** The property id. */ private final Object propertyId; @@ -134,27 +129,27 @@ */ public PropertyBasedBeanIdResolver(Object propertyId) { if (propertyId == null) { - throw new IllegalArgumentException( - "Property identifier must not be null"); + throw new IllegalArgumentException("Property identifier must not be null"); } this.propertyId = propertyId; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.common.data.AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java.lang.Object) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.vaadin.common.data. + * AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java. + * lang.Object) */ @Override @SuppressWarnings("unchecked") - public IDTYPE getIdForBean(BEANTYPE bean) - throws IllegalArgumentException { + public IDTYPE getIdForBean(BEANTYPE bean) throws IllegalArgumentException { VaadinPropertyDescriptor<BEANTYPE> pd = model.get(propertyId); if (null == pd) { - throw new IllegalStateException("Property " + propertyId - + " not found"); + throw new IllegalStateException("Property " + propertyId + " not found"); } try { - Property<IDTYPE> property = (Property<IDTYPE>) pd - .createProperty(bean); + Property<IDTYPE> property = (Property<IDTYPE>) pd.createProperty(bean); return property.getValue(); } catch (MethodException e) { throw new IllegalArgumentException(e); @@ -200,12 +195,11 @@ @SuppressWarnings("unchecked") protected AbstractDeepResolvingBeanContainer(Class<? super BEANTYPE> type) { if (type == null) { - throw new IllegalArgumentException( - "The bean type passed to AbstractBeanContainer must not be null"); + throw new IllegalArgumentException("The bean type passed to AbstractBeanContainer must not be null"); } this.type = type; - model = DeepResolvingBeanItem - .getPropertyDescriptors((Class<BEANTYPE>) type); + model = DeepResolvingBeanItem.getPropertyDescriptors((Class<BEANTYPE>) type); + getItemSorter().setSortProperties(this, new Object[0], new boolean[0]); } /* @@ -227,8 +221,13 @@ * @return created {@link DeepResolvingBeanItem} or null if bean is null */ protected DeepResolvingBeanItem<BEANTYPE> createBeanItem(BEANTYPE bean) { - return bean == null ? null : new DeepResolvingBeanItem<BEANTYPE>(bean, - model); + if (bean == null) { + return null; + } + + DeepResolvingBeanItem<BEANTYPE> item = new DeepResolvingBeanItem<BEANTYPE>(bean, model); + + return item; } /** @@ -290,8 +289,12 @@ return getUnfilteredItem(itemId); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractInMemoryContainer#getUnfilteredItem(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractInMemoryContainer#getUnfilteredItem(java. + * lang.Object) */ @Override protected DeepResolvingBeanItem<BEANTYPE> getUnfilteredItem(Object itemId) { @@ -364,7 +367,17 @@ @Override public void valueChange(ValueChangeEvent event) { // if a property that is used in a filter is changed, refresh filtering - filterAll(); + + for (Filter filter : getFilters()) { + for (String propertyId : getContainerPropertyIds()) { + if (filter.appliesToProperty(propertyId)) { + filterAll(); + } + } + } + + + } /* @@ -375,11 +388,10 @@ * java.lang.String, boolean, boolean) */ @Override - public void addContainerFilter(Object propertyId, String filterString, - boolean ignoreCase, boolean onlyMatchPrefix) { + public void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, + boolean onlyMatchPrefix) { try { - addFilter(new SimpleStringFilter(propertyId, filterString, - ignoreCase, onlyMatchPrefix)); + addFilter(new SimpleStringFilter(propertyId, filterString, ignoreCase, onlyMatchPrefix)); } catch (UnsupportedFilterException e) { // the filter instance created here is always valid for in-memory // containers @@ -419,17 +431,24 @@ } } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data.Container.Filter) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data. + * Container.Filter) */ @Override - public void addContainerFilter(Filter filter) - throws UnsupportedFilterException { + public void addContainerFilter(Filter filter) throws UnsupportedFilterException { addFilter(filter); } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin.data.Container.Filter) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin. + * data.Container.Filter) */ @Override public void removeContainerFilter(Filter filter) { @@ -465,15 +484,14 @@ * @param propertyId * The id of the property */ - @SuppressWarnings("deprecation") private void addValueChangeListener(Item item, Object propertyId) { Property<?> property = item.getItemProperty(propertyId); if (property instanceof ValueChangeNotifier) { // avoid multiple notifications for the same property if // multiple filters are in use ValueChangeNotifier notifier = (ValueChangeNotifier) property; - notifier.removeListener(this); - notifier.addListener(this); + notifier.removeValueChangeListener(this); + notifier.addValueChangeListener(this); } } @@ -527,7 +545,9 @@ sortContainer(propertyId, ascending); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.util.AbstractInMemoryContainer#getItemSorter() */ @Override @@ -535,32 +555,38 @@ return super.getItemSorter(); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractInMemoryContainer#setItemSorter(com.vaadin.data.util.ItemSorter) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractInMemoryContainer#setItemSorter(com.vaadin. + * data.util.ItemSorter) */ @Override public void setItemSorter(ItemSorter itemSorter) { super.setItemSorter(itemSorter); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractInMemoryContainer#registerNewItem(int, java.lang.Object, com.vaadin.data.Item) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractInMemoryContainer#registerNewItem(int, + * java.lang.Object, com.vaadin.data.Item) */ @Override - protected void registerNewItem(int position, IDTYPE itemId, - DeepResolvingBeanItem<BEANTYPE> item) { + protected void registerNewItem(int position, IDTYPE itemId, DeepResolvingBeanItem<BEANTYPE> item) { itemIdToItem.put(itemId, item); // add listeners to be able to update filtering on property // changes - for (Filter filter : getFilters()) { - for (String propertyId : getContainerPropertyIds()) { - if (filter.appliesToProperty(propertyId)) { - // addValueChangeListener avoids adding duplicates - addValueChangeListener(item, propertyId); - } - } + // for (Filter filter : getFilters()) { + for (String propertyId : getContainerPropertyIds()) { + // if (filter.appliesToProperty(propertyId)) { + // addValueChangeListener avoids adding duplicates + addValueChangeListener(item, propertyId); + // } } + // } } /** @@ -589,8 +615,7 @@ * @return the deep resolving bean item * @see com.vaadin.data.Container#addItem(Object) */ - protected DeepResolvingBeanItem<BEANTYPE> addItem(IDTYPE itemId, - BEANTYPE bean) { + protected DeepResolvingBeanItem<BEANTYPE> addItem(IDTYPE itemId, BEANTYPE bean) { if (!validateBean(bean)) { return null; } @@ -609,13 +634,11 @@ * @return the deep resolving bean item * @see com.vaadin.data.Container.Ordered#addItemAfter(Object, Object) */ - protected DeepResolvingBeanItem<BEANTYPE> addItemAfter( - IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean) { + protected DeepResolvingBeanItem<BEANTYPE> addItemAfter(IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean) { if (!validateBean(bean)) { return null; } - return internalAddItemAfter(previousItemId, newItemId, - createBeanItem(bean), true); + return internalAddItemAfter(previousItemId, newItemId, createBeanItem(bean), true); } /** @@ -633,14 +656,50 @@ * @return Returns the new DeepResolvingBeanItem or null if the operation * fails. */ - protected DeepResolvingBeanItem<BEANTYPE> addItemAt(int index, - IDTYPE newItemId, BEANTYPE bean) { + protected DeepResolvingBeanItem<BEANTYPE> addItemAt(int index, IDTYPE newItemId, BEANTYPE bean) { if (!validateBean(bean)) { return null; } return internalAddItemAt(index, newItemId, createBeanItem(bean), true); } + protected DeepResolvingBeanItem<BEANTYPE> internalAddItemAt(int index, IDTYPE newItemId, + DeepResolvingBeanItem<BEANTYPE> item, boolean filter) { + if (index < 0 || index > sizeUnfiltered()) { + return null; + } else if (index == 0) { + // add before any item, visible or not + return internalAddItemAfter(null, newItemId, item, filter); + } else { + // if index==size(), adds immediately after last visible item + return internalAddItemAfter(getIdByAllIndex(index - 1), newItemId, item, filter); + } + } + + public IDTYPE getIdByAllIndex(int index) { + return getAllItemIds().get(index); + } + + protected DeepResolvingBeanItem<BEANTYPE> internalAddItemAfter(IDTYPE previousItemId, IDTYPE newItemId, + DeepResolvingBeanItem<BEANTYPE> item, boolean filter) { + // only add if the previous item is visible + DeepResolvingBeanItem<BEANTYPE> newItem = null; + if (previousItemId == null) { + newItem = internalAddAt(0, newItemId, item); + } else if (getAllItemIds().contains(previousItemId)) { + newItem = internalAddAt(getAllItemIds().indexOf(previousItemId) + 1, newItemId, item); + } + if (newItem != null && filter) { + // TODO filter only this item, use fireItemAdded() + filterAll(); + if (!isFiltered()) { + // TODO hack: does not detect change in filterAll() in this case + fireItemAdded(indexOfId(newItemId), newItemId, item); + } + } + return newItem; + } + /** * Adds a bean to the container using the bean item id resolver to find its * identifier. @@ -663,8 +722,7 @@ } IDTYPE itemId = resolveBeanId(bean); if (itemId == null) { - throw new IllegalArgumentException( - "Resolved identifier for a bean must not be null"); + throw new IllegalArgumentException("Resolved identifier for a bean must not be null"); } return addItem(itemId, bean); } @@ -687,16 +745,14 @@ * if an identifier cannot be resolved for the bean * @see #addItemAfter(Object, Object, Object) */ - protected DeepResolvingBeanItem<BEANTYPE> addBeanAfter( - IDTYPE previousItemId, BEANTYPE bean) throws IllegalStateException, - IllegalArgumentException { + protected DeepResolvingBeanItem<BEANTYPE> addBeanAfter(IDTYPE previousItemId, BEANTYPE bean) + throws IllegalStateException, IllegalArgumentException { if (bean == null) { return null; } IDTYPE itemId = resolveBeanId(bean); if (itemId == null) { - throw new IllegalArgumentException( - "Resolved identifier for a bean must not be null"); + throw new IllegalArgumentException("Resolved identifier for a bean must not be null"); } return addItemAfter(previousItemId, itemId, bean); } @@ -725,8 +781,7 @@ } IDTYPE itemId = resolveBeanId(bean); if (itemId == null) { - throw new IllegalArgumentException( - "Resolved identifier for a bean must not be null"); + throw new IllegalArgumentException("Resolved identifier for a bean must not be null"); } return addItemAt(index, itemId, bean); } @@ -755,14 +810,12 @@ boolean modified = false; for (BEANTYPE bean : collection) { // TODO skipping invalid beans - should not allow them in javadoc? - if (bean == null - || !getBeanType().isAssignableFrom(bean.getClass())) { + if (bean == null || !getBeanType().isAssignableFrom(bean.getClass())) { continue; } IDTYPE itemId = resolveBeanId(bean); if (itemId == null) { - throw new IllegalArgumentException( - "Resolved identifier for a bean must not be null"); + throw new IllegalArgumentException("Resolved identifier for a bean must not be null"); } if (internalAddItemAtEnd(itemId, createBeanItem(bean), false) != null) { @@ -791,8 +844,7 @@ */ protected IDTYPE resolveBeanId(BEANTYPE bean) { if (beanIdResolver == null) { - throw new IllegalStateException( - "Bean item identifier resolver is required."); + throw new IllegalStateException("Bean item identifier resolver is required."); } return beanIdResolver.getIdForBean(bean); } @@ -810,8 +862,7 @@ * @param beanIdResolver * to use or null to disable automatic id resolution */ - protected void setBeanIdResolver( - BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver) { + protected void setBeanIdResolver(BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver) { this.beanIdResolver = beanIdResolver; } @@ -831,8 +882,7 @@ * property identifier, which must map to a getter in BEANTYPE * @return created resolver */ - protected BeanIdResolver<IDTYPE, BEANTYPE> createBeanPropertyResolver( - Object propertyId) { + protected BeanIdResolver<IDTYPE, BEANTYPE> createBeanPropertyResolver(Object propertyId) { return new PropertyBasedBeanIdResolver(propertyId); } @@ -849,12 +899,15 @@ addPropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com. + * vaadin.data.Container.PropertySetChangeListener) */ @Override - public void addPropertySetChangeListener( - Container.PropertySetChangeListener listener) { + public void addPropertySetChangeListener(Container.PropertySetChangeListener listener) { super.addPropertySetChangeListener(listener); } @@ -872,21 +925,28 @@ removePropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener( + * com.vaadin.data.Container.PropertySetChangeListener) */ @Override - public void removePropertySetChangeListener( - Container.PropertySetChangeListener listener) { + public void removePropertySetChangeListener(Container.PropertySetChangeListener listener) { super.removePropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractInMemoryContainer#addContainerProperty(java.lang.Object, java.lang.Class, java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractInMemoryContainer#addContainerProperty(java. + * lang.Object, java.lang.Class, java.lang.Object) */ @Override - public boolean addContainerProperty(Object propertyId, Class<?> type, - Object defaultValue) throws UnsupportedOperationException { + public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) + throws UnsupportedOperationException { throw new UnsupportedOperationException( "Use addNestedContainerProperty(String) to add container properties to a " + getClass().getSimpleName()); @@ -916,8 +976,7 @@ model.put(propertyId, propertyDescriptor); for (DeepResolvingBeanItem<BEANTYPE> item : itemIdToItem.values()) { - item.addItemProperty(propertyId, - propertyDescriptor.createProperty(item.getBean())); + item.addItemProperty(propertyId, propertyDescriptor.createProperty(item.getBean())); } // Sends a change event @@ -926,13 +985,15 @@ return true; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble#addNestedContainerProperty(java.lang.String) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble# + * addNestedContainerProperty(java.lang.String) */ @SuppressWarnings({ "rawtypes", "unchecked" }) public boolean addNestedContainerProperty(String propertyId) { - return addContainerProperty(propertyId, new NestedPropertyDescriptor( - propertyId, type)); + return addContainerProperty(propertyId, new NestedPropertyDescriptor(propertyId, type)); } /** @@ -956,13 +1017,12 @@ .getPropertyDescriptors((Class<Object>) propertyType); for (String subPropertyId : pds.keySet()) { String qualifiedPropertyId = propertyId + "." + subPropertyId; - NestedPropertyDescriptor<BEANTYPE> pd = new NestedPropertyDescriptor<BEANTYPE>( - qualifiedPropertyId, (Class<BEANTYPE>) type); + NestedPropertyDescriptor<BEANTYPE> pd = new NestedPropertyDescriptor<BEANTYPE>(qualifiedPropertyId, + (Class<BEANTYPE>) type); model.put(qualifiedPropertyId, pd); model.remove(propertyId); for (DeepResolvingBeanItem<BEANTYPE> item : itemIdToItem.values()) { - item.addItemProperty(propertyId, - pd.createProperty(item.getBean())); + item.addItemProperty(propertyId, pd.createProperty(item.getBean())); item.removeItemProperty(propertyId); } } @@ -971,12 +1031,15 @@ fireContainerPropertySetChange(); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractInMemoryContainer#removeContainerProperty(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractInMemoryContainer#removeContainerProperty( + * java.lang.Object) */ @Override - public boolean removeContainerProperty(Object propertyId) - throws UnsupportedOperationException { + public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException { // Fails if the Property is not present if (!model.containsKey(propertyId)) { return false; @@ -996,16 +1059,22 @@ return true; } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer#getUnfilteredItemIds() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container. + * IEnhancedFilterableContainer#getUnfilteredItemIds() */ @Override public List<IDTYPE> getUnfilteredItemIds() { return getAllItemIds(); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer#sizeUnfiltered() + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container. + * IEnhancedFilterableContainer#sizeUnfiltered() */ @Override public int sizeUnfiltered() {
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractInMemoryContainerCustom.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractInMemoryContainerCustom.java new file mode 100644 index 0000000..26e8473 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractInMemoryContainerCustom.java
@@ -0,0 +1,1169 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.eclipse.osbp.runtime.web.vaadin.common.data; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import com.vaadin.data.Container; +import com.vaadin.data.Container.ItemSetChangeNotifier; +import com.vaadin.data.Item; +import com.vaadin.data.util.AbstractContainer; +import com.vaadin.data.util.DefaultItemSorter; +import com.vaadin.data.util.ItemSorter; +import com.vaadin.data.util.ListSet; +import com.vaadin.data.util.filter.SimpleStringFilter; +import com.vaadin.data.util.filter.UnsupportedFilterException; + +/** + * Abstract {@link Container} class that handles common functionality for + * in-memory containers. Concrete in-memory container classes can either inherit + * this class, inherit {@link AbstractContainer}, or implement the + * {@link Container} interface directly. + * + * Adding and removing items (if desired) must be implemented in subclasses by + * overriding the appropriate add*Item() and remove*Item() and removeAllItems() + * methods, calling the corresponding + * {@link #internalAddItemAfter(Object, Object, Item)}, + * {@link #internalAddItemAt(int, Object, Item)}, + * {@link #internalAddItemAtEnd(Object, Item, boolean)}, + * {@link #internalRemoveItem(Object)} and {@link #internalRemoveAllItems()} + * methods. + * + * By default, adding and removing container properties is not supported, and + * subclasses need to implement {@link #getContainerPropertyIds()}. Optionally, + * subclasses can override {@link #addContainerProperty(Object, Class, Object)} + * and {@link #removeContainerProperty(Object)} to implement them. + * + * Features: + * <ul> + * <li>{@link Container.Ordered} + * <li>{@link Container.Indexed} + * <li>{@link Filterable} and {@link SimpleFilterable} (internal implementation, + * does not implement the interface directly) + * <li>{@link Sortable} (internal implementation, does not implement the + * interface directly) + * </ul> + * + * To implement {@link Sortable}, subclasses need to implement + * {@link #getSortablePropertyIds()} and call the superclass method + * {@link #sortContainer(Object[], boolean[])} in the method + * <code>sort(Object[], boolean[])</code>. + * + * To implement {@link Filterable}, subclasses need to implement the methods + * {@link Filterable#addContainerFilter(com.vaadin.data.Container.Filter)} + * (calling {@link #addFilter(Filter)}), + * {@link Filterable#removeAllContainerFilters()} (calling + * {@link #removeAllFilters()}) and + * {@link Filterable#removeContainerFilter(com.vaadin.data.Container.Filter)} + * (calling {@link #removeFilter(com.vaadin.data.Container.Filter)}). + * + * To implement {@link SimpleFilterable}, subclasses also need to implement the + * methods + * {@link SimpleFilterable#addContainerFilter(Object, String, boolean, boolean)} + * and {@link SimpleFilterable#removeContainerFilters(Object)} calling + * {@link #addFilter(com.vaadin.data.Container.Filter)} and + * {@link #removeFilters(Object)} respectively. + * + * @param <ITEMIDTYPE> + * the class of item identifiers in the container, use Object if can + * be any class + * @param <PROPERTYIDCLASS> + * the class of property identifiers for the items in the container, + * use Object if can be any class + * @param <ITEMCLASS> + * the (base) class of the Item instances in the container, use + * {@link Item} if unknown + * + * @since 6.6 + */ +public abstract class AbstractInMemoryContainerCustom<ITEMIDTYPE, PROPERTYIDCLASS, ITEMCLASS extends Item> + extends AbstractContainer + implements ItemSetChangeNotifier, Container.Indexed { + + /** + * An ordered {@link List} of all item identifiers in the container, + * including those that have been filtered out. + * + * Must not be null. + */ + private List<ITEMIDTYPE> allItemIds; + + /** + * An ordered {@link List} of item identifiers in the container after + * filtering, excluding those that have been filtered out. + * + * This is what the external API of the {@link Container} interface and its + * subinterfaces shows (e.g. {@link #size()}, {@link #nextItemId(Object)}). + * + * If null, the full item id list is used instead. + */ + private List<ITEMIDTYPE> filteredItemIds; + + /** + * Filters that are applied to the container to limit the items visible in + * it + */ + private Set<Filter> filters = new HashSet<Filter>(); + + /** + * The item sorter which is used for sorting the container. + */ + private ItemSorter itemSorter = new DefaultItemSorter(); + + // Constructors + + /** + * Constructor for an abstract in-memory container. + */ + protected AbstractInMemoryContainerCustom() { + setAllItemIds(new ListSet<ITEMIDTYPE>()); + } + + // Container interface methods with more specific return class + + // default implementation, can be overridden + @Override + public ITEMCLASS getItem(Object itemId) { + if (containsId(itemId)) { + return getUnfilteredItem(itemId); + } else { + return null; + } + } + + private static abstract class BaseItemAddOrRemoveEvent extends EventObject + implements Serializable { + protected Object itemId; + protected int index; + protected int count; + + public BaseItemAddOrRemoveEvent(Container source, Object itemId, + int index, int count) { + super(source); + this.itemId = itemId; + this.index = index; + this.count = count; + } + + public Container getContainer() { + return (Container) getSource(); + } + + public Object getFirstItemId() { + return itemId; + } + + public int getFirstIndex() { + return index; + } + + public int getAffectedItemsCount() { + return count; + } + } + + /** + * An <code>Event</code> object specifying information about the added + * items. + * + * <p> + * This class provides information about the first added item and the number + * of added items. + * </p> + * + * @since 7.4 + */ + protected static class BaseItemAddEvent extends BaseItemAddOrRemoveEvent + implements Container.Indexed.ItemAddEvent { + + public BaseItemAddEvent(Container source, Object itemId, int index, + int count) { + super(source, itemId, index, count); + } + + @Override + public int getAddedItemsCount() { + return getAffectedItemsCount(); + } + } + + /** + * An <code>Event</code> object specifying information about the removed + * items. + * + * <p> + * This class provides information about the first removed item and the + * number of removed items. + * </p> + * + * @since 7.4 + */ + protected static class BaseItemRemoveEvent extends BaseItemAddOrRemoveEvent + implements Container.Indexed.ItemRemoveEvent { + + public BaseItemRemoveEvent(Container source, Object itemId, int index, + int count) { + super(source, itemId, index, count); + } + + @Override + public int getRemovedItemsCount() { + return getAffectedItemsCount(); + } + } + + /** + * Get an item even if filtered out. + * + * For internal use only. + * + * @param itemId + * @return + */ + protected abstract ITEMCLASS getUnfilteredItem(Object itemId); + + // cannot override getContainerPropertyIds() and getItemIds(): if subclass + // uses Object as ITEMIDCLASS or PROPERTYIDCLASS, Collection<Object> cannot + // be cast to Collection<MyInterface> + + // public abstract Collection<PROPERTYIDCLASS> getContainerPropertyIds(); + // public abstract Collection<ITEMIDCLASS> getItemIds(); + + // Container interface method implementations + + @Override + public int size() { + return getVisibleItemIds().size(); + } + + @Override + public boolean containsId(Object itemId) { + // only look at visible items after filtering + if (itemId == null) { + return false; + } else { + return getVisibleItemIds().contains(itemId); + } + } + + @Override + public List<?> getItemIds() { + return Collections.unmodifiableList(getVisibleItemIds()); + } + + // Container.Ordered + + @Override + public ITEMIDTYPE nextItemId(Object itemId) { + int index = indexOfId(itemId); + if (index >= 0 && index < size() - 1) { + return getIdByIndex(index + 1); + } else { + // out of bounds + return null; + } + } + + @Override + public ITEMIDTYPE prevItemId(Object itemId) { + int index = indexOfId(itemId); + if (index > 0) { + return getIdByIndex(index - 1); + } else { + // out of bounds + return null; + } + } + + @Override + public ITEMIDTYPE firstItemId() { + if (size() > 0) { + return getIdByIndex(0); + } else { + return null; + } + } + + @Override + public ITEMIDTYPE lastItemId() { + if (size() > 0) { + return getIdByIndex(size() - 1); + } else { + return null; + } + } + + @Override + public boolean isFirstId(Object itemId) { + if (itemId == null) { + return false; + } + return itemId.equals(firstItemId()); + } + + @Override + public boolean isLastId(Object itemId) { + if (itemId == null) { + return false; + } + return itemId.equals(lastItemId()); + } + + // Container.Indexed + + @Override + public ITEMIDTYPE getIdByIndex(int index) { + return getVisibleItemIds().get(index); + } + + @Override + public List<ITEMIDTYPE> getItemIds(int startIndex, int numberOfIds) { + if (startIndex < 0) { + throw new IndexOutOfBoundsException( + "Start index cannot be negative! startIndex=" + startIndex); + } + + if (startIndex > getVisibleItemIds().size()) { + throw new IndexOutOfBoundsException( + "Start index exceeds container size! startIndex=" + + startIndex + " containerLastItemIndex=" + + (getVisibleItemIds().size() - 1)); + } + + if (numberOfIds < 1) { + if (numberOfIds == 0) { + return Collections.emptyList(); + } + + throw new IllegalArgumentException( + "Cannot get negative amount of items! numberOfItems=" + + numberOfIds); + } + + int endIndex = startIndex + numberOfIds; + + if (endIndex > getVisibleItemIds().size()) { + endIndex = getVisibleItemIds().size(); + } + + return Collections.unmodifiableList( + getVisibleItemIds().subList(startIndex, endIndex)); + + } + + @Override + public int indexOfId(Object itemId) { + return getVisibleItemIds().indexOf(itemId); + } + + // methods that are unsupported by default, override to support + + @Override + public Object addItemAt(int index) throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public Item addItemAt(int index, Object newItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public Object addItemAfter(Object previousItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public Item addItemAfter(Object previousItemId, Object newItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public Item addItem(Object itemId) throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public Object addItem() throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding items not supported. Override the relevant addItem*() methods if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public boolean removeItem(Object itemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Removing items not supported. Override the removeItem() method if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public boolean removeAllItems() throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Removing items not supported. Override the removeAllItems() method if required as specified in AbstractInMemoryContainer javadoc."); + } + + @Override + public boolean addContainerProperty(Object propertyId, Class<?> type, + Object defaultValue) throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Adding container properties not supported. Override the addContainerProperty() method if required."); + } + + @Override + public boolean removeContainerProperty(Object propertyId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Removing container properties not supported. Override the addContainerProperty() method if required."); + } + + // ItemSetChangeNotifier + /** + * @deprecated As of 7.0, replaced by + * {@link #addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener)} + **/ + @Deprecated + @Override + public void addListener(Container.ItemSetChangeListener listener) { + addItemSetChangeListener(listener); + } + + @Override + public void addItemSetChangeListener( + Container.ItemSetChangeListener listener) { + super.addItemSetChangeListener(listener); + } + + @Override + public void removeItemSetChangeListener( + Container.ItemSetChangeListener listener) { + super.removeItemSetChangeListener(listener); + } + + /** + * @deprecated As of 7.0, replaced by + * {@link #removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener)} + **/ + @Deprecated + @Override + public void removeListener(Container.ItemSetChangeListener listener) { + removeItemSetChangeListener(listener); + } + + // internal methods + + // Filtering support + + /** + * Filter the view to recreate the visible item list from the unfiltered + * items, and send a notification if the set of visible items changed in any + * way. + */ + protected void filterAll() { + if (doFilterContainer(!getFilters().isEmpty())) { + fireItemSetChange(); + } + } + + /** + * Filters the data in the container and updates internal data structures. + * This method should reset any internal data structures and then repopulate + * them so {@link #getItemIds()} and other methods only return the filtered + * items. + * + * @param hasFilters + * true if filters has been set for the container, false + * otherwise + * @return true if the item set has changed as a result of the filtering + */ + protected boolean doFilterContainer(boolean hasFilters) { + if (!hasFilters) { + boolean changed = getAllItemIds().size() != getVisibleItemIds() + .size(); + setFilteredItemIds(null); + return changed; + } + + // Reset filtered list + List<ITEMIDTYPE> originalFilteredItemIds = getFilteredItemIds(); + boolean wasUnfiltered = false; + if (originalFilteredItemIds == null) { + originalFilteredItemIds = Collections.emptyList(); + wasUnfiltered = true; + } + setFilteredItemIds(new ListSet<ITEMIDTYPE>()); + + // Filter + boolean equal = true; + Iterator<ITEMIDTYPE> origIt = originalFilteredItemIds.iterator(); + for (final Iterator<ITEMIDTYPE> i = getAllItemIds().iterator(); i + .hasNext();) { + final ITEMIDTYPE id = i.next(); + if (passesFilters(id)) { + // filtered list comes from the full list, can use == + equal = equal && origIt.hasNext() && origIt.next() == id; + getFilteredItemIds().add(id); + } + } + + return (wasUnfiltered && !getAllItemIds().isEmpty()) || !equal + || origIt.hasNext(); + } + + /** + * Checks if the given itemId passes the filters set for the container. The + * caller should make sure the itemId exists in the container. For + * non-existing itemIds the behavior is undefined. + * + * @param itemId + * An itemId that exists in the container. + * @return true if the itemId passes all filters or no filters are set, + * false otherwise. + */ + protected boolean passesFilters(Object itemId) { + ITEMCLASS item = getUnfilteredItem(itemId); + if (getFilters().isEmpty()) { + return true; + } + final Iterator<Filter> i = getFilters().iterator(); + while (i.hasNext()) { + final Filter f = i.next(); + if (!f.passesFilter(itemId, item)) { + return false; + } + } + return true; + } + + /** + * Adds a container filter and re-filter the view. + * + * The filter must implement Filter and its sub-filters (if any) must also + * be in-memory filterable. + * + * This can be used to implement + * {@link Filterable#addContainerFilter(com.vaadin.data.Container.Filter)} + * and optionally also + * {@link SimpleFilterable#addContainerFilter(Object, String, boolean, boolean)} + * (with {@link SimpleStringFilter}). + * + * Note that in some cases, incompatible filters cannot be detected when + * added and an {@link UnsupportedFilterException} may occur when performing + * filtering. + * + * @throws UnsupportedFilterException + * if the filter is detected as not supported by the container + */ + protected void addFilter(Filter filter) throws UnsupportedFilterException { + getFilters().add(filter); + filterAll(); + } + + /** + * Returns true if any filters have been applied to the container. + * + * @return true if the container has filters applied, false otherwise + * @since 7.1 + */ + protected boolean hasContainerFilters() { + return !getContainerFilters().isEmpty(); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container.Filterable#getContainerFilters() + */ + protected Collection<Filter> getContainerFilters() { + return Collections.unmodifiableCollection(filters); + } + + /** + * Remove a specific container filter and re-filter the view (if necessary). + * + * This can be used to implement + * {@link Filterable#removeContainerFilter(com.vaadin.data.Container.Filter)} + * . + */ + protected void removeFilter(Filter filter) { + for (Iterator<Filter> iterator = getFilters().iterator(); iterator + .hasNext();) { + Filter f = iterator.next(); + if (f.equals(filter)) { + iterator.remove(); + filterAll(); + return; + } + } + } + + /** + * Remove all container filters for all properties and re-filter the view. + * + * This can be used to implement + * {@link Filterable#removeAllContainerFilters()}. + */ + protected void removeAllFilters() { + if (getFilters().isEmpty()) { + return; + } + getFilters().clear(); + filterAll(); + } + + /** + * Checks if there is a filter that applies to a given property. + * + * @param propertyId + * @return true if there is an active filter for the property + */ + protected boolean isPropertyFiltered(Object propertyId) { + if (getFilters().isEmpty() || propertyId == null) { + return false; + } + final Iterator<Filter> i = getFilters().iterator(); + while (i.hasNext()) { + final Filter f = i.next(); + if (f.appliesToProperty(propertyId)) { + return true; + } + } + return false; + } + + /** + * Remove all container filters for a given property identifier and + * re-filter the view. This also removes filters applying to multiple + * properties including the one identified by propertyId. + * + * This can be used to implement + * {@link Filterable#removeContainerFilters(Object)}. + * + * @param propertyId + * @return Collection<Filter> removed filters + */ + protected Collection<Filter> removeFilters(Object propertyId) { + if (getFilters().isEmpty() || propertyId == null) { + return Collections.emptyList(); + } + List<Filter> removedFilters = new LinkedList<Filter>(); + for (Iterator<Filter> iterator = getFilters().iterator(); iterator + .hasNext();) { + Filter f = iterator.next(); + if (f.appliesToProperty(propertyId)) { + removedFilters.add(f); + iterator.remove(); + } + } + if (!removedFilters.isEmpty()) { + filterAll(); + return removedFilters; + } + return Collections.emptyList(); + } + + // sorting + + /** + * Returns the ItemSorter used for comparing items in a sort. See + * {@link #setItemSorter(ItemSorter)} for more information. + * + * @return The ItemSorter used for comparing two items in a sort. + */ + protected ItemSorter getItemSorter() { + return itemSorter; + } + + /** + * Sets the ItemSorter used for comparing items in a sort. The + * {@link ItemSorter#compare(Object, Object)} method is called with item ids + * to perform the sorting. A default ItemSorter is used if this is not + * explicitly set. + * + * @param itemSorter + * The ItemSorter used for comparing two items in a sort (not + * null). + */ + protected void setItemSorter(ItemSorter itemSorter) { + this.itemSorter = itemSorter; + } + + /** + * Sort base implementation to be used to implement {@link Sortable}. + * + * Subclasses should call this from a public + * {@link #sort(Object[], boolean[])} method when implementing Sortable. + * + * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], + * boolean[]) + */ + protected void sortContainer(Object[] propertyId, boolean[] ascending) { + if (!(this instanceof Sortable)) { + throw new UnsupportedOperationException( + "Cannot sort a Container that does not implement Sortable"); + } + + // Set up the item sorter for the sort operation + getItemSorter().setSortProperties((Sortable) this, propertyId, + ascending); + + // Perform the actual sort + doSort(); + + // Post sort updates + if (isFiltered()) { + filterAll(); + } else { + fireItemSetChange(); + } + + } + + /** + * Perform the sorting of the data structures in the container. This is + * invoked when the <code>itemSorter</code> has been prepared for the sort + * operation. Typically this method calls + * <code>Collections.sort(aCollection, getItemSorter())</code> on all arrays + * (containing item ids) that need to be sorted. + * + */ + protected void doSort() { + Collections.sort(getAllItemIds(), getItemSorter()); + } + + /** + * Returns the sortable property identifiers for the container. Can be used + * to implement {@link Sortable#getSortableContainerPropertyIds()}. + */ + protected Collection<?> getSortablePropertyIds() { + LinkedList<Object> sortables = new LinkedList<Object>(); + for (Object propertyId : getContainerPropertyIds()) { + Class<?> propertyType = getType(propertyId); + if (Comparable.class.isAssignableFrom(propertyType) + || propertyType.isPrimitive()) { + sortables.add(propertyId); + } + } + return sortables; + } + + // removing items + + /** + * Removes all items from the internal data structures of this class. This + * can be used to implement {@link #removeAllItems()} in subclasses. + * + * No notification is sent, the caller has to fire a suitable item set + * change notification. + */ + protected void internalRemoveAllItems() { + // Removes all Items + getAllItemIds().clear(); + if (isFiltered()) { + getFilteredItemIds().clear(); + } + } + + /** + * Removes a single item from the internal data structures of this class. + * This can be used to implement {@link #removeItem(Object)} in subclasses. + * + * No notification is sent, the caller has to fire a suitable item set + * change notification. + * + * @param itemId + * the identifier of the item to remove + * @return true if an item was successfully removed, false if failed to + * remove or no such item + */ + protected boolean internalRemoveItem(Object itemId) { + if (itemId == null) { + return false; + } + + boolean result = getAllItemIds().remove(itemId); + if (result && isFiltered()) { + getFilteredItemIds().remove(itemId); + } + + return result; + } + + // adding items + + /** + * Adds the bean to all internal data structures at the given position. + * Fails if an item with itemId is already in the container. Returns a the + * item if it was added successfully, null otherwise. + * + * <p> + * Caller should initiate filtering after calling this method. + * </p> + * + * For internal use only - subclasses should use + * {@link #internalAddItemAtEnd(Object, Item, boolean)}, + * {@link #internalAddItemAt(int, Object, Item, boolean)} and + * {@link #internalAddItemAfter(Object, Object, Item, boolean)} instead. + * + * @param position + * The position at which the item should be inserted in the + * unfiltered collection of items + * @param itemId + * The item identifier for the item to insert + * @param item + * The item to insert + * + * @return ITEMCLASS if the item was added successfully, null otherwise + */ + protected ITEMCLASS internalAddAt(int position, ITEMIDTYPE itemId, + ITEMCLASS item) { + if (position < 0 || position > getAllItemIds().size() || itemId == null + || item == null) { + return null; + } + // Make sure that the item has not been added previously + if (getAllItemIds().contains(itemId)) { + return null; + } + + // "filteredList" will be updated in filterAll() which should be invoked + // by the caller after calling this method. + getAllItemIds().add(position, itemId); + registerNewItem(position, itemId, item); + + return item; + } + + /** + * Add an item at the end of the container, and perform filtering if + * necessary. An event is fired if the filtered view changes. + * + * @param newItemId + * @param item + * new item to add + * @param filter + * true to perform filtering and send event after adding the + * item, false to skip these operations for batch inserts - if + * false, caller needs to make sure these operations are + * performed at the end of the batch + * @return item added or null if no item was added + */ + protected ITEMCLASS internalAddItemAtEnd(ITEMIDTYPE newItemId, + ITEMCLASS item, boolean filter) { + ITEMCLASS newItem = internalAddAt(getAllItemIds().size(), newItemId, + item); + if (newItem != null && filter) { + // TODO filter only this item, use fireItemAdded() + filterAll(); + if (!isFiltered()) { + // TODO hack: does not detect change in filterAll() in this case + fireItemAdded(indexOfId(newItemId), newItemId, item); + } + } + return newItem; + } + + /** + * Add an item after a given (visible) item, and perform filtering. An event + * is fired if the filtered view changes. + * + * The new item is added at the beginning if previousItemId is null. + * + * @param previousItemId + * item id of a visible item after which to add the new item, or + * null to add at the beginning + * @param newItemId + * @param item + * new item to add + * @param filter + * true to perform filtering and send event after adding the + * item, false to skip these operations for batch inserts - if + * false, caller needs to make sure these operations are + * performed at the end of the batch + * @return item added or null if no item was added + */ + protected ITEMCLASS internalAddItemAfter(ITEMIDTYPE previousItemId, + ITEMIDTYPE newItemId, ITEMCLASS item, boolean filter) { + // only add if the previous item is visible + ITEMCLASS newItem = null; + if (previousItemId == null) { + newItem = internalAddAt(0, newItemId, item); + } else if (containsId(previousItemId)) { + newItem = internalAddAt(getAllItemIds().indexOf(previousItemId) + 1, + newItemId, item); + } + if (newItem != null && filter) { + // TODO filter only this item, use fireItemAdded() + filterAll(); + if (!isFiltered()) { + // TODO hack: does not detect change in filterAll() in this case + fireItemAdded(indexOfId(newItemId), newItemId, item); + } + } + return newItem; + } + + /** + * Add an item at a given (visible after filtering) item index, and perform + * filtering. An event is fired if the filtered view changes. + * + * @param index + * position where to add the item (visible/view index) + * @param newItemId + * @param item + * new item to add + * @param filter + * true to perform filtering and send event after adding the + * item, false to skip these operations for batch inserts - if + * false, caller needs to make sure these operations are + * performed at the end of the batch + * @return item added or null if no item was added + */ + protected ITEMCLASS internalAddItemAt(int index, ITEMIDTYPE newItemId, + ITEMCLASS item, boolean filter) { + if (index < 0 || index > size()) { + return null; + } else if (index == 0) { + // add before any item, visible or not + return internalAddItemAfter(null, newItemId, item, filter); + } else { + // if index==size(), adds immediately after last visible item + return internalAddItemAfter(getIdByIndex(index - 1), newItemId, + item, filter); + } + } + + /** + * Registers a new item as having been added to the container. This can + * involve storing the item or any relevant information about it in internal + * container-specific collections if necessary, as well as registering + * listeners etc. + * + * The full identifier list in {@link AbstractInMemoryContainer} has already + * been updated to reflect the new item when this method is called. + * + * @param position + * @param itemId + * @param item + */ + protected void registerNewItem(int position, ITEMIDTYPE itemId, + ITEMCLASS item) { + } + + // item set change notifications + + /** + * Notify item set change listeners that an item has been added to the + * container. + * + * @since 7.4 + * + * @param position + * position of the added item in the view + * @param itemId + * id of the added item + * @param item + * the added item + */ + protected void fireItemAdded(int position, ITEMIDTYPE itemId, + ITEMCLASS item) { + fireItemsAdded(position, itemId, 1); + } + + /** + * Notify item set change listeners that items has been added to the + * container. + * + * @param firstPosition + * position of the first visible added item in the view + * @param firstItemId + * id of the first visible added item + * @param numberOfItems + * the number of visible added items + */ + protected void fireItemsAdded(int firstPosition, ITEMIDTYPE firstItemId, + int numberOfItems) { + BaseItemAddEvent addEvent = new BaseItemAddEvent(this, firstItemId, + firstPosition, numberOfItems); + fireItemSetChange(addEvent); + } + + /** + * Notify item set change listeners that an item has been removed from the + * container. + * + * @since 7.4 + * + * @param position + * position of the removed item in the view prior to removal (if + * was visible) + * @param itemId + * id of the removed item, of type {@link Object} to satisfy + * {@link Container#removeItem(Object)} API + */ + protected void fireItemRemoved(int position, Object itemId) { + fireItemsRemoved(position, itemId, 1); + } + + /** + * Notify item set change listeners that items has been removed from the + * container. + * + * @param firstPosition + * position of the first visible removed item in the view prior + * to removal + * @param firstItemId + * id of the first visible removed item, of type {@link Object} + * to satisfy {@link Container#removeItem(Object)} API + * @param numberOfItems + * the number of removed visible items + * + */ + protected void fireItemsRemoved(int firstPosition, Object firstItemId, + int numberOfItems) { + BaseItemRemoveEvent removeEvent = new BaseItemRemoveEvent(this, + firstItemId, firstPosition, numberOfItems); + fireItemSetChange(removeEvent); + } + + // visible and filtered item identifier lists + + /** + * Returns the internal list of visible item identifiers after filtering. + * + * For internal use only. + */ + protected List<ITEMIDTYPE> getVisibleItemIds() { + if (isFiltered()) { + return getFilteredItemIds(); + } else { + return getAllItemIds(); + } + } + + /** + * Returns the item id of the first visible item after filtering. 'Null' is + * returned if there is no visible items. + * <p> + * For internal use only. + * + * @since 7.4 + * + * @return item id of the first visible item + */ + protected ITEMIDTYPE getFirstVisibleItem() { + if (!getVisibleItemIds().isEmpty()) { + return getVisibleItemIds().get(0); + } + return null; + } + + /** + * Returns true is the container has active filters. + * + * @return true if the container is currently filtered + */ + protected boolean isFiltered() { + return filteredItemIds != null; + } + + /** + * Internal helper method to set the internal list of filtered item + * identifiers. Should not be used outside this class except for + * implementing clone(), may disappear from future versions. + * + * @param filteredItemIds + */ + @Deprecated + protected void setFilteredItemIds(List<ITEMIDTYPE> filteredItemIds) { + this.filteredItemIds = filteredItemIds; + } + + /** + * Internal helper method to get the internal list of filtered item + * identifiers. Should not be used outside this class except for + * implementing clone(), may disappear from future versions - use + * {@link #getVisibleItemIds()} in other contexts. + * + * @return List<ITEMIDTYPE> + */ + protected List<ITEMIDTYPE> getFilteredItemIds() { + return filteredItemIds; + } + + /** + * Internal helper method to set the internal list of all item identifiers. + * Should not be used outside this class except for implementing clone(), + * may disappear from future versions. + * + * @param allItemIds + */ + @Deprecated + protected void setAllItemIds(List<ITEMIDTYPE> allItemIds) { + this.allItemIds = allItemIds; + } + + /** + * Internal helper method to get the internal list of all item identifiers. + * Avoid using this method outside this class, may disappear in future + * versions. + * + * @return List<ITEMIDTYPE> + */ + protected List<ITEMIDTYPE> getAllItemIds() { + return allItemIds; + } + + /** + * Set the internal collection of filters without performing filtering. + * + * This method is mostly for internal use, use + * {@link #addFilter(com.vaadin.data.Container.Filter)} and + * <code>remove*Filter*</code> (which also re-filter the container) instead + * when possible. + * + * @param filters + */ + protected void setFilters(Set<Filter> filters) { + this.filters = filters; + } + + /** + * Returns the internal collection of filters. The returned collection + * should not be modified by callers outside this class. + * + * @return Set<Filter> + */ + protected Set<Filter> getFilters() { + return filters; + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java index 51f54a9..f7d7825 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java
@@ -20,12 +20,18 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; -import org.eclipse.osbp.dsl.dto.lib.services.SortBy; -import org.eclipse.osbp.dsl.dto.lib.services.SortOrder; +import org.eclipse.osbp.dsl.semantic.dto.util.NamingConventionsUtil; import org.eclipse.osbp.runtime.common.annotations.DtoUtils; +import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent; +import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherDataTag; +import org.eclipse.osbp.runtime.common.event.IEventDispatcher; +import org.eclipse.osbp.runtime.common.filter.IDatamartService; +import org.eclipse.osbp.runtime.common.filter.SortBy; +import org.eclipse.osbp.runtime.common.filter.SortOrder; import org.eclipse.osbp.runtime.common.state.ISharedStateContext; -import org.eclipse.osbp.runtime.common.state.SharedStateUnitOfWork; +import org.eclipse.osbp.ui.api.datamart.IDatamartContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +50,6 @@ import com.vaadin.data.util.filter.SimpleStringFilter; import com.vaadin.data.util.filter.UnsupportedFilterException; -// TODO: Auto-generated Javadoc /** * The Class BeanServiceLazyLoadingContainer. * @@ -52,43 +57,42 @@ * the generic type */ @SuppressWarnings("serial") -public class BeanServiceLazyLoadingContainer<BEANTYPE> extends - AbstractContainer implements Filterable, Indexed, SimpleFilterable, - ILazyRefreshFilterable, Sortable, ValueChangeListener, - Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier, - IClearable, INestedPropertyAble<BEANTYPE> { +public class BeanServiceLazyLoadingContainer<BEANTYPE> extends AbstractContainer + implements Filterable, Indexed, SimpleFilterable, ILazyRefreshFilterable, Sortable, ValueChangeListener, + Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier, IClearable, INestedPropertyAble<BEANTYPE>, + IAlreadyLoadedItemIdProvider<BEANTYPE>, IEventDispatcher.Receiver { /** The Constant LOGGER. */ - private static final Logger LOGGER = LoggerFactory - .getLogger(BeanServiceLazyLoadingContainer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BeanServiceLazyLoadingContainer.class); + + private BeanIdResolver<BEANTYPE> beanIdResolver = new DtoIdResolver<>(); /** The service. */ private IBeanSearchService<BEANTYPE> service; - + /** The sort order. */ private SortOrder sortOrder = new SortOrder(); - + /** The filters. */ private List<Filter> filters = new ArrayList<Filter>(); - + /** The type. */ private Class<BEANTYPE> type; /** The sortable properties. */ private Set<String> sortableProperties = new HashSet<String>(); - + /** The model. */ private LinkedHashMap<String, VaadinPropertyDescriptor<BEANTYPE>> model; /** The cache. */ - private Map<Object, DeepResolvingBeanItem<BEANTYPE>> cache = new HashMap<Object, DeepResolvingBeanItem<BEANTYPE>>(); - + private Map<Object, DeepResolvingBeanItem<BEANTYPE>> cache = new HashMap<>(); + /** The external cache. */ // new records that have been added from outside -> new records - private Map<Object, DeepResolvingBeanItem<BEANTYPE>> externalCache = new HashMap<Object, DeepResolvingBeanItem<BEANTYPE>>(); + private Map<Object, DeepResolvingBeanItem<BEANTYPE>> externalCache = new HashMap<>(); - /** The shared state. */ - private final ISharedStateContext sharedState; + private IEventDispatcher eventDispatcher; /** * Instantiates a new bean service lazy loading container. @@ -100,14 +104,13 @@ * @param sharedState * the shared state */ - public BeanServiceLazyLoadingContainer( - IBeanSearchService<BEANTYPE> service, Class<BEANTYPE> type, - ISharedStateContext sharedState) { - this.service = service != null ? service - : new StatefulInMemoryBeanSearchService<BEANTYPE>(type); + public BeanServiceLazyLoadingContainer(IBeanSearchService<BEANTYPE> service, Class<BEANTYPE> type, + ISharedStateContext sharedState, IEventDispatcher eventDispatcher) { + this.service = service != null ? service : new StatefulInMemoryBeanSearchService<BEANTYPE>(type); this.type = type; - model = DeepResolvingBeanItem - .getPropertyDescriptors((Class<BEANTYPE>) type); + this.eventDispatcher = eventDispatcher; + + model = DeepResolvingBeanItem.getPropertyDescriptors((Class<BEANTYPE>) type); // create all sortable columns for (String column : model.keySet()) { @@ -116,68 +119,124 @@ } sortableProperties.add(column); } - this.sharedState = sharedState; + + if (eventDispatcher != null) { + eventDispatcher.addEventReceiver(this); + } } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data.Container.PropertySetChangeListener) + public BeanServiceLazyLoadingContainer(IBeanSearchService<BEANTYPE> service, Class<BEANTYPE> type, + ISharedStateContext sharedState) { + this(service, type, sharedState, null); + } + + @Override + public void receiveEvent(EventDispatcherEvent event) { + switch (event.getCommand()) { + case SAVE: + case DELETE: + if (event.getTopic().equals(NamingConventionsUtil.toFqnEntityName(type.getCanonicalName()))) { + Map<Object, BEANTYPE> loadedItems = getAlreadyLoadedItemIdsAsMap(); + Object changedId = event.getData().get(EventDispatcherDataTag.ID); + if (loadedItems.containsKey(changedId)) { + BEANTYPE bean = loadedItems.get(changedId); + disposeCacheFor(bean); + } + } + break; + default: + break; + } + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data. + * Container.PropertySetChangeListener) */ @Override public void addListener(PropertySetChangeListener listener) { super.addPropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data.Container.PropertySetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data. + * Container.PropertySetChangeListener) */ @Override public void removeListener(PropertySetChangeListener listener) { super.removePropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data.Container.ItemSetChangeListener) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data. + * Container.ItemSetChangeListener) */ @Override public void addListener(ItemSetChangeListener listener) { super.addItemSetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data.Container.ItemSetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data. + * Container.ItemSetChangeListener) */ @Override public void removeListener(ItemSetChangeListener listener) { super.removeItemSetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com. + * vaadin.data.Container.PropertySetChangeListener) */ @Override public void addPropertySetChangeListener(PropertySetChangeListener listener) { super.addPropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener( + * com.vaadin.data.Container.PropertySetChangeListener) */ @Override - public void removePropertySetChangeListener( - PropertySetChangeListener listener) { + public void removePropertySetChangeListener(PropertySetChangeListener listener) { super.removePropertySetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.AbstractContainer#addItemSetChangeListener(com. + * vaadin.data.Container.ItemSetChangeListener) */ @Override public void addItemSetChangeListener(ItemSetChangeListener listener) { super.addItemSetChangeListener(listener); } - /* (non-Javadoc) - * @see com.vaadin.data.util.AbstractContainer#removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.AbstractContainer#removeItemSetChangeListener(com. + * vaadin.data.Container.ItemSetChangeListener) */ @Override public void removeItemSetChangeListener(ItemSetChangeListener listener) { @@ -193,8 +252,7 @@ * the bean * @return the deep resolving bean item */ - protected DeepResolvingBeanItem<BEANTYPE> addItem(Object itemId, - BEANTYPE bean) { + protected DeepResolvingBeanItem<BEANTYPE> addItem(Object itemId, BEANTYPE bean) { return addBean(bean); } @@ -207,12 +265,13 @@ * the item * @return the deep resolving bean item */ - protected DeepResolvingBeanItem<BEANTYPE> internalAddItemAtEnd( - Object newItemId, DeepResolvingBeanItem<BEANTYPE> item) { - if (externalCache.containsKey(newItemId)) { - cache.put(newItemId, externalCache.get(newItemId)); + protected DeepResolvingBeanItem<BEANTYPE> internalAddItemAtEnd(Object newItemId, + DeepResolvingBeanItem<BEANTYPE> item) { + Object key = resolveBeanId(newItemId); + if (externalCache.containsKey(key)) { + cache.put(key, externalCache.get(key)); } else { - cache.put(newItemId, item); + cache.put(key, item); } return item; } @@ -225,155 +284,119 @@ * @return the deep resolving bean item */ protected DeepResolvingBeanItem<BEANTYPE> createBeanItem(BEANTYPE bean) { - return bean == null ? null : new DeepResolvingBeanItem<BEANTYPE>(bean, - model); + return bean == null ? null : new DeepResolvingBeanItem<BEANTYPE>(bean, model); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#nextItemId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public Object nextItemId(final Object itemId) { - if (sharedState != null) { - return new SharedStateUnitOfWork<Object>() { - @Override - protected Object doExecute() { - return service.getNextBean((BEANTYPE) itemId, filters, - sortOrder); - } - }.execute(sharedState); - } else { - return mapToCachedId(service.getNextBean((BEANTYPE) itemId, - filters, sortOrder)); - } + return mapToCachedId(service.getNextBean((BEANTYPE) itemId, filters, sortOrder)); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#prevItemId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public Object prevItemId(final Object itemId) { - if (sharedState != null) { - return new SharedStateUnitOfWork<Object>() { - @Override - protected Object doExecute() { - return service.getPreviousBean((BEANTYPE) itemId, filters, - sortOrder); - } - }.execute(sharedState); - } else { - return mapToCachedId(service.getPreviousBean((BEANTYPE) itemId, - filters, sortOrder)); - } + return mapToCachedId(service.getPreviousBean((BEANTYPE) itemId, filters, sortOrder)); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#firstItemId() */ @Override public Object firstItemId() { - if (sharedState != null) { - return new SharedStateUnitOfWork<Object>() { - @Override - protected Object doExecute() { - return service.getFirstBean(filters, sortOrder); - } - }.execute(sharedState); - } else { - return mapToCachedId(service.getFirstBean(filters, sortOrder)); - } + return mapToCachedId(service.getFirstBean(filters, sortOrder)); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#lastItemId() */ @Override public Object lastItemId() { - if (sharedState != null) { - return new SharedStateUnitOfWork<Object>() { - @Override - protected Object doExecute() { - return service.getLastBean(filters, sortOrder); - } - }.execute(sharedState); - } else { - return mapToCachedId(service.getLastBean(filters, sortOrder)); - } + return mapToCachedId(service.getLastBean(filters, sortOrder)); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#isFirstId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public boolean isFirstId(final Object itemId) { - if (sharedState != null) { - return new SharedStateUnitOfWork<Boolean>() { - @Override - protected Boolean doExecute() { - return service.isFirstBean((BEANTYPE) itemId, filters, - sortOrder); - } - }.execute(sharedState); - } else { - return service.isFirstBean((BEANTYPE) itemId, filters, sortOrder); - } + return service.isFirstBean((BEANTYPE) itemId, filters, sortOrder); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#isLastId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public boolean isLastId(final Object itemId) { - if (sharedState != null) { - return new SharedStateUnitOfWork<Boolean>() { - @Override - protected Boolean doExecute() { - return service.isLastBean((BEANTYPE) itemId, filters, - sortOrder); - } - }.execute(sharedState); - } else { - return service.isLastBean((BEANTYPE) itemId, filters, sortOrder); - } + return service.isLastBean((BEANTYPE) itemId, filters, sortOrder); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object) */ @Override - public Object addItemAfter(Object previousItemId) - throws UnsupportedOperationException { + public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException { throw new UnsupportedOperationException(); } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object, java.lang.Object) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object, + * java.lang.Object) */ @Override - public Item addItemAfter(Object previousItemId, Object newItemId) - throws UnsupportedOperationException { + public Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#getItem(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public Item getItem(Object itemId) { - if (cache.containsKey(itemId)) { - return cache.get(itemId); - } else if (externalCache.containsKey(itemId)) { - return externalCache.get(itemId); + if (itemId == null) { + return null; } - return addBean((BEANTYPE) itemId); + Object key = resolveBeanId(itemId); + if (cache.containsKey(key)) { + return cache.get(key); + } else if (externalCache.containsKey(key)) { + return externalCache.get(key); + } + + BEANTYPE bean = service.refresh((BEANTYPE) itemId); + return bean != null ? addBean(bean) : null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#getContainerPropertyIds() */ @Override @@ -381,7 +404,9 @@ return model.keySet(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#getItemIds() */ @Override @@ -390,17 +415,49 @@ // without a previous calculation of pagesize a fix pagesize of 100 // elements will be set in this method. @SuppressWarnings("unchecked") - // List<Object> itemIds = new ArrayList<Object>(); List<Object> itemIds = (List<Object>) getItemIds(0, 100); - if (itemIds.size() == 0) { - itemIds.addAll(cache.keySet()); - itemIds.addAll(externalCache.keySet()); + if (itemIds.isEmpty()) { + itemIds.addAll(cache.values().stream().map(e -> e.getBean()).collect(Collectors.toList())); + itemIds.addAll(externalCache.values().stream().map(e -> e.getBean()).collect(Collectors.toList())); } return itemIds; } - /* (non-Javadoc) - * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, java.lang.Object) + @Override + public List<BEANTYPE> getAlreadyLoadedItemIds() { + List<BEANTYPE> itemIds = new ArrayList<>(); + itemIds.addAll(cache.values().stream().map(e -> e.getBean()).collect(Collectors.toList())); + itemIds.addAll(externalCache.values().stream().map(e -> e.getBean()).collect(Collectors.toList())); + return itemIds; + } + + protected Map<Object, BEANTYPE> getAlreadyLoadedItemIdsAsMap() { + Map<Object, BEANTYPE> itemIds = new HashMap<>(); + externalCache.entrySet().forEach(e -> itemIds.put(e.getKey(), e.getValue().getBean())); + cache.entrySet().forEach(e -> itemIds.put(e.getKey(), e.getValue().getBean())); + return itemIds; + } + + @Override + public void disposeCacheFor(Object itemId) { + if (itemId == null) { + return; + } + Object key = resolveBeanId(itemId); + if (key != null) { + cache.remove(key); + externalCache.remove(key); + + // notify the listeners + fireItemSetChange(); + } + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, + * java.lang.Object) */ @Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { @@ -411,7 +468,9 @@ return item.getItemProperty(propertyId); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#getType(java.lang.Object) */ @Override @@ -419,45 +478,33 @@ return model.get(propertyId).getPropertyType(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#size() */ @Override public int size() { - if (sharedState != null) { - return new SharedStateUnitOfWork<Integer>() { - @Override - protected Integer doExecute() { - return service.size(filters) + externalCache.size(); - } - }.execute(sharedState); - } else { - return service.size(filters) + externalCache.size(); - } + return service.size(filters) + externalCache.size(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#containsId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public boolean containsId(final Object itemId) { - if (cache.containsKey(itemId) || externalCache.containsKey(itemId)) { + if (cache.containsKey(resolveBeanId(itemId)) || externalCache.containsKey(resolveBeanId(itemId))) { return true; } - if (sharedState != null) { - return new SharedStateUnitOfWork<Boolean>() { - @Override - protected Boolean doExecute() { - return service.contains((BEANTYPE) itemId, filters); - } - }.execute(sharedState); - } else { - return service.contains((BEANTYPE) itemId, filters); - } + return service.contains((BEANTYPE) itemId, filters); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#addItem(java.lang.Object) */ @SuppressWarnings("unchecked") @@ -467,7 +514,9 @@ return addBean((BEANTYPE) itemId, true); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#addItem() */ @Override @@ -475,31 +524,35 @@ throw new UnsupportedOperationException("Bean required for new item!"); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#removeItem(java.lang.Object) */ @Override - public boolean removeItem(Object itemId) - throws UnsupportedOperationException { - throw new UnsupportedOperationException( - "Does not support deleting item!"); + public boolean removeItem(Object itemId) throws UnsupportedOperationException { + throw new UnsupportedOperationException("Does not support deleting item!"); } - /* (non-Javadoc) - * @see com.vaadin.data.Container#addContainerProperty(java.lang.Object, java.lang.Class, java.lang.Object) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container#addContainerProperty(java.lang.Object, + * java.lang.Class, java.lang.Object) */ @Override - public boolean addContainerProperty(Object propertyId, Class<?> type, - Object defaultValue) throws UnsupportedOperationException { + public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) + throws UnsupportedOperationException { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#removeContainerProperty(java.lang.Object) */ @Override - public boolean removeContainerProperty(Object propertyId) - throws UnsupportedOperationException { + public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException { throw new UnsupportedOperationException(); } @@ -512,8 +565,7 @@ @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public boolean addNestedContainerProperty(String propertyId) { - return addContainerProperty(propertyId, new NestedPropertyDescriptor( - propertyId, type)); + return addContainerProperty(propertyId, new NestedPropertyDescriptor(propertyId, type)); } /** @@ -549,25 +601,33 @@ return true; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container#removeAllItems() */ @Override public boolean removeAllItems() throws UnsupportedOperationException { - throw new UnsupportedOperationException( - "Does not support deleting all items!"); + throw new UnsupportedOperationException("Does not support deleting all items!"); } - /* (non-Javadoc) - * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data. + * Property.ValueChangeEvent) */ @Override public void valueChange(ValueChangeEvent event) { } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], boolean[]) + /* + * (non-Javadoc) + * + * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], + * boolean[]) */ @Override public void sort(Object[] propertyIds, boolean[] ascending) { @@ -580,7 +640,9 @@ fireItemSetChange(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds() */ @Override @@ -588,18 +650,25 @@ return sortableProperties; } - /* (non-Javadoc) - * @see com.vaadin.data.Container.SimpleFilterable#addContainerFilter(java.lang.Object, java.lang.String, boolean, boolean) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.SimpleFilterable#addContainerFilter(java.lang. + * Object, java.lang.String, boolean, boolean) */ @Override - public void addContainerFilter(Object propertyId, String filterString, - boolean ignoreCase, boolean onlyMatchPrefix) { - addContainerFilter(new SimpleStringFilter(propertyId, filterString, - ignoreCase, onlyMatchPrefix)); + public void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, + boolean onlyMatchPrefix) { + addContainerFilter(new SimpleStringFilter(propertyId, filterString, ignoreCase, onlyMatchPrefix)); } - /* (non-Javadoc) - * @see com.vaadin.data.Container.SimpleFilterable#removeContainerFilters(java.lang.Object) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.SimpleFilterable#removeContainerFilters(java. + * lang.Object) */ @Override public void removeContainerFilters(Object propertyId) { @@ -607,8 +676,7 @@ return; } boolean result = false; - for (Iterator<Filter> iterator = getFilters().iterator(); iterator - .hasNext();) { + for (Iterator<Filter> iterator = getFilters().iterator(); iterator.hasNext();) { Filter f = iterator.next(); if (f.appliesToProperty(propertyId)) { iterator.remove(); @@ -630,12 +698,15 @@ return filters; } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data.Container.Filter) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data. + * Container.Filter) */ @Override - public void addContainerFilter(Filter filter) - throws UnsupportedFilterException { + public void addContainerFilter(Filter filter) throws UnsupportedFilterException { if (!filters.contains(filter)) { filters.add(filter); clearCache(); @@ -651,26 +722,42 @@ cache.clear(); } - /* (non-Javadoc) - * @see com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin.data.Container.Filter) + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin. + * data.Container.Filter) */ @Override public void removeContainerFilter(Filter filter) { if (filters.remove(filter)) { clearCache(); + + fireItemSetChange(); } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Filterable#removeAllContainerFilters() */ @Override public void removeAllContainerFilters() { + boolean hadFilters = !filters.isEmpty(); + filters.clear(); clearCache(); + + if (hadFilters) { + fireItemSetChange(); + } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Filterable#getContainerFilters() */ @Override @@ -678,60 +765,44 @@ return Collections.unmodifiableList(filters); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable#refreshFilters() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable# + * refreshFilters() */ @Override public void refreshFilters() { fireItemSetChange(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Indexed#indexOfId(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public int indexOfId(final Object itemId) { - if (sharedState != null) { - return new SharedStateUnitOfWork<Integer>() { - @Override - protected Integer doExecute() { - return service.indexOf((BEANTYPE) itemId, filters, - sortOrder); - } - }.execute(sharedState); - } else { - return service.indexOf((BEANTYPE) itemId, filters, sortOrder); - } + return service.indexOf((BEANTYPE) itemId, filters, sortOrder); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Indexed#getIdByIndex(int) */ @Override public Object getIdByIndex(final int index) { - if (sharedState != null) { - return new SharedStateUnitOfWork<BEANTYPE>() { - @Override - protected BEANTYPE doExecute() { - BEANTYPE result = null; - result = (BEANTYPE) service.getBeanByIndex(index, filters, - sortOrder); - addBean(result); - return result; - } - }.execute(sharedState); + BEANTYPE result = null; + result = (BEANTYPE) service.getBeanByIndex(index, filters, sortOrder); + if (isCached(result)) { + result = mapToCachedId(result); } else { - BEANTYPE result = null; - result = (BEANTYPE) service.getBeanByIndex(index, filters, - sortOrder); - if (isCached(result)) { - result = mapToCachedId(result); - } else { - addBean(result); - } - return result; + addBean(result); } + return result; } /** @@ -747,10 +818,11 @@ if (!isCached(itemId)) { return itemId; } - if (cache.containsKey(itemId)) { - return cache.get(itemId).getBean(); - } else if (externalCache.containsKey(itemId)) { - return externalCache.get(itemId).getBean(); + Object key = resolveBeanId(itemId); + if (cache.containsKey(key)) { + return cache.get(key).getBean(); + } else if (externalCache.containsKey(key)) { + return externalCache.get(key).getBean(); } return null; } @@ -763,7 +835,8 @@ * @return true, if is cached */ protected boolean isCached(Object bean) { - return cache.containsKey(bean) || externalCache.containsKey(bean); + Object key = resolveBeanId(bean); + return cache.containsKey(key) || externalCache.containsKey(key); } /** @@ -786,8 +859,7 @@ * the to external cache * @return the deep resolving bean item */ - protected DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE result, - boolean toExternalCache) { + protected DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE result, boolean toExternalCache) { return addBean(result, result, toExternalCache); } @@ -802,75 +874,53 @@ * the to external cache * @return the deep resolving bean item */ - protected DeepResolvingBeanItem<BEANTYPE> addBean(Object itemId, - BEANTYPE result, boolean toExternalCache) { + protected DeepResolvingBeanItem<BEANTYPE> addBean(Object itemId, BEANTYPE result, boolean toExternalCache) { - if (cache.containsKey(itemId)) { - return cache.get(itemId); + Object key = resolveBeanId(itemId); + if (cache.containsKey(key)) { + return cache.get(key); } - if (externalCache.containsKey(itemId)) { - return externalCache.get(itemId); + if (externalCache.containsKey(key)) { + return externalCache.get(key); } DeepResolvingBeanItem<BEANTYPE> item = createBeanItem(result); if (toExternalCache) { - externalCache.put(itemId, item); + externalCache.put(key, item); } return internalAddItemAtEnd(itemId, item); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Indexed#getItemIds(int, int) */ - @SuppressWarnings("unchecked") @Override - public List<BEANTYPE> getItemIds(final int startIndex, - final int numberOfItems) { - LOGGER.debug(String.format( - "Fetching item ids: StartIndex:%d NumberOfItems:%d", - startIndex, numberOfItems)); + public List<BEANTYPE> getItemIds(final int startIndex, final int numberOfItems) { - if (sharedState != null) { - return new SharedStateUnitOfWork<List<BEANTYPE>>() { - @Override - protected List<BEANTYPE> doExecute() { - List<BEANTYPE> beans = new ArrayList<BEANTYPE>(); - // beans.addAll((Collection<? extends BEANTYPE>) - // externalCache - // .keySet()); - beans.addAll((List<BEANTYPE>) service.getBeansByIndex( - startIndex, numberOfItems, filters, sortOrder)); - for (BEANTYPE bean : beans) { - addBean(bean); + LOGGER.debug(String.format("Fetching item ids: StartIndex:%d NumberOfItems:%d", startIndex, numberOfItems)); - LOGGER.debug(String.format("Fetched bean: %s", - bean.toString())); - } - return beans; - } - }.execute(sharedState); - } else { - List<BEANTYPE> beans = new ArrayList<BEANTYPE>(); - beans.addAll((Collection<? extends BEANTYPE>) externalCache - .keySet()); - // map the results to cached instances - for (BEANTYPE bean : service.getBeansByIndex(startIndex, - numberOfItems, filters, sortOrder)) { - if (isCached(bean)) { - beans.add(mapToCachedId(bean)); - } else { - addBean(bean); - beans.add(bean); - } + List<BEANTYPE> beans = new ArrayList<BEANTYPE>(); + beans.addAll(externalCache.values().stream().map(e -> e.getBean()).collect(Collectors.toList())); + // map the results to cached instances + for (BEANTYPE bean : service.getBeansByIndex(startIndex, numberOfItems, filters, sortOrder)) { + if (isCached(bean)) { + beans.add(mapToCachedId(bean)); + } else { + addBean(bean); + beans.add(bean); } - return beans; } + return beans; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Indexed#addItemAt(int) */ @Override @@ -878,19 +928,22 @@ throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.vaadin.data.Container.Indexed#addItemAt(int, java.lang.Object) */ @SuppressWarnings("unchecked") @Override - public Item addItemAt(int index, Object newItemId) - throws UnsupportedOperationException { + public Item addItemAt(int index, Object newItemId) throws UnsupportedOperationException { // external data -> new record return addBean((BEANTYPE) newItemId, true); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.osbp.runtime.web.vaadin.common.data.IClearable#clear() */ @Override @@ -898,4 +951,58 @@ cache.clear(); externalCache.clear(); } + + /** + * Use the bean resolver to get the identifier for a bean. + * + * @param bean + * @return resolved bean identifier, null if could not be resolved + * @throws IllegalStateException + * if no bean resolver is set + */ + @SuppressWarnings("unchecked") + protected Object resolveBeanId(Object bean) { + if (beanIdResolver == null) { + throw new IllegalStateException("Bean item identifier resolver is required."); + } + return beanIdResolver.getIdForBean((BEANTYPE) bean); + } + + /** + * Resolver that maps beans to their (item) identifiers, removing the need + * to explicitly specify item identifiers when there is no need to customize + * this. + * + * Note that beans can also be added with an explicit id even if a resolver + * has been set. + * + * @param <IDTYPE> + * @param <BEANTYPE> + * + * @since 6.5 + */ + public interface BeanIdResolver<BEANTYPE> { + /** + * Return the item identifier for a bean. + * + * @param bean + * @return + */ + public Object getIdForBean(BEANTYPE bean); + } + + public static class DtoIdResolver<BEANTYPE> implements BeanIdResolver<BEANTYPE> { + + @Override + public Object getIdForBean(BEANTYPE bean) { + if (bean == null) { + return ""; + } + if(bean instanceof IDatamartContainer) { + return ((IDatamartContainer)bean).getIdValue(); + } else { + return DtoUtils.getIdValue(bean); + } + } + } }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java index 1805aac..ed7937f 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java
@@ -17,6 +17,8 @@ import java.util.Collection; +import org.eclipse.osbp.runtime.common.annotations.DtoUtils; + // TODO: Auto-generated Javadoc /** * An in-memory container for JavaBeans. @@ -53,8 +55,8 @@ * @since 5.4 */ @SuppressWarnings("serial") -public class DeepResolvingBeanItemContainer<BEANTYPE> extends - AbstractDeepResolvingBeanContainer<BEANTYPE, BEANTYPE> { +public class DeepResolvingBeanItemContainer<BEANTYPE> extends AbstractDeepResolvingBeanContainer<BEANTYPE, BEANTYPE> + implements IBeanToUniqueHashIdProvider<BEANTYPE> { /** * Bean identity resolver that returns the bean itself as its item @@ -68,11 +70,14 @@ * the generic type * @since 6.5 */ - private static class IdentityBeanIdResolver<BT> implements - BeanIdResolver<BT, BT> { + private static class IdentityBeanIdResolver<BT> implements BeanIdResolver<BT, BT> { - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.common.data.AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java.lang.Object) + /* + * (non-Javadoc) + * + * @see org.eclipse.osbp.runtime.web.vaadin.common.data. + * AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java. + * lang.Object) */ @Override public BT getIdForBean(BT bean) { @@ -89,8 +94,7 @@ * @throws IllegalArgumentException * If {@code type} is null */ - public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type) - throws IllegalArgumentException { + public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type) throws IllegalArgumentException { super(type); super.setBeanIdResolver(new IdentityBeanIdResolver<BEANTYPE>()); } @@ -120,13 +124,10 @@ */ @SuppressWarnings("unchecked") @Deprecated - public DeepResolvingBeanItemContainer( - Collection<? extends BEANTYPE> collection) - throws IllegalArgumentException { + public DeepResolvingBeanItemContainer(Collection<? extends BEANTYPE> collection) throws IllegalArgumentException { // must assume the class is BT // the class information is erased by the compiler - this((Class<BEANTYPE>) getBeanClassForCollection(collection), - collection); + this((Class<BEANTYPE>) getBeanClassForCollection(collection), collection); } /** @@ -143,8 +144,7 @@ */ @SuppressWarnings("unchecked") @Deprecated - private static <BT> Class<? extends BT> getBeanClassForCollection( - Collection<? extends BT> collection) + private static <BT> Class<? extends BT> getBeanClassForCollection(Collection<? extends BT> collection) throws IllegalArgumentException { if (collection == null || collection.isEmpty()) { throw new IllegalArgumentException( @@ -163,8 +163,7 @@ * @throws IllegalArgumentException * If {@code type} is null */ - public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type, - Collection<? extends BEANTYPE> collection) + public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type, Collection<? extends BEANTYPE> collection) throws IllegalArgumentException { super(type); super.setBeanIdResolver(new IdentityBeanIdResolver<BEANTYPE>()); @@ -184,6 +183,7 @@ @Override public void addAll(Collection<? extends BEANTYPE> collection) { super.addAll(collection); + } /** @@ -202,10 +202,11 @@ */ @Override @SuppressWarnings("unchecked") - public DeepResolvingBeanItem<BEANTYPE> addItemAfter(Object previousItemId, - Object newItemId) throws IllegalArgumentException { - return super.addBeanAfter((BEANTYPE) previousItemId, - (BEANTYPE) newItemId); + public DeepResolvingBeanItem<BEANTYPE> addItemAfter(Object previousItemId, Object newItemId) + throws IllegalArgumentException { + DeepResolvingBeanItem<BEANTYPE> result = super.addBeanAfter((BEANTYPE) previousItemId, (BEANTYPE) newItemId); + + return result; } /** @@ -224,9 +225,10 @@ */ @Override @SuppressWarnings("unchecked") - public DeepResolvingBeanItem<BEANTYPE> addItemAt(int index, Object newItemId) - throws IllegalArgumentException { - return super.addBeanAt(index, (BEANTYPE) newItemId); + public DeepResolvingBeanItem<BEANTYPE> addItemAt(int index, Object newItemId) throws IllegalArgumentException { + DeepResolvingBeanItem<BEANTYPE> result = super.addBeanAt(index, (BEANTYPE) newItemId); + + return result; } /** @@ -242,6 +244,7 @@ @Override @SuppressWarnings("unchecked") public DeepResolvingBeanItem<BEANTYPE> addItem(Object itemId) { + return super.addBean((BEANTYPE) itemId); } @@ -257,7 +260,9 @@ */ @Override public DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE bean) { - return addItem(bean); + DeepResolvingBeanItem<BEANTYPE> result = addItem(bean); + + return result; } /** @@ -272,16 +277,27 @@ protected void setBeanIdResolver( AbstractDeepResolvingBeanContainer.BeanIdResolver<BEANTYPE, BEANTYPE> beanIdResolver) throws UnsupportedOperationException { - throw new UnsupportedOperationException( - "BeanItemContainer always uses an IdentityBeanIdResolver"); + throw new UnsupportedOperationException("BeanItemContainer always uses an IdentityBeanIdResolver"); } - /* (non-Javadoc) - * @see org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable#refreshFilters() + /* + * (non-Javadoc) + * + * @see + * org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable# + * refreshFilters() */ @Override public void refreshFilters() { // not used in this scenario since container applies filter immediately } + @Override + public String getUniqueHashId(BEANTYPE bean) { + if (bean == null) { + return null; + } + Object idValue = DtoUtils.getIdValue(bean); + return idValue.toString(); + } }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IAlreadyLoadedItemIdProvider.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IAlreadyLoadedItemIdProvider.java new file mode 100644 index 0000000..a85d68f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IAlreadyLoadedItemIdProvider.java
@@ -0,0 +1,37 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.vaadin.common.data; + +import java.util.List; + +/** + * The Interface IAlreadyLoadedItemIdProvider. + * + * @param <BEANTYPE> + * the generic type + */ +public interface IAlreadyLoadedItemIdProvider<BEANTYPE> { + + /** + * Returns allready laoded item ids. But does not load new ONE from + * database. + * + * @return + */ + public abstract List<BEANTYPE> getAlreadyLoadedItemIds(); + + /** + * Removes the itemId from the cache. + * + * @param itemId + */ + void disposeCacheFor(Object itemId); +} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java index c30e38e..11abf63 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java
@@ -9,12 +9,11 @@ * Florian Pirchner - Initial implementation */ - package org.eclipse.osbp.runtime.web.vaadin.common.data; import java.util.List; -import org.eclipse.osbp.dsl.dto.lib.services.SortOrder; +import org.eclipse.osbp.runtime.common.filter.SortOrder; import com.vaadin.data.Container.Filter; @@ -73,8 +72,7 @@ * the sort order * @return the previous bean */ - BEAN getPreviousBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder); + BEAN getPreviousBean(BEAN bean, List<Filter> filters, SortOrder sortOrder); /** * Returns the first bean for the given filter and the sortOrder. @@ -140,6 +138,14 @@ int indexOf(BEAN bean, List<Filter> filters, SortOrder sortOrder); /** + * Loads the bean from the dto service. + * + * @param bean + * @return + */ + BEAN refresh(BEAN bean); + + /** * Returns the bean for the given index, filter and sortOrder. * * @param index @@ -166,7 +172,6 @@ * the sort order * @return the beans by index */ - List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, - List<Filter> filters, SortOrder sortOrder); + List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, List<Filter> filters, SortOrder sortOrder); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanToUniqueHashIdProvider.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanToUniqueHashIdProvider.java new file mode 100644 index 0000000..ca7fbaf --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanToUniqueHashIdProvider.java
@@ -0,0 +1,29 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.vaadin.common.data; + +/** + * The Interface IBeanToUniqueHashIdProvider. + * + * @param <BEANTYPE> + * the generic type + */ +public interface IBeanToUniqueHashIdProvider<BEANTYPE> { + + /** + * Returns a unique hashId. This hashId is not related to + * {@link Object#hashCode()}. + * + * @return + */ + public abstract String getUniqueHashId(BEANTYPE bean); + +} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java index d88dd0a..f94556b 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java
@@ -12,11 +12,12 @@ import java.util.List; -import org.eclipse.osbp.dsl.dto.lib.services.IDTOService; -import org.eclipse.osbp.dsl.dto.lib.services.IQuery; -import org.eclipse.osbp.dsl.dto.lib.services.Query; -import org.eclipse.osbp.dsl.dto.lib.services.SortOrder; -import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter; +import org.eclipse.osbp.jpa.services.Query; +import org.eclipse.osbp.runtime.common.annotations.DtoUtils; +import org.eclipse.osbp.runtime.common.filter.IDTOService; +import org.eclipse.osbp.runtime.common.filter.ILFilter; +import org.eclipse.osbp.runtime.common.filter.IQuery; +import org.eclipse.osbp.runtime.common.filter.SortOrder; import org.eclipse.osbp.runtime.web.vaadin.common.services.filter.LFilterConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,18 +25,15 @@ import com.vaadin.data.Container.Filter; import com.vaadin.data.util.filter.And; -public class StatefulDelegatingDtoSearchService<BEAN> implements - IBeanSearchService<BEAN> { +public class StatefulDelegatingDtoSearchService<BEAN> implements IBeanSearchService<BEAN> { - private static final Logger LOGGER = LoggerFactory - .getLogger(StatefulDelegatingDtoSearchService.class); + private static final Logger LOGGER = LoggerFactory.getLogger(StatefulDelegatingDtoSearchService.class); private final LFilterConverter converter = new LFilterConverter(); private final IDTOService<BEAN> delegate; private final Class<BEAN> type; - public StatefulDelegatingDtoSearchService(IDTOService<BEAN> delegate, - Class<BEAN> type) { + public StatefulDelegatingDtoSearchService(IDTOService<BEAN> delegate, Class<BEAN> type) { this.delegate = delegate; this.type = type; @@ -104,8 +102,7 @@ } @Override - public BEAN getPreviousBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public BEAN getPreviousBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { if (!checkDelegate()) { return null; } @@ -129,8 +126,7 @@ } @Override - public boolean isFirstBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public boolean isFirstBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { if (!checkDelegate()) { return false; } @@ -138,8 +134,7 @@ } @Override - public boolean isLastBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public boolean isLastBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { if (!checkDelegate()) { return false; } @@ -155,8 +150,7 @@ } @Override - public BEAN getBeanByIndex(int index, List<Filter> filters, - SortOrder sortOrder) { + public BEAN getBeanByIndex(int index, List<Filter> filters, SortOrder sortOrder) { if (!checkDelegate()) { return null; } @@ -164,12 +158,18 @@ } @Override - public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, - List<Filter> filters, SortOrder sortOrder) { + public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, List<Filter> filters, SortOrder sortOrder) { if (!checkDelegate()) { return null; } - return delegate.getByIndex(startIndex, numberOfItems, - createQuery(filters, sortOrder)); + return delegate.getByIndex(startIndex, numberOfItems, createQuery(filters, sortOrder)); + } + + @Override + public BEAN refresh(BEAN bean) { + if (bean == null) { + return null; + } + return delegate.get(DtoUtils.getIdValue(bean)); } }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java index 15e8046..f2cf624 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java
@@ -11,7 +11,7 @@ package org.eclipse.osbp.runtime.web.vaadin.common.data; import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess; -import org.eclipse.osbp.dsl.dto.lib.services.IDTOService; +import org.eclipse.osbp.runtime.common.filter.IDTOService; import org.osgi.service.component.annotations.Component; /**
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java index cae29b2..555135d 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java
@@ -13,12 +13,11 @@ import java.util.Collection; import java.util.List; -import org.eclipse.osbp.dsl.dto.lib.services.SortOrder; +import org.eclipse.osbp.runtime.common.filter.SortOrder; import com.vaadin.data.Container.Filter; -public class StatefulInMemoryBeanSearchService<BEAN> implements - IBeanSearchService<BEAN> { +public class StatefulInMemoryBeanSearchService<BEAN> implements IBeanSearchService<BEAN> { private DeepResolvingBeanItemContainer<BEAN> delegate; @@ -54,15 +53,13 @@ } @Override - public BEAN getNextBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public BEAN getNextBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { setupContainer(filters); return delegate.nextItemId(bean); } @Override - public BEAN getPreviousBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public BEAN getPreviousBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { setupContainer(filters); return delegate.prevItemId(bean); } @@ -80,15 +77,13 @@ } @Override - public boolean isFirstBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public boolean isFirstBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { setupContainer(filters); return delegate.isFirstId(bean); } @Override - public boolean isLastBean(BEAN bean, List<Filter> filters, - SortOrder sortOrder) { + public boolean isLastBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) { return delegate.isLastId(bean); } @@ -99,16 +94,19 @@ } @Override - public BEAN getBeanByIndex(int index, List<Filter> filters, - SortOrder sortOrder) { + public BEAN getBeanByIndex(int index, List<Filter> filters, SortOrder sortOrder) { setupContainer(filters); return delegate.getIdByIndex(index); } @Override - public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, - List<Filter> filters, SortOrder sortOrder) { + public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, List<Filter> filters, SortOrder sortOrder) { setupContainer(filters); return delegate.getItemIds(startIndex, numberOfItems); } + + @Override + public BEAN refresh(BEAN bean) { + return bean; + } }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java index 8363e5e..8d182e9 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java
@@ -15,6 +15,8 @@ */ package org.eclipse.osbp.runtime.web.vaadin.common.data.filter; +import org.eclipse.osbp.runtime.common.annotations.DtoUtils; + import com.vaadin.data.Container.Filter; import com.vaadin.data.Item; import com.vaadin.data.util.filter.AbstractJunctionFilter; @@ -61,6 +63,8 @@ */ public boolean passesFilter(Object itemId, Item item) throws UnsupportedOperationException { + +// Object nested = DtoUtils.getValue(itemId, joinProperty); for (Filter f : getFilters()) { if (!f.passesFilter(itemId, item)) { return false;
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java index 0e0b98c..f741bba 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java
@@ -13,12 +13,12 @@ import java.util.HashSet; import java.util.Set; -import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot; +import org.eclipse.osbp.jpa.services.filters.LAnd; +import org.eclipse.osbp.jpa.services.filters.LCompare; +import org.eclipse.osbp.jpa.services.filters.LNot; import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraint; import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraints; +import org.eclipse.osbp.runtime.common.filter.ILFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend index 019ec19..97e2a01 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend +++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend
@@ -19,15 +19,15 @@ import com.vaadin.data.util.filter.Not import com.vaadin.data.util.filter.Or import com.vaadin.data.util.filter.SimpleStringFilter -import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter -import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd -import org.eclipse.osbp.dsl.dto.lib.services.filters.LBetween -import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare -import org.eclipse.osbp.dsl.dto.lib.services.filters.LIsNull -import org.eclipse.osbp.dsl.dto.lib.services.filters.LLike -import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot -import org.eclipse.osbp.dsl.dto.lib.services.filters.LOr -import org.eclipse.osbp.dsl.dto.lib.services.filters.LSimpleStringFilter +import org.eclipse.osbp.jpa.services.filters.LAnd +import org.eclipse.osbp.jpa.services.filters.LBetween +import org.eclipse.osbp.jpa.services.filters.LCompare +import org.eclipse.osbp.jpa.services.filters.LIsNull +import org.eclipse.osbp.jpa.services.filters.LLike +import org.eclipse.osbp.jpa.services.filters.LNot +import org.eclipse.osbp.jpa.services.filters.LOr +import org.eclipse.osbp.jpa.services.filters.LSimpleStringFilter +import org.eclipse.osbp.runtime.common.filter.ILFilter /** * This converter will convert from Vaadin-Filters to OSBP-Filters.
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/.gitignore b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/.gitignore new file mode 100644 index 0000000..8764bd7 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/.gitignore
@@ -0,0 +1 @@ +/.LFilterConverter.xtendbin
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/.gitignore b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/.gitignore new file mode 100644 index 0000000..f9a4a5f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/.gitignore
@@ -0,0 +1 @@ +/LFilterConverter.java
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java deleted file mode 100644 index f7a75d9..0000000 --- a/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java +++ /dev/null
@@ -1,171 +0,0 @@ -/** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Florian Pirchner - Initial implementation - */ -package org.eclipse.osbp.runtime.web.vaadin.common.services.filter; - -import com.vaadin.data.Container; -import com.vaadin.data.util.filter.And; -import com.vaadin.data.util.filter.Between; -import com.vaadin.data.util.filter.Compare; -import com.vaadin.data.util.filter.IsNull; -import com.vaadin.data.util.filter.Like; -import com.vaadin.data.util.filter.Not; -import com.vaadin.data.util.filter.Or; -import com.vaadin.data.util.filter.SimpleStringFilter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.function.Consumer; -import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LBetween; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LIsNull; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LLike; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LOr; -import org.eclipse.osbp.dsl.dto.lib.services.filters.LSimpleStringFilter; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Conversions; - -/** - * This converter will convert from Vaadin-Filters to OSBP-Filters. - * OSBP-Filters are more common and used by the data services. For instance - * JPAServices to access data. - */ -@SuppressWarnings("all") -public class LFilterConverter { - protected ILFilter _convert(final Container.Filter vFilter) { - throw new UnsupportedOperationException(("Not a valid type: " + vFilter)); - } - - protected ILFilter _convert(final And vFilter) { - final ArrayList<ILFilter> children = CollectionLiterals.<ILFilter>newArrayList(); - Collection<Container.Filter> _filters = vFilter.getFilters(); - final Consumer<Container.Filter> _function = new Consumer<Container.Filter>() { - public void accept(final Container.Filter it) { - ILFilter _convert = LFilterConverter.this.convert(it); - children.add(_convert); - } - }; - _filters.forEach(_function); - final LAnd result = new LAnd(((ILFilter[])Conversions.unwrapArray(children, ILFilter.class))); - return result; - } - - protected ILFilter _convert(final Or vFilter) { - final ArrayList<ILFilter> children = CollectionLiterals.<ILFilter>newArrayList(); - Collection<Container.Filter> _filters = vFilter.getFilters(); - final Consumer<Container.Filter> _function = new Consumer<Container.Filter>() { - public void accept(final Container.Filter it) { - ILFilter _convert = LFilterConverter.this.convert(it); - children.add(_convert); - } - }; - _filters.forEach(_function); - final LOr result = new LOr(((ILFilter[])Conversions.unwrapArray(children, ILFilter.class))); - return result; - } - - protected ILFilter _convert(final Between vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Comparable<?> _startValue = vFilter.getStartValue(); - Comparable<?> _endValue = vFilter.getEndValue(); - return new LBetween(_propertyId, _startValue, _endValue); - } - - protected ILFilter _convert(final Compare.Equal vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Object _value = vFilter.getValue(); - return new LCompare.Equal(_propertyId, _value); - } - - protected ILFilter _convert(final Compare.Greater vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Object _value = vFilter.getValue(); - return new LCompare.Greater(_propertyId, _value); - } - - protected ILFilter _convert(final Compare.GreaterOrEqual vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Object _value = vFilter.getValue(); - return new LCompare.GreaterOrEqual(_propertyId, _value); - } - - protected ILFilter _convert(final Compare.Less vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Object _value = vFilter.getValue(); - return new LCompare.Less(_propertyId, _value); - } - - protected ILFilter _convert(final Compare.LessOrEqual vFilter) { - Object _propertyId = vFilter.getPropertyId(); - Object _value = vFilter.getValue(); - return new LCompare.LessOrEqual(_propertyId, _value); - } - - protected ILFilter _convert(final IsNull vFilter) { - Object _propertyId = vFilter.getPropertyId(); - return new LIsNull(_propertyId); - } - - protected ILFilter _convert(final Like vFilter) { - Object _propertyId = vFilter.getPropertyId(); - String _value = vFilter.getValue(); - return new LLike(_propertyId, _value); - } - - protected ILFilter _convert(final Not vFilter) { - Container.Filter _filter = vFilter.getFilter(); - ILFilter _convert = this.convert(_filter); - return new LNot(_convert); - } - - protected ILFilter _convert(final SimpleStringFilter vFilter) { - Object _propertyId = vFilter.getPropertyId(); - String _filterString = vFilter.getFilterString(); - boolean _isIgnoreCase = vFilter.isIgnoreCase(); - boolean _isOnlyMatchPrefix = vFilter.isOnlyMatchPrefix(); - return new LSimpleStringFilter(_propertyId, _filterString, _isIgnoreCase, _isOnlyMatchPrefix); - } - - public ILFilter convert(final Container.Filter vFilter) { - if (vFilter instanceof And) { - return _convert((And)vFilter); - } else if (vFilter instanceof Compare.Equal) { - return _convert((Compare.Equal)vFilter); - } else if (vFilter instanceof Compare.Greater) { - return _convert((Compare.Greater)vFilter); - } else if (vFilter instanceof Compare.GreaterOrEqual) { - return _convert((Compare.GreaterOrEqual)vFilter); - } else if (vFilter instanceof Compare.Less) { - return _convert((Compare.Less)vFilter); - } else if (vFilter instanceof Compare.LessOrEqual) { - return _convert((Compare.LessOrEqual)vFilter); - } else if (vFilter instanceof Or) { - return _convert((Or)vFilter); - } else if (vFilter instanceof Between) { - return _convert((Between)vFilter); - } else if (vFilter instanceof IsNull) { - return _convert((IsNull)vFilter); - } else if (vFilter instanceof Like) { - return _convert((Like)vFilter); - } else if (vFilter instanceof Not) { - return _convert((Not)vFilter); - } else if (vFilter instanceof SimpleStringFilter) { - return _convert((SimpleStringFilter)vFilter); - } else if (vFilter != null) { - return _convert(vFilter); - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.<Object>asList(vFilter).toString()); - } - } -}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.classpath b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.classpath new file mode 100644 index 0000000..43b9862 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.gitignore b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.gitignore new file mode 100644 index 0000000..a882759 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.gitignore
@@ -0,0 +1,3 @@ +/resources/ +/gwt-unitCache +/VAADIN/* \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project index b5acbae..80e3c4e 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project
@@ -36,11 +36,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF index 7f6bf3a..47d9571 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF
@@ -9,8 +9,9 @@ Bundle-ActivationPolicy: lazy Bundle-Vendor: Eclipse OSBP Import-Package: org.slf4j;version="1.7.2" -Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - org.jsoup;bundle-version="1.7.2" +Require-Bundle: com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + org.jsoup;bundle-version="1.8.3", + org.eclipse.osbp.dependencies.bundle.vaadin.external.gwt;bundle-version="[2.7.0,2.7.1)" OSBP-ECView-I18nProvider:
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml index 2f7f167..17ec0c8 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml
@@ -8,7 +8,6 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <vaadin.version>7.5.7</vaadin.version> </properties> <dependencies>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml index 50b27ab..c26e149 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml
@@ -7,10 +7,11 @@ <!--# http://www.eclipse.org/legal/epl-v10.html --> <!--# --> <!--# Contributors: --> -<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation --> +<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation --> <!--#======================================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.eclipse.osbp.runtime.web</groupId> @@ -26,7 +27,6 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <vaadin.version>7.5.7</vaadin.version> </properties> <dependencies> @@ -56,12 +56,6 @@ </dependency> <dependency> <groupId>com.vaadin</groupId> - <artifactId>vaadin-shared-deps</artifactId> - <scope>provided</scope> - <version>1.0.2</version> - </dependency> - <dependency> - <groupId>com.vaadin</groupId> <artifactId>vaadin-client-compiler</artifactId> <scope>provided</scope> <version>${vaadin.version}</version> @@ -82,6 +76,11 @@ <version>2.5</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.eclipse.osbp.dependencies</groupId> + <artifactId>org.eclipse.osbp.dependencies.bundle.vaadin.external.gwt</artifactId> + <version>2.7.0-SNAPSHOT</version> + </dependency> </dependencies> <build> @@ -196,7 +195,7 @@ </goals> </pluginExecutionFilter> <action> - <ignore/> + <ignore /> </action> </pluginExecution> <pluginExecution> @@ -209,7 +208,7 @@ </goals> </pluginExecutionFilter> <action> - <ignore/> + <ignore /> </action> </pluginExecution> </pluginExecutions>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/license/THIRD-PARTY.properties b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/license/THIRD-PARTY.properties new file mode 100644 index 0000000..9af7a58 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/license/THIRD-PARTY.properties
@@ -0,0 +1,31 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License, Version 2.0 +# - BSD 3-Clause License +# - BSD License +# - BSD style +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE +# (CDDL) +# Version +# 1.0 +# - Common Public License Version 1.0 +# - Eclipse Public License - v 1.0 +# - Indiana University Extreme! Lab Software +# License, +# vesion 1.1.1 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - The Apache Software License, Version 2.0 +# - The MIT License +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Wed May 21 17:53:35 BRT 2014 +ant--ant-launcher--1.6.5=Apache License, Version 2.0 +commons-collections--commons-collections--3.1=Apache License, Version 2.0 +javax.servlet--servlet-api--2.5=Common Development and Distribution license - v1.0.1 +org.jdesktop--swing-worker--1.1=Lesser General Public License (LGPL) +
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.classpath b/org.eclipse.osbp.runtime.web.vaadin.components/.classpath new file mode 100644 index 0000000..43b9862 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.gitignore b/org.eclipse.osbp.runtime.web.vaadin.components/.gitignore new file mode 100644 index 0000000..a882759 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.gitignore
@@ -0,0 +1,3 @@ +/resources/ +/gwt-unitCache +/VAADIN/* \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.project b/org.eclipse.osbp.runtime.web.vaadin.components/.project index aa9bc6a..1ff68ab 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/.project +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.project
@@ -36,11 +36,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..a698e59 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF index e537a71..174df04 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF
@@ -5,39 +5,41 @@ Bundle-Version: 0.9.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.osbp.runtime.web.vaadin.components.container;version="0.9.0", - org.eclipse.osbp.runtime.web.vaadin.components.converter; - uses:="com.vaadin.data.util.converter";version="0.9.0", + org.eclipse.osbp.runtime.web.vaadin.components.converter;version="0.9.0";uses:="com.vaadin.data.util.converter", org.eclipse.osbp.runtime.web.vaadin.components.dialogs;version="0.9.0", - org.eclipse.osbp.runtime.web.vaadin.components.fields; + org.eclipse.osbp.runtime.web.vaadin.components.fields;version="0.9.0"; uses:="org.eclipse.osbp.runtime.web.vaadin.components.converter, com.vaadin.data, org.eclipse.osbp.runtime.web.vaadin.common.data, com.vaadin.data.util, - com.vaadin.ui";version="0.9.0", - org.eclipse.osbp.runtime.web.vaadin.components.fields.search; + com.vaadin.ui", + org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2, + org.eclipse.osbp.runtime.web.vaadin.components.fields.search;version="0.9.0"; uses:="com.vaadin.data, org.eclipse.core.databinding, com.vaadin.data.util.converter, org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter, - com.vaadin.ui";version="0.9.0", - org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter; - uses:="com.vaadin.data";version="0.9.0", - org.eclipse.osbp.runtime.web.vaadin.components.validator; - uses:="com.vaadin.data.validator";version="0.9.0" + com.vaadin.ui", + org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;version="0.9.0";uses:="com.vaadin.data", + org.eclipse.osbp.runtime.web.vaadin.components.validator;version="0.9.0";uses:="com.vaadin.data.validator" Bundle-ActivationPolicy: lazy Bundle-Vendor: Eclipse OSBP -Import-Package: org.apache.commons.lang, +Import-Package: javax.annotation, + javax.inject, + org.apache.commons.lang, + org.eclipse.osbp.ui.api.metadata;version="0.9.0", + org.eclipse.osbp.ui.api.themes;version="0.9.0", org.osgi.framework;version="1.8.0", org.osgi.service.component;version="1.2.2", org.osgi.service.component.annotations;version="1.2.0" -Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", com.google.guava;bundle-version="[10.0.0,19.0.0)", - org.eclipse.core.databinding;bundle-version="[1.4.1,1.5.0)", - org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)", - org.eclipse.core.databinding.observable;bundle-version="[1.4.1,1.5.0)", - org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)", + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)", + org.eclipse.core.databinding.observable;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)", org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", @@ -46,6 +48,10 @@ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)", org.jsoup;bundle-version="1.7.2", - org.slf4j.api;bundle-version="1.7.2" + org.slf4j.api;bundle-version="1.7.2", + org.eclipse.e4.core.contexts;bundle-version="1.5.1", + org.eclipse.e4.core.di;bundle-version="1.6.1", + org.eclipse.e4.core.di.annotations;bundle-version="1.5.0", + org.vaadin.addons.vaadin-grid-util Service-Component: OSGI-INF/*.xml OSBP-ECView-I18nProvider:
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml index b2818ea..275bf7a 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml +++ b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate"> - <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate"/> <service> <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate"/> </service> + <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate"/> </scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml index 3ce2aaf..8383686 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml +++ b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml
@@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory"> - <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory"/> <service> <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory"/> </service> <reference bind="addDelegate" cardinality="0..n" interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate" name="Delegate" policy="dynamic" unbind="removeDelegate"/> + <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory"/> </scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/license/THIRD-PARTY.properties b/org.eclipse.osbp.runtime.web.vaadin.components/src/license/THIRD-PARTY.properties new file mode 100644 index 0000000..9af7a58 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/license/THIRD-PARTY.properties
@@ -0,0 +1,31 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License, Version 2.0 +# - BSD 3-Clause License +# - BSD License +# - BSD style +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE +# (CDDL) +# Version +# 1.0 +# - Common Public License Version 1.0 +# - Eclipse Public License - v 1.0 +# - Indiana University Extreme! Lab Software +# License, +# vesion 1.1.1 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - The Apache Software License, Version 2.0 +# - The MIT License +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Wed May 21 17:53:35 BRT 2014 +ant--ant-launcher--1.6.5=Apache License, Version 2.0 +commons-collections--commons-collections--3.1=Apache License, Version 2.0 +javax.servlet--servlet-api--2.5=Common Development and Distribution license - v1.0.1 +org.jdesktop--swing-worker--1.1=Lesser General Public License (LGPL) +
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java index d0f98d5..acf6697 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java
@@ -12,8 +12,9 @@ import java.util.Locale; -import org.eclipse.osbp.runtime.common.i18n.II18nService; -import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; +import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; import com.vaadin.ui.UI; import com.vaadin.ui.Window; @@ -23,40 +24,31 @@ */ public class AcceptDeleteDialog extends OptionsDialog { - public static void showDialog(II18nService service, - IResourceProvider resourceProvider, Runnable onDelete, Runnable onCancel) { + public static void showDialog(IDSLMetadataService service, IThemeResourceService themeResource, Runnable onDelete, + Runnable onCancel) { if (service == null) { throw new NullPointerException("Please pass an i18nService"); } Locale locale = UI.getCurrent().getLocale(); - String dialogTitle = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE_DIALOG_TITLE, locale); - String dialogMessage = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE_DIALOG_MESSAGE, locale); - String dialogDescription = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE_DIALOG_DESCRIPTION, locale); - String dialogIcon = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE_DIALOG_ICON, locale); - String optionDeleteCaption = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION, - locale); - String optionDeleteDescription = service - .getValue( - IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION, - locale); - String optionDeleteIcon = service.getValue( - IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON, - locale); - String optionCancelCaption = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale); - String optionCancelDescription = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale); - String optionCancelIcon = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale); + String dialogTitle = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_DELETE_DIALOG_TITLE); + String dialogMessage = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_DELETE_DIALOG_MESSAGE); + String dialogDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_DELETE_DIALOG_DESCRIPTION); + String dialogIcon = IDialogI18nKeys.ACCEPT_DELETE_DIALOG_ICON; + String optionDeleteCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION); + String optionDeleteDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION); + String optionDeleteIcon = IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON; + String optionCancelCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION); + String optionCancelDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION); + String optionCancelIcon = IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON; - DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, - dialogDescription, createResource(dialogIcon, resourceProvider)) { + DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, dialogDescription, + themeResource.getThemeResource(dialogIcon, ThemeResourceType.ICON)) { @Override public void config(Window window) { super.config(window); @@ -66,11 +58,11 @@ } }; - AcceptDeleteDialog dialog = new AcceptDeleteDialog(config, new Option( - optionCancelCaption, optionCancelDescription, createResource( - optionCancelIcon, resourceProvider), onCancel), new Option( - optionDeleteCaption, optionDeleteDescription, createResource( - optionDeleteIcon, resourceProvider), onDelete)); + AcceptDeleteDialog dialog = new AcceptDeleteDialog(config, + new Option(optionCancelCaption, optionCancelDescription, + themeResource.getThemeResource(optionCancelIcon, ThemeResourceType.ICON), onCancel), + new Option(optionDeleteCaption, optionDeleteDescription, + themeResource.getThemeResource(optionDeleteIcon, ThemeResourceType.ICON), onDelete)); dialog.open(); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java index 9d77238..21f38c2 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java
@@ -12,8 +12,9 @@ import java.util.Locale; -import org.eclipse.osbp.runtime.common.i18n.II18nService; -import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; +import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; import com.vaadin.ui.UI; import com.vaadin.ui.Window; @@ -23,41 +24,33 @@ */ public class AcceptLoosingDataDialog extends OptionsDialog { - public static void showDialog(II18nService service, - IResourceProvider resourceProvider, Runnable onDelete, + public static void showDialog(IDSLMetadataService service, IThemeResourceService themeResource, Runnable onDelete, Runnable onCancel) { if (service == null) { throw new NullPointerException("Please pass an i18nService"); } Locale locale = UI.getCurrent().getLocale(); - String dialogTitle = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_TITLE, locale); - String dialogMessage = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_MESSAGE, locale); - String dialogDescription = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION, locale); - String dialogIcon = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_ICON, locale); - String optionDeleteCaption = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION, - locale); - String optionDeleteDescription = service - .getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION, - locale); - String optionDeleteIcon = service.getValue( - IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON, - locale); - String optionCancelCaption = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale); - String optionCancelDescription = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale); - String optionCancelIcon = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale); + String dialogTitle = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_TITLE); + String dialogMessage = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_MESSAGE); + String dialogDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION); + String dialogIcon = IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_ICON; + String optionDeleteCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION); + String optionDeleteDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION); + String optionDeleteIcon = IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON; + String optionCancelCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION); + String optionCancelDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION); + String optionCancelIcon = IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON; - DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, - dialogDescription, createResource(dialogIcon, resourceProvider)) { + DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, dialogDescription, + themeResource.getThemeResource(dialogIcon, ThemeResourceType.ICON)) { @Override public void config(Window window) { super.config(window); @@ -69,10 +62,9 @@ AcceptLoosingDataDialog dialog = new AcceptLoosingDataDialog(config, new Option(optionCancelCaption, optionCancelDescription, - createResource(optionCancelIcon, resourceProvider), - onCancel), new Option(optionDeleteCaption, - optionDeleteDescription, createResource( - optionDeleteIcon, resourceProvider), onDelete)); + themeResource.getThemeResource(optionCancelIcon, ThemeResourceType.ICON), onCancel), + new Option(optionDeleteCaption, optionDeleteDescription, + themeResource.getThemeResource(optionDeleteIcon, ThemeResourceType.ICON), onDelete)); dialog.open(); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java index 41dcde2..78ec840 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java
@@ -12,8 +12,9 @@ import java.util.Locale; -import org.eclipse.osbp.runtime.common.i18n.II18nService; -import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; +import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; import com.vaadin.ui.UI; import com.vaadin.ui.Window; @@ -23,41 +24,31 @@ */ public class AcceptReloadDialog extends OptionsDialog { - public static void showDialog(II18nService service, - IResourceProvider resourceProvider, Runnable onDelete, + public static void showDialog(IDSLMetadataService service, IThemeResourceService themeResource, Runnable onDelete, Runnable onCancel) { if (service == null) { throw new NullPointerException("Please pass an i18nService"); } Locale locale = UI.getCurrent().getLocale(); - String dialogTitle = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_TITLE, locale); - String dialogMessage = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_MESSAGE, locale); - String dialogDescription = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_DESCRIPTION, locale); - String dialogIcon = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_ICON, locale); - String optionDeleteCaption = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION, - locale); - String optionDeleteDescription = service - .getValue( - IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION, - locale); - String optionDeleteIcon = service.getValue( - IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON, - locale); - String optionCancelCaption = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale); - String optionCancelDescription = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale); - String optionCancelIcon = service.getValue( - IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale); + String dialogTitle = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_TITLE); + String dialogMessage = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_MESSAGE); + String dialogDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_DESCRIPTION); + String dialogIcon = IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_ICON; + String optionDeleteCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION); + String optionDeleteDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION); + String optionDeleteIcon = IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON; + String optionCancelCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION); + String optionCancelDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION); + String optionCancelIcon = IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON; - DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, - dialogDescription, createResource(dialogIcon, resourceProvider)) { + DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, dialogDescription, + themeResource.getThemeResource(dialogIcon, ThemeResourceType.ICON)) { @Override public void config(Window window) { super.config(window); @@ -67,12 +58,11 @@ } }; - AcceptReloadDialog dialog = new AcceptReloadDialog(config, new Option( - optionCancelCaption, optionCancelDescription, createResource( - optionCancelIcon, resourceProvider), onCancel), + AcceptReloadDialog dialog = new AcceptReloadDialog(config, + new Option(optionCancelCaption, optionCancelDescription, + themeResource.getThemeResource(optionCancelIcon, ThemeResourceType.ICON), onCancel), new Option(optionDeleteCaption, optionDeleteDescription, - createResource(optionDeleteIcon, resourceProvider), - onDelete)); + themeResource.getThemeResource(optionDeleteIcon, ThemeResourceType.ICON), onDelete)); dialog.open(); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptSaveDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptSaveDialog.java new file mode 100644 index 0000000..6271f7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptSaveDialog.java
@@ -0,0 +1,73 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.vaadin.components.dialogs; + +import java.util.Locale; + +import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; + +/** + * Dialog to accept a delete operation. + */ +public class AcceptSaveDialog extends OptionsDialog { + + public static void showDialog(IDSLMetadataService service, IThemeResourceService themeResource, Runnable onSave, + Runnable onCancel) { + if (service == null) { + throw new NullPointerException("Please pass an i18nService"); + } + + Locale locale = UI.getCurrent().getLocale(); + String dialogTitle = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_SAVE_DIALOG_TITLE); + String dialogMessage = service.translate(locale.toLanguageTag(), IDialogI18nKeys.ACCEPT_SAVE_DIALOG_MESSAGE); + String dialogDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_SAVE_DIALOG_DESCRIPTION); + String dialogIcon = IDialogI18nKeys.ACCEPT_SAVE_DIALOG_ICON; + String optionSaveCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_SAVE__DIALOG_OPTION__SAVE_CAPTION); + String optionSaveDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.ACCEPT_SAVE__DIALOG_OPTION__SAVE_DESCRIPTION); + String optionSaveIcon = IDialogI18nKeys.ACCEPT_SAVE__DIALOG_OPTION__SAVE_ICON; + String optionCancelCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION); + String optionCancelDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION); + String optionCancelIcon = IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON; + + DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, dialogDescription, + themeResource.getThemeResource(dialogIcon, ThemeResourceType.ICON)) { + @Override + public void config(Window window) { + super.config(window); + window.setHeight("170px"); + window.setWidth("350px"); + window.center(); + } + }; + + AcceptSaveDialog dialog = new AcceptSaveDialog(config, + new Option(optionCancelCaption, optionCancelDescription, + themeResource.getThemeResource(optionCancelIcon, ThemeResourceType.ICON), onCancel), + new Option(optionSaveCaption, optionSaveDescription, + themeResource.getThemeResource(optionSaveIcon, ThemeResourceType.ICON), onSave)); + dialog.open(); + } + + private AcceptSaveDialog(DialogConfig config, Option... options) { + super(config, options); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java index e006303..7167993 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java
@@ -1,9 +1,9 @@ /** - * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co_KG (69115 Heidelberg, Germany) + * All rights reserved_ This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1_0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www_eclipse_org/legal/epl-v10_html * * Contributors: * Florian Pirchner - Initial implementation @@ -16,43 +16,67 @@ // // general // - public static final String DIALOG_OPTION__CANCEL_CAPTION = "org.eclipse.osbp.dialogs.options.cancel"; - public static final String DIALOG_OPTION__CANCEL_DESCRIPTION = "org.eclipse.osbp.dialogs.options.cancel.description"; - public static final String DIALOG_OPTION__CANCEL_ICON = "org.eclipse.osbp.dialogs.options.cancel.image"; + public static final String DIALOG_OPTION__CANCEL_CAPTION = "options_cancel"; + public static final String DIALOG_OPTION__CANCEL_DESCRIPTION = "options_cancel_description"; + public static final String DIALOG_OPTION__CANCEL_ICON = "cancel"; // - // delete + // acceptsave // - public static final String ACCEPT_DELETE_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptdelete.title"; - public static final String ACCEPT_DELETE_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptdelete.message"; - public static final String ACCEPT_DELETE_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptdelete.image"; - public static final String ACCEPT_DELETE_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptdelete.description"; + public static final String ACCEPT_SAVE_DIALOG_TITLE = "acceptsave_title"; + public static final String ACCEPT_SAVE_DIALOG_MESSAGE = "acceptsave_message"; + public static final String ACCEPT_SAVE_DIALOG_ICON = "save"; + public static final String ACCEPT_SAVE_DIALOG_DESCRIPTION = "acceptsave_description"; - public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION = "org.eclipse.osbp.dialogs.options.acceptdelete"; - public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptdelete.description"; - public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON = "org.eclipse.osbp.dialogs.options.acceptdelete.image"; + public static final String ACCEPT_SAVE__DIALOG_OPTION__SAVE_CAPTION = "options_acceptsave"; + public static final String ACCEPT_SAVE__DIALOG_OPTION__SAVE_DESCRIPTION = "options_acceptsave_description"; + public static final String ACCEPT_SAVE__DIALOG_OPTION__SAVE_ICON = "ok"; // + // acceptdelete + // + public static final String ACCEPT_DELETE_DIALOG_TITLE = "acceptdelete_title"; + public static final String ACCEPT_DELETE_DIALOG_MESSAGE = "acceptdelete_message"; + public static final String ACCEPT_DELETE_DIALOG_ICON = "delete"; + public static final String ACCEPT_DELETE_DIALOG_DESCRIPTION = "acceptdelete_description"; + + public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION = "options_acceptdelete"; + public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION = "options_acceptdelete_description"; + public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON = "ok"; + + // // reload if dirty // - public static final String ACCEPT_RELOAD_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptreload.title"; - public static final String ACCEPT_RELOAD_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptreload.message"; - public static final String ACCEPT_RELOAD_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptreload.image"; - public static final String ACCEPT_RELOAD_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptreload.description"; + public static final String ACCEPT_RELOAD_DIALOG_TITLE = "acceptreload_title"; + public static final String ACCEPT_RELOAD_DIALOG_MESSAGE = "acceptreload_message"; + public static final String ACCEPT_RELOAD_DIALOG_ICON = "reload"; + public static final String ACCEPT_RELOAD_DIALOG_DESCRIPTION = "acceptreload_description"; - public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION = "org.eclipse.osbp.dialogs.options.acceptreload"; - public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptreload.description"; - public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON = "org.eclipse.osbp.dialogs.options.acceptreload.image"; + public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION = "options_acceptreload"; + public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION = "options_acceptreload_description"; + public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON = "ok"; // // loosing data for current action // - public static final String ACCEPT_LOOSING_DATA_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptloosingdata.title"; - public static final String ACCEPT_LOOSING_DATA_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptloosingdata.message"; - public static final String ACCEPT_LOOSING_DATA_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptloosingdata.image"; - public static final String ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptloosingdata.description"; + public static final String ACCEPT_LOOSING_DATA_DIALOG_TITLE = "acceptloosingdata_title"; + public static final String ACCEPT_LOOSING_DATA_DIALOG_MESSAGE = "acceptloosingdata_message"; + public static final String ACCEPT_LOOSING_DATA_DIALOG_ICON = "loosingdata"; + public static final String ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION = "acceptloosingdata_description"; - public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION = "org.eclipse.osbp.dialogs.options.acceptloosingdata"; - public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptloosingdata.description"; - public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON = "org.eclipse.osbp.dialogs.options.acceptloosingdata.image"; + public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION = "options_acceptloosingdata"; + public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION = "options_acceptloosingdata_description"; + public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON = "ok"; + + // + // pre delete question + // + public static final String QUERY_DELETE_DIALOG_TITLE = "query_delete_title"; + public static final String QUERY_DELETE_DIALOG_MESSAGE = "query_delete"; + public static final String QUERY_DELETE_DIALOG_ICON = "delete"; + public static final String QUERY_DELETE_DIALOG_DESCRIPTION = "query_delete_description"; + + public static final String QUERY_DELETE__DIALOG_OPTION__DO_CAPTION = "options_query_delete"; + public static final String QUERY_DELETE__DIALOG_OPTION__DO_DESCRIPTION = "options_query_delete"; + public static final String QUERY_DELETE__DIALOG_OPTION__DO_ICON = "ok"; }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/QueryDeleteDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/QueryDeleteDialog.java new file mode 100644 index 0000000..a278104 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/QueryDeleteDialog.java
@@ -0,0 +1,62 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.dialogs; + +import java.util.Locale; + +import org.eclipse.osbp.runtime.web.vaadin.components.dialogs.AbstractDialog.DialogConfig; +import org.eclipse.osbp.runtime.web.vaadin.components.dialogs.AbstractDialog.Option; +import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; + +public class QueryDeleteDialog extends OptionsDialog { + public static void showDialog(IDSLMetadataService service, IThemeResourceService themeResource, Runnable onSave, + Runnable onCancel) { + if (service == null) { + throw new NullPointerException("Please pass an i18nService"); + } + + Locale locale = UI.getCurrent().getLocale(); + String dialogTitle = service.translate(locale.toLanguageTag(), IDialogI18nKeys.QUERY_DELETE_DIALOG_TITLE); + String dialogMessage = service.translate(locale.toLanguageTag(), IDialogI18nKeys.QUERY_DELETE_DIALOG_MESSAGE); + String dialogDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.QUERY_DELETE_DIALOG_DESCRIPTION); + String dialogIcon = IDialogI18nKeys.QUERY_DELETE_DIALOG_ICON; + String optionSaveCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.QUERY_DELETE__DIALOG_OPTION__DO_CAPTION); + String optionSaveDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.QUERY_DELETE__DIALOG_OPTION__DO_DESCRIPTION); + String optionSaveIcon = IDialogI18nKeys.QUERY_DELETE__DIALOG_OPTION__DO_ICON; + String optionCancelCaption = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION); + String optionCancelDescription = service.translate(locale.toLanguageTag(), + IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION); + String optionCancelIcon = IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON; + + DialogConfig config = new DialogConfig(dialogTitle, dialogMessage, dialogDescription, + themeResource.getThemeResource(dialogIcon, ThemeResourceType.ICON)) { + @Override + public void config(Window window) { + super.config(window); + window.setHeight("170px"); + window.setWidth("350px"); + window.center(); + } + }; + + QueryDeleteDialog dialog = new QueryDeleteDialog(config, + new Option(optionCancelCaption, optionCancelDescription, + themeResource.getThemeResource(optionCancelIcon, ThemeResourceType.ICON), onCancel), + new Option(optionSaveCaption, optionSaveDescription, + themeResource.getThemeResource(optionSaveIcon, ThemeResourceType.ICON), onSave)); + dialog.open(); + } + + private QueryDeleteDialog(DialogConfig config, Option... options) { + super(config, options); + } + + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java index 28c783b..ec19101 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java
@@ -73,6 +73,8 @@ /** The search button icon. */ private Resource searchButtonIcon; + private DialogHandle dialogHandle; + /** The use search dialog. */ private boolean useSearchDialog = false; @@ -94,9 +96,8 @@ * @param sharedState * the shared state */ - public BeanReferenceField(String id, Object propertyId, Class<BEAN> type, - IBeanSearchService<BEAN> searchService, Filter filter, - ISharedStateContext sharedState) { + public BeanReferenceField(String id, Object propertyId, Class<BEAN> type, IBeanSearchService<BEAN> searchService, + Filter filter, ISharedStateContext sharedState) { this.type = type; this.searchService = searchService; this.filter = filter; @@ -122,8 +123,8 @@ comboBox.setNullSelectionAllowed(isNullSelectionAllowed()); comboBox.setInvalidAllowed(false); - BeanServiceLazyLoadingContainer container = new BeanServiceLazyLoadingContainer( - searchService, type, sharedState); + BeanServiceLazyLoadingContainer container = new BeanServiceLazyLoadingContainer(searchService, type, + sharedState); // add the passed container filter if (filter != null) { container.addContainerFilter(filter); @@ -134,8 +135,7 @@ if (itemCaptionPropertyId != null) { comboBox.setItemCaptionPropertyId(itemCaptionPropertyId); - container.sort(new Object[] { itemCaptionPropertyId }, - new boolean[] { true }); + container.sort(new Object[] { itemCaptionPropertyId }, new boolean[] { true }); } if (itemIconPropertyId != null) { @@ -171,6 +171,14 @@ return root; } + public DialogHandle getDialogHandle() { + return dialogHandle; + } + + public void setDialogHandle(DialogHandle dialogHandle) { + this.dialogHandle = dialogHandle; + } + /** * If true, then null selections are allowed. False otherwise. * @@ -197,7 +205,6 @@ */ public void setUseDialog(boolean useSearchDialog) { this.useSearchDialog = useSearchDialog; - searchButton.setVisible(useSearchDialog); } /** @@ -213,7 +220,9 @@ * Open search dialog. */ protected void openSearchDialog() { - + if (dialogHandle != null) { + dialogHandle.open(); + } } /* @@ -248,9 +257,8 @@ /* * (non-Javadoc) * - * @see - * com.vaadin.ui.AbstractField#setPropertyDataSource(com.vaadin.data.Property - * ) + * @see com.vaadin.ui.AbstractField#setPropertyDataSource(com.vaadin.data. + * Property ) */ @SuppressWarnings("rawtypes") @Override @@ -281,8 +289,7 @@ * the illegal argument exception * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) */ - public void setItemIconPropertyId(Object propertyId) - throws IllegalArgumentException { + public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { this.itemIconPropertyId = propertyId; if (comboBox != null) { @@ -341,8 +348,7 @@ * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) */ @Override - public void setItemIconPropertyId(Object propertyId) - throws IllegalArgumentException { + public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { if (propertyId == null) { super.setItemIconPropertyId(propertyId); @@ -361,8 +367,7 @@ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId() */ public Object getItemIconPropertyId() { - return itemIconPropertyId != null ? itemIconPropertyId : super - .getItemIconPropertyId(); + return itemIconPropertyId != null ? itemIconPropertyId : super.getItemIconPropertyId(); } /* @@ -374,8 +379,7 @@ if (itemIconPropertyId == null) { return super.getItemIcon(itemId); } else { - final Property<?> ip = getContainerProperty(itemId, - getItemIconPropertyId()); + final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId()); if (ip == null) { return null; } @@ -393,8 +397,7 @@ * @see com.vaadin.ui.AbstractSelect#setValue(java.lang.Object) */ @Override - public void setValue(Object newValue) - throws com.vaadin.data.Property.ReadOnlyException { + public void setValue(Object newValue) throws com.vaadin.data.Property.ReadOnlyException { super.setValue(newValue); } @@ -409,4 +412,12 @@ super.setValue(newValue, repaintIsNotNeeded); } } + + public interface DialogHandle { + + void open(); + + void close(); + } + }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenComponent.java new file mode 100644 index 0000000..e181568 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenComponent.java
@@ -0,0 +1,84 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.Locale; + +import javax.annotation.PostConstruct; + +import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService; +import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService.LocaleListener; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.runtime.common.i18n.II18nService; +import org.eclipse.osbp.ui.api.themes.EnumCssClass; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.Component; +import com.vaadin.ui.CustomComponent; + +@SuppressWarnings("serial") +public abstract class BetweenComponent extends CustomComponent implements ISingleFilterComponent, LocaleListener { + + protected final String propertyId; + protected final IViewContext viewContext; + + Component mainLayout; + + // used for decimal fields + protected Class<?> type; + protected II18nService i18nService; + protected IThemeResourceService themeResourceService; + + public BetweenComponent(String propertyId, IViewContext viewContext) { + this.propertyId = propertyId; + this.viewContext = viewContext; + } + + public BetweenComponent(String propertyId, Class<?> type, IViewContext viewContext) { + this.propertyId = propertyId; + this.type = type; + this.viewContext = viewContext; + } + + @PostConstruct + public void init() { + + setStyleName(EnumCssClass.BOX.styleName()); + + i18nService = viewContext.getService(II18nService.ID); + themeResourceService = viewContext.getService(IThemeResourceService.ID); + + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.addLocaleListener(this); + + mainLayout = createMainLayout(); + mainLayout.setSizeFull(); + setCompositionRoot(mainLayout); + } + + protected String getCaptionInternal() { + return Util.getCaption(i18nService, propertyId, propertyId, getLocale()); + } + + @Override + public void localeChanged(Locale locale) { + setLocale(locale); + updateCaptions(); + } + + protected abstract void updateCaptions(); + + protected abstract Component createMainLayout(); + + /** + * Returns a proper filter for this component. + * + * @return + */ + public abstract Filter getFilter(); + + public void dispose() { + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.removeLocaleListener(this); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDateComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDateComponent.java new file mode 100644 index 0000000..f331c62 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDateComponent.java
@@ -0,0 +1,72 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.filter.Between; +import com.vaadin.ui.Component; +import com.vaadin.ui.DateField; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; + +@SuppressWarnings("serial") +public class BetweenDateComponent extends BetweenComponent { + + private Label captionField; + + private DateField fromValueField; + + private DateField untilValueField; + + @Inject + public BetweenDateComponent(@Named("propertyId") String propertyId, IViewContext viewContext) { + super(propertyId, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + fromValueField = new DateField(); + untilValueField = new DateField(); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(fromValueField); + mainLayout.addComponent(untilValueField); + + captionField.setWidth("100%"); + fromValueField.setWidth("100%"); + untilValueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(fromValueField, 1.0f); + mainLayout.setExpandRatio(untilValueField, 1.0f); + return mainLayout; + } + + @Override + public void resetAllFilters() { + fromValueField.setValue(null); + untilValueField.setValue(null); + } + + public Filter getFilter() { + if (!fromValueField.isValid() || !untilValueField.isValid()) { + return null; + } + + if (fromValueField.getValue() == null || untilValueField.getValue() == null) { + return null; + } + Between between = new Between(propertyId, fromValueField.getValue(), untilValueField.getValue()); + return between; + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDecimalComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDecimalComponent.java new file mode 100644 index 0000000..a02fa89 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenDecimalComponent.java
@@ -0,0 +1,143 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.Validator; +import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.StringToBigDecimalConverter; +import com.vaadin.data.util.converter.StringToBigIntegerConverter; +import com.vaadin.data.util.converter.StringToByteConverter; +import com.vaadin.data.util.converter.StringToDoubleConverter; +import com.vaadin.data.util.converter.StringToFloatConverter; +import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.data.util.converter.StringToLongConverter; +import com.vaadin.data.util.converter.StringToShortConverter; +import com.vaadin.data.util.filter.Between; +import com.vaadin.data.validator.ByteRangeValidator; +import com.vaadin.data.validator.DoubleRangeValidator; +import com.vaadin.data.validator.FloatRangeValidator; +import com.vaadin.data.validator.IntegerRangeValidator; +import com.vaadin.data.validator.LongRangeValidator; +import com.vaadin.data.validator.ShortRangeValidator; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class BetweenDecimalComponent<T extends Number & Comparable<?>> extends BetweenComponent { + + private Label captionField; + + private TextField fromValueField; + + private TextField untilValueField; + + @Inject + public BetweenDecimalComponent(@Named("propertyId") String propertyId, @Named("type") Class<T> type, + IViewContext viewContext) { + super(propertyId, type, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.addStyleName("caption"); + captionField.setValue(propertyId); + fromValueField = new TextField(); + fromValueField.setImmediate(true); + fromValueField.setNullRepresentation(""); + fromValueField.addStyleName("from"); + fromValueField.setConverter(toConverter()); + fromValueField.addValidator(toValidator()); + untilValueField = new TextField(); + untilValueField.setImmediate(true); + untilValueField.setNullRepresentation(""); + untilValueField.addStyleName("until"); + untilValueField.setConverter(toConverter()); + untilValueField.addValidator(toValidator()); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(fromValueField); + mainLayout.addComponent(untilValueField); + + captionField.setWidth("100%"); + fromValueField.setWidth("100%"); + untilValueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(fromValueField, 1.0f); + mainLayout.setExpandRatio(untilValueField, 1.0f); + return mainLayout; + } + + @SuppressWarnings("unchecked") + protected Converter<String, T> toConverter() { + if (type == Integer.class || type == Integer.TYPE) { + return (Converter<String, T>) new StringToIntegerConverter(); + } else if (type == BigDecimal.class) { + return (Converter<String, T>) new StringToBigDecimalConverter(); + } else if (type == BigInteger.class) { + return (Converter<String, T>) new StringToBigIntegerConverter(); + } else if (type == Byte.class || type == Byte.TYPE) { + return (Converter<String, T>) new StringToByteConverter(); + } else if (type == Double.class || type == Double.TYPE) { + return (Converter<String, T>) new StringToDoubleConverter(); + } else if (type == Float.class || type == Float.TYPE) { + return (Converter<String, T>) new StringToFloatConverter(); + } else if (type == Long.class || type == Long.TYPE) { + return (Converter<String, T>) new StringToLongConverter(); + } else if (type == Short.class || type == Short.TYPE) { + return (Converter<String, T>) new StringToShortConverter(); + } + throw new IllegalStateException("Number type is not valid!"); + } + + protected Validator toValidator() { + if (type == Integer.class || type == Integer.TYPE) { + return new IntegerRangeValidator("not valid", Integer.MIN_VALUE, Integer.MAX_VALUE); + } else if (type == Byte.class || type == Byte.TYPE) { + return new ByteRangeValidator("not valid", Byte.MIN_VALUE, Byte.MAX_VALUE); + } else if (type == Double.class || type == Double.TYPE) { + return new DoubleRangeValidator("not valid", Double.NEGATIVE_INFINITY, Double.MAX_VALUE); + } else if (type == Float.class || type == Float.TYPE) { + return new FloatRangeValidator("not valid", Float.MIN_VALUE, Float.MAX_VALUE); + } else if (type == Long.class || type == Long.TYPE) { + return new LongRangeValidator("not valid", Long.MIN_VALUE, Long.MAX_VALUE); + } else if (type == Short.class || type == Short.TYPE) { + return new ShortRangeValidator("not valid", Short.MIN_VALUE, Short.MAX_VALUE); + } + throw new IllegalStateException("Number type is not valid!"); + } + + @Override + public void resetAllFilters() { + fromValueField.setValue(null); + untilValueField.setValue(null); + } + + public Filter getFilter() { + if (!fromValueField.isValid() || !untilValueField.isValid()) { + return null; + } + if (fromValueField.getValue() == null || fromValueField.getValue().trim().equals("") + || untilValueField.getValue() == null || untilValueField.getValue().trim().equals("")) { + return null; + } + + Between between = new Between(propertyId, (Comparable<?>) fromValueField.getConvertedValue(), + (Comparable<?>) untilValueField.getConvertedValue()); + return between; + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenTextComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenTextComponent.java new file mode 100644 index 0000000..2f54e4b --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/BetweenTextComponent.java
@@ -0,0 +1,78 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.filter.Between; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class BetweenTextComponent extends BetweenComponent { + + private Label captionField; + + private TextField fromValueField; + + private TextField untilValueField; + + @Inject + public BetweenTextComponent(@Named("propertyId") String propertyId, IViewContext viewContext) { + super(propertyId, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + fromValueField = new TextField(); + untilValueField = new TextField(); + fromValueField.setNullRepresentation(""); + untilValueField.setNullRepresentation(""); + fromValueField.setImmediate(true); + untilValueField.setImmediate(true); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(fromValueField); + mainLayout.addComponent(untilValueField); + + captionField.setWidth("100%"); + fromValueField.setWidth("100%"); + untilValueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(fromValueField, 1.0f); + mainLayout.setExpandRatio(untilValueField, 1.0f); + return mainLayout; + } + + @Override + public void resetAllFilters() { + fromValueField.setValue(null); + untilValueField.setValue(null); + } + + public Filter getFilter() { + if (!fromValueField.isValid() || !untilValueField.isValid()) { + return null; + } + + if (fromValueField.getValue() == null || fromValueField.getValue().trim().equals("") + || untilValueField.getValue() == null || untilValueField.getValue().trim().equals("")) { + return null; + } + + Between between = new Between(propertyId, fromValueField.getValue(), untilValueField.getValue()); + return between; + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareBooleanComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareBooleanComponent.java new file mode 100644 index 0000000..ba3c3fb --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareBooleanComponent.java
@@ -0,0 +1,148 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.filter.Compare; +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; + +@SuppressWarnings("serial") +public class CompareBooleanComponent extends CompareComponent { + + private Label captionField; + + private ComboBox compareTypeField; + + @Inject + public CompareBooleanComponent(@Named("propertyId")String propertyId, IViewContext viewContext) { + super(propertyId, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + compareTypeField = new ComboBox(); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(compareTypeField); + + captionField.setWidth("100%"); + compareTypeField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(compareTypeField, 1.0f); + + updateContainer(); + + compareTypeField.setItemCaptionPropertyId("caption"); + compareTypeField.setItemIconPropertyId("image"); + + return mainLayout; + } + + protected void updateContainer() { + BeanItemContainer<CompareType> container = new BeanItemContainer<>(CompareType.class); + container.addBean( + new CompareType(CompareTypeEnum.TRUE, toLabel(CompareTypeEnum.TRUE), toImage(CompareTypeEnum.TRUE))); + container.addBean( + new CompareType(CompareTypeEnum.FALSE, toLabel(CompareTypeEnum.FALSE), toImage(CompareTypeEnum.FALSE))); + container.addBean(new CompareType(CompareTypeEnum.IGNORE, toLabel(CompareTypeEnum.IGNORE), + toImage(CompareTypeEnum.IGNORE))); + + compareTypeField.setContainerDataSource(container); + } + + protected String toLabel(CompareTypeEnum enumx) { + return i18nService != null ? i18nService.getValue(enumx.name(), getLocale()) : enumx.name(); + } + + protected Resource toImage(CompareTypeEnum enumx) { + return themeResourceService.getThemeResource(enumx.name(), ThemeResourceType.ICON); + } + + public Filter getFilter() { + CompareType compareType = (CompareType) compareTypeField.getValue(); + + if (compareType == null) { + return null; + } + + Filter filter = null; + switch (compareType.typeEnum) { + case TRUE: + filter = new Compare.Equal(propertyId, true); + break; + case FALSE: + filter = new Compare.Equal(propertyId, false); + break; + case IGNORE: + break; + } + + return filter; + } + + @Override + public void resetAllFilters() { + compareTypeField.setValue(null); + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + + updateContainer(); + } + + public static class CompareType { + private CompareTypeEnum typeEnum; + private String caption; + private Resource image; + + public CompareType(CompareTypeEnum typeEnum, String caption, Resource image) { + super(); + this.typeEnum = typeEnum; + this.caption = caption; + this.image = image; + } + + public CompareTypeEnum getTypeEnum() { + return typeEnum; + } + + public void setTypeEnum(CompareTypeEnum typeEnum) { + this.typeEnum = typeEnum; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public Resource getImage() { + return image; + } + + public void setImage(Resource image) { + this.image = image; + } + + } + + public enum CompareTypeEnum { + TRUE, FALSE, IGNORE; + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareComponent.java new file mode 100644 index 0000000..5897722 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareComponent.java
@@ -0,0 +1,117 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.Locale; + +import javax.annotation.PostConstruct; + +import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.runtime.common.i18n.II18nService; +import org.eclipse.osbp.ui.api.themes.EnumCssClass; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.Component; +import com.vaadin.ui.CustomComponent; + +@SuppressWarnings("serial") +public abstract class CompareComponent extends CustomComponent + implements ISingleFilterComponent, ILocaleChangedService.LocaleListener { + + protected II18nService i18nService; + protected IThemeResourceService themeResourceService; + + Component mainLayout; + + protected final String propertyId; + protected final IViewContext viewContext; + + // used for decimal fields + Class<? extends Number> type; + + public CompareComponent(String propertyId, IViewContext viewContext) { + this.propertyId = propertyId; + this.viewContext = viewContext; + } + + public CompareComponent(String propertyId, Class<? extends Number> type, IViewContext viewContext) { + this.propertyId = propertyId; + this.type = type; + this.viewContext = viewContext; + } + + @PostConstruct + public void init() { + + setStyleName(EnumCssClass.BOX.styleName()); + + i18nService = viewContext.getService(II18nService.ID); + themeResourceService = viewContext.getService(IThemeResourceService.ID); + + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.addLocaleListener(this); + + mainLayout = createMainLayout(); + mainLayout.setSizeFull(); + + setCompositionRoot(mainLayout); + } + + protected String getCaptionInternal() { + return Util.getCaption(i18nService, propertyId, propertyId, getLocale()); + } + + @Override + public void localeChanged(Locale locale) { + setLocale(locale); + updateCaptions(); + } + + protected abstract void updateCaptions(); + + protected abstract Component createMainLayout(); + + /** + * Returns a proper filter for this component. + * + * @return + */ + public abstract Filter getFilter(); + + public void dispose() { + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.removeLocaleListener(this); + } + + public abstract static class AbstractCompareBean { + protected final PropertyChangeSupport changeSupport = new PropertyChangeSupport(this); + + public void addPropertyChangeListener(String property, PropertyChangeListener listener) { + changeSupport.addPropertyChangeListener(property, listener); + } + + private final String property; + + private String caption; + + public AbstractCompareBean(String property) { + this.property = property; + } + + public String getProperty() { + return property; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + changeSupport.firePropertyChange("caption", this.caption, this.caption = caption); + } + + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDateComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDateComponent.java new file mode 100644 index 0000000..48c8390 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDateComponent.java
@@ -0,0 +1,184 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.Date; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.filter.Compare; +import com.vaadin.data.util.filter.Not; +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.DateField; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; + +@SuppressWarnings("serial") +public class CompareDateComponent extends CompareComponent { + + private Label captionField; + + private ComboBox compareTypeField; + + private DateField valueField; + + @Inject + public CompareDateComponent(@Named("propertyId") String propertyId, IViewContext viewContext) { + super(propertyId, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + compareTypeField = new ComboBox(); + valueField = new DateField(); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(compareTypeField); + mainLayout.addComponent(valueField); + + captionField.setWidth("100%"); + compareTypeField.setWidth("100%"); + valueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(compareTypeField, 0.5f); + mainLayout.setExpandRatio(valueField, 1.5f); + + updateContainer(); + + compareTypeField.setItemCaptionPropertyId("caption"); + compareTypeField.setItemIconPropertyId("image"); + + return mainLayout; + } + + protected void updateContainer() { + BeanItemContainer<CompareType> container = new BeanItemContainer<>(CompareType.class); + container + .addBean(new CompareType(CompareTypeEnum.EQ, toLabel(CompareTypeEnum.EQ), toImage(CompareTypeEnum.EQ))); + container + .addBean(new CompareType(CompareTypeEnum.NE, toLabel(CompareTypeEnum.NE), toImage(CompareTypeEnum.NE))); + container + .addBean(new CompareType(CompareTypeEnum.GT, toLabel(CompareTypeEnum.GT), toImage(CompareTypeEnum.GT))); + container + .addBean(new CompareType(CompareTypeEnum.GE, toLabel(CompareTypeEnum.GE), toImage(CompareTypeEnum.GE))); + container + .addBean(new CompareType(CompareTypeEnum.LT, toLabel(CompareTypeEnum.LT), toImage(CompareTypeEnum.LT))); + container + .addBean(new CompareType(CompareTypeEnum.LE, toLabel(CompareTypeEnum.LE), toImage(CompareTypeEnum.LE))); + + compareTypeField.setContainerDataSource(container); + } + + protected String toLabel(CompareTypeEnum enumx) { + return Util.getCaption(i18nService, enumx.name(), enumx.name(), getLocale()); + } + + protected Resource toImage(CompareTypeEnum enumx) { + return themeResourceService.getThemeResource(enumx.name(), ThemeResourceType.ICON); + } + + public Filter getFilter() { + if (!valueField.isValid() || !compareTypeField.isValid()) { + return null; + } + + CompareType compareType = (CompareType) compareTypeField.getValue(); + + if (compareType == null) { + return null; + } + + Date value = valueField.getValue(); + if (value == null) { + return null; + } + + Filter filter = null; + switch (compareType.typeEnum) { + case EQ: + filter = new Compare.Equal(propertyId, value); + break; + case GE: + filter = new Compare.GreaterOrEqual(propertyId, value); + break; + case GT: + filter = new Compare.Greater(propertyId, value); + break; + case LE: + filter = new Compare.LessOrEqual(propertyId, value); + break; + case LT: + filter = new Compare.Less(propertyId, value); + break; + case NE: + filter = new Not(new Compare.Equal(propertyId, value)); + break; + } + + return filter; + } + + @Override + public void resetAllFilters() { + compareTypeField.setValue(null); + valueField.setValue(null); + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + + updateContainer(); + } + + public static class CompareType { + private CompareTypeEnum typeEnum; + private String caption; + private Resource image; + + public CompareType(CompareTypeEnum typeEnum, String caption, Resource image) { + super(); + this.typeEnum = typeEnum; + this.caption = caption; + this.image = image; + } + + public CompareTypeEnum getTypeEnum() { + return typeEnum; + } + + public void setTypeEnum(CompareTypeEnum typeEnum) { + this.typeEnum = typeEnum; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public Resource getImage() { + return image; + } + + public void setImage(Resource image) { + this.image = image; + } + + } + + public enum CompareTypeEnum { + EQ, NE, GT, GE, LE, LT; + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDecimalComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDecimalComponent.java new file mode 100644 index 0000000..04ab25a --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareDecimalComponent.java
@@ -0,0 +1,243 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.Validator; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.StringToBigDecimalConverter; +import com.vaadin.data.util.converter.StringToBigIntegerConverter; +import com.vaadin.data.util.converter.StringToByteConverter; +import com.vaadin.data.util.converter.StringToDoubleConverter; +import com.vaadin.data.util.converter.StringToFloatConverter; +import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.data.util.converter.StringToLongConverter; +import com.vaadin.data.util.converter.StringToShortConverter; +import com.vaadin.data.util.filter.Compare; +import com.vaadin.data.util.filter.Not; +import com.vaadin.data.validator.ByteRangeValidator; +import com.vaadin.data.validator.DoubleRangeValidator; +import com.vaadin.data.validator.FloatRangeValidator; +import com.vaadin.data.validator.IntegerRangeValidator; +import com.vaadin.data.validator.LongRangeValidator; +import com.vaadin.data.validator.ShortRangeValidator; +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class CompareDecimalComponent extends CompareComponent { + + private Label captionField; + + private ComboBox compareTypeField; + + private TextField valueField; + + @Inject + public CompareDecimalComponent(@Named("propertyId") String propertyId, @Named("type") Class<? extends Number> type, + IViewContext viewContext) { + super(propertyId, type, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + compareTypeField = new ComboBox(); + valueField = new TextField(); + valueField.setNullRepresentation(""); + valueField.setConverter(toConverter()); + valueField.addValidator(toValidator()); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(compareTypeField); + mainLayout.addComponent(valueField); + + captionField.setWidth("100%"); + compareTypeField.setWidth("100%"); + valueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(compareTypeField, 0.5f); + mainLayout.setExpandRatio(valueField, 1.5f); + + updateContainer(); + compareTypeField.setItemCaptionPropertyId("caption"); + compareTypeField.setItemIconPropertyId("image"); + + return mainLayout; + } + + protected void updateContainer() { + BeanItemContainer<CompareType> container = new BeanItemContainer<>(CompareType.class); + container + .addBean(new CompareType(CompareTypeEnum.EQ, toLabel(CompareTypeEnum.EQ), toImage(CompareTypeEnum.EQ))); + container + .addBean(new CompareType(CompareTypeEnum.NE, toLabel(CompareTypeEnum.NE), toImage(CompareTypeEnum.NE))); + container + .addBean(new CompareType(CompareTypeEnum.GT, toLabel(CompareTypeEnum.GT), toImage(CompareTypeEnum.GT))); + container + .addBean(new CompareType(CompareTypeEnum.GE, toLabel(CompareTypeEnum.GE), toImage(CompareTypeEnum.GE))); + container + .addBean(new CompareType(CompareTypeEnum.LT, toLabel(CompareTypeEnum.LT), toImage(CompareTypeEnum.LT))); + container + .addBean(new CompareType(CompareTypeEnum.LE, toLabel(CompareTypeEnum.LE), toImage(CompareTypeEnum.LE))); + + compareTypeField.setContainerDataSource(container); + } + + protected String toLabel(CompareTypeEnum enumx) { + return Util.getCaption(i18nService, enumx.name(), enumx.name(), getLocale()); + } + + protected Resource toImage(CompareTypeEnum enumx) { + return themeResourceService.getThemeResource(enumx.name(), ThemeResourceType.ICON); + } + + public Filter getFilter() { + if (!valueField.isValid() || !compareTypeField.isValid()) { + return null; + } + + CompareType compareType = (CompareType) compareTypeField.getValue(); + + if (compareType == null) { + return null; + } + + Number numericValue = (Number) valueField.getConvertedValue(); + // if (value == null || value.trim().equals("")) { + // return null; + // } + + // Comparable<?> numericValue = parser.apply(value); + Filter filter = null; + switch (compareType.typeEnum) { + case EQ: + filter = new Compare.Equal(propertyId, numericValue); + break; + case GE: + filter = new Compare.GreaterOrEqual(propertyId, numericValue); + break; + case GT: + filter = new Compare.Greater(propertyId, numericValue); + break; + case LE: + filter = new Compare.LessOrEqual(propertyId, numericValue); + break; + case LT: + filter = new Compare.Less(propertyId, numericValue); + break; + case NE: + filter = new Not(new Compare.Equal(propertyId, numericValue)); + break; + } + + return filter; + } + + @Override + public void resetAllFilters() { + compareTypeField.setValue(null); + valueField.setValue(null); + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + + updateContainer(); + } + + protected Converter<String, ? extends Number> toConverter() { + if (type == Integer.class || type == Integer.TYPE) { + return new StringToIntegerConverter(); + } else if (type == BigDecimal.class) { + return new StringToBigDecimalConverter(); + } else if (type == BigInteger.class) { + return new StringToBigIntegerConverter(); + } else if (type == Byte.class || type == Byte.TYPE) { + return new StringToByteConverter(); + } else if (type == Double.class || type == Double.TYPE) { + return new StringToDoubleConverter(); + } else if (type == Float.class || type == Float.TYPE) { + return new StringToFloatConverter(); + } else if (type == Long.class || type == Long.TYPE) { + return new StringToLongConverter(); + } else if (type == Short.class || type == Short.TYPE) { + return new StringToShortConverter(); + } + throw new IllegalStateException("Number type is not valid!"); + } + + protected Validator toValidator() { + if (type == Integer.class || type == Integer.TYPE) { + return new IntegerRangeValidator("not valid", Integer.MIN_VALUE, Integer.MAX_VALUE); + } else if (type == Byte.class || type == Byte.TYPE) { + return new ByteRangeValidator("not valid", Byte.MIN_VALUE, Byte.MAX_VALUE); + } else if (type == Double.class || type == Double.TYPE) { + return new DoubleRangeValidator("not valid", Double.NEGATIVE_INFINITY, Double.MAX_VALUE); + } else if (type == Float.class || type == Float.TYPE) { + return new FloatRangeValidator("not valid", Float.MIN_VALUE, Float.MAX_VALUE); + } else if (type == Long.class || type == Long.TYPE) { + return new LongRangeValidator("not valid", Long.MIN_VALUE, Long.MAX_VALUE); + } else if (type == Short.class || type == Short.TYPE) { + return new ShortRangeValidator("not valid", Short.MIN_VALUE, Short.MAX_VALUE); + } + throw new IllegalStateException("Number type is not valid!"); + } + + public static class CompareType { + private CompareTypeEnum typeEnum; + private String caption; + private Resource image; + + public CompareType(CompareTypeEnum typeEnum, String caption, Resource image) { + super(); + this.typeEnum = typeEnum; + this.caption = caption; + this.image = image; + } + + public CompareTypeEnum getTypeEnum() { + return typeEnum; + } + + public void setTypeEnum(CompareTypeEnum typeEnum) { + this.typeEnum = typeEnum; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public Resource getImage() { + return image; + } + + public void setImage(Resource image) { + this.image = image; + } + + } + + public enum CompareTypeEnum { + EQ, NE, GT, GE, LE, LT; + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareTextComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareTextComponent.java new file mode 100644 index 0000000..b6d7ea5 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/CompareTextComponent.java
@@ -0,0 +1,190 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.filter.Compare; +import com.vaadin.data.util.filter.Like; +import com.vaadin.data.util.filter.Not; +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class CompareTextComponent extends CompareComponent { + + private Label captionField; + + private ComboBox compareTypeField; + + private TextField valueField; + + @Inject + public CompareTextComponent(@Named("propertyId") String propertyId, IViewContext viewContext) { + super(propertyId, viewContext); + } + + @Override + protected Component createMainLayout() { + HorizontalLayout mainLayout = new HorizontalLayout(); + captionField = new Label(); + captionField.setValue(propertyId); + compareTypeField = new ComboBox(); + valueField = new TextField(); + valueField.setNullRepresentation(""); + valueField.setImmediate(true); + + mainLayout.addComponent(captionField); + mainLayout.addComponent(compareTypeField); + mainLayout.addComponent(valueField); + + captionField.setWidth("100%"); + compareTypeField.setWidth("100%"); + valueField.setWidth("100%"); + mainLayout.setExpandRatio(captionField, 1.0f); + mainLayout.setExpandRatio(compareTypeField, 0.5f); + mainLayout.setExpandRatio(valueField, 1.5f); + + updateContainer(); + + compareTypeField.setItemCaptionPropertyId("caption"); + compareTypeField.setItemIconPropertyId("image"); + + return mainLayout; + } + + protected void updateContainer() { + BeanItemContainer<CompareType> container = new BeanItemContainer<>(CompareType.class); + container + .addBean(new CompareType(CompareTypeEnum.EQ, toLabel(CompareTypeEnum.EQ), toImage(CompareTypeEnum.EQ))); + container + .addBean(new CompareType(CompareTypeEnum.NE, toLabel(CompareTypeEnum.NE), toImage(CompareTypeEnum.NE))); + container + .addBean(new CompareType(CompareTypeEnum.GT, toLabel(CompareTypeEnum.GT), toImage(CompareTypeEnum.GT))); + container + .addBean(new CompareType(CompareTypeEnum.GE, toLabel(CompareTypeEnum.GE), toImage(CompareTypeEnum.GE))); + container + .addBean(new CompareType(CompareTypeEnum.LT, toLabel(CompareTypeEnum.LT), toImage(CompareTypeEnum.LT))); + container + .addBean(new CompareType(CompareTypeEnum.LE, toLabel(CompareTypeEnum.LE), toImage(CompareTypeEnum.LE))); + container.addBean( + new CompareType(CompareTypeEnum.LIKE, toLabel(CompareTypeEnum.LIKE), toImage(CompareTypeEnum.LIKE))); + + compareTypeField.setContainerDataSource(container); + } + + protected String toLabel(CompareTypeEnum enumx) { + return Util.getCaption(i18nService, enumx.name().toLowerCase(), enumx.name().toLowerCase(), getLocale()); + } + + protected Resource toImage(CompareTypeEnum enumx) { + return themeResourceService.getThemeResource(enumx.name(), ThemeResourceType.ICON); + } + + public Filter getFilter() { + if (!valueField.isValid() || !compareTypeField.isValid()) { + return null; + } + + CompareType compareType = (CompareType) compareTypeField.getValue(); + + if (compareType == null) { + return null; + } + + String value = valueField.getValue(); + if (value == null || value.trim().equals("")) { + return null; + } + + Filter filter = null; + switch (compareType.typeEnum) { + case EQ: + filter = new Compare.Equal(propertyId, value); + break; + case GE: + filter = new Compare.GreaterOrEqual(propertyId, value); + break; + case GT: + filter = new Compare.Greater(propertyId, value); + break; + case LE: + filter = new Compare.LessOrEqual(propertyId, value); + break; + case LIKE: + filter = new Like(propertyId, value, false); + break; + case LT: + filter = new Compare.Less(propertyId, value); + break; + case NE: + filter = new Not(new Compare.Equal(propertyId, value)); + break; + } + + return filter; + } + + @Override + public void resetAllFilters() { + compareTypeField.setValue(null); + valueField.setValue(null); + } + + protected void updateCaptions() { + captionField.setValue(getCaptionInternal()); + + updateContainer(); + } + + public static class CompareType { + private CompareTypeEnum typeEnum; + private String caption; + private Resource image; + + public CompareType(CompareTypeEnum typeEnum, String caption, Resource image) { + super(); + this.typeEnum = typeEnum; + this.caption = caption; + this.image = image; + } + + public CompareTypeEnum getTypeEnum() { + return typeEnum; + } + + public void setTypeEnum(CompareTypeEnum typeEnum) { + this.typeEnum = typeEnum; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public Resource getImage() { + return image; + } + + public void setImage(Resource image) { + this.image = image; + } + + } + + public enum CompareTypeEnum { + EQ, NE, GT, GE, LE, LT, LIKE; + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringComponent.java new file mode 100644 index 0000000..927529d --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringComponent.java
@@ -0,0 +1,267 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.filter.And; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class FilteringComponent<T> extends CustomComponent implements IFilteringComponent { + + IViewContext viewContext; + + ComponentContainer mainLayout; + FormLayout leftForm; + FormLayout rightForm; + List<ISingleFilterComponent> components = new ArrayList<>(); + + private boolean hideGrid; + FilteringGridComponent<T> grid; + + private Class<T> rootType; + + private Callback resetFilterCallback; + + private Callback applyFilterCallback; + + private int filterCols; + + public FilteringComponent(IViewContext viewContext, Class<T> rootType, boolean hideGrid) { + this(viewContext, rootType, 2, hideGrid); + } + + public FilteringComponent(IViewContext viewContext, Class<T> rootType, int filterCols, boolean hideGrid) { + this.viewContext = viewContext; + this.rootType = rootType; + this.hideGrid = hideGrid; + + if (filterCols < 1 || filterCols > 2) { + throw new IllegalArgumentException("Columns must be between 1 and 2"); + } + this.filterCols = filterCols; + + init(); + } + + protected void init() { + mainLayout = createMainLayout(); + setCompositionRoot(mainLayout); + setSizeFull(); + } + + protected ComponentContainer createMainLayout() { + + VerticalLayout mainLayout = new VerticalLayout(); + mainLayout.setSizeFull(); + + // buttons + // + Button search = new Button("search", e -> { + applyFilters(); + if (applyFilterCallback != null) { + applyFilterCallback.callback(); + } + }); + search.setSizeUndefined(); + + Button reset = new Button("reset", e -> { + resetAllFilters(); + if (resetFilterCallback != null) { + resetFilterCallback.callback(); + } + }); + reset.setSizeUndefined(); + + HorizontalLayout buttonBar = new HorizontalLayout(search, reset); + buttonBar.setSizeUndefined(); + mainLayout.addComponent(buttonBar); + + // filter part + // + leftForm = new FormLayout(); + leftForm.setSizeFull(); + leftForm.setSpacing(false); + leftForm.setMargin(false); + + HorizontalLayout filterColsLayout = new HorizontalLayout(leftForm); + mainLayout.addComponent(filterColsLayout); + filterColsLayout.setSizeUndefined(); + filterColsLayout.setWidth("100%"); + mainLayout.setComponentAlignment(filterColsLayout, Alignment.TOP_LEFT); + + filterColsLayout.setMargin(new MarginInfo(true, true)); + filterColsLayout.setExpandRatio(leftForm, 1.0f); + + if (filterCols > 1) { + rightForm = new FormLayout(); + rightForm.setSizeFull(); + rightForm.setSpacing(false); + rightForm.setMargin(false); + filterColsLayout.addComponent(rightForm); + } + + if (rightForm != null) { + filterColsLayout.setExpandRatio(rightForm, 1.0f); + } + + if (!hideGrid) { + // grid part + grid = new FilteringGridComponent<T>(viewContext); + grid.init(rootType, viewContext.getService(IBeanSearchServiceFactory.class.getName())); + grid.setSizeFull(); + mainLayout.addComponent(grid); + mainLayout.setComponentAlignment(grid, Alignment.TOP_LEFT); + mainLayout.setExpandRatio(grid, 1.0f); + } + + return mainLayout; + } + + /** + * Adds a component to the filter component. + * + * @param component + * @param index + */ + public void addComponent(ISingleFilterComponent component, int index) { + if (filterCols > 1 && index % 2 == 0) { + rightForm.addComponent(component); + } else { + leftForm.addComponent(component); + } + component.setSizeFull(); + + components.add(component); + } + + public void removeAllComponents() { + components.clear(); + leftForm.removeAllComponents(); + if (rightForm != null) { + rightForm.removeAllComponents(); + } + if(!hideGrid) { + grid.removeAllColumns(); + } + } + + public void setResetFilterCallback(Callback resetFilterCallback) { + this.resetFilterCallback = resetFilterCallback; + } + + public void setApplyFilterCallback(Callback applyFilterCallback) { + this.applyFilterCallback = applyFilterCallback; + } + + public void setSelectionConsumer(Consumer<T> selectionConsumer) { + if (grid != null) { + grid.setSelectionConsumer(selectionConsumer); + } + } + + public void addBetweenTextComponent(String propertyId, int index) { + BetweenTextComponent comp = new BetweenTextComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public <X extends Number & Comparable<?>> void addBetweenDecimalComponent(String propertyId, Class<X> type, + int index) { + BetweenDecimalComponent<X> comp = new BetweenDecimalComponent<X>(propertyId, type, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareTextComponent(String propertyId, int index) { + CompareTextComponent comp = new CompareTextComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareDecimalComponent(String propertyId, Class<? extends Number> type, int index) { + CompareDecimalComponent comp = new CompareDecimalComponent(propertyId, type, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareDateComponent(String propertyId, int index) { + CompareDateComponent comp = new CompareDateComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addBetweenDateComponent(String propertyId, int index) { + BetweenDateComponent comp = new BetweenDateComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareBooleanComponent(String propertyId, int index) { + CompareBooleanComponent comp = new CompareBooleanComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addGridColumn(String propertyId) { + if(!hideGrid) { + grid.addColumn(propertyId); + } + } + + public void dispose() { + for (ISingleFilterComponent comp : components) { + comp.dispose(); + } + components.clear(); + + if(!hideGrid) { + grid.dispose(); + } + } + + /** + * Returns a proper filter for all components contained. + * + * @return + */ + public Filter getFilter() { + List<Filter> filters = components.stream().filter(c -> c.getFilter() != null).map(c -> c.getFilter()) + .collect(Collectors.toList()); + And andFilter = new And(filters.toArray(new Filter[filters.size()])); + return andFilter; + } + + @Override + public void resetAllFilters() { + for (ISingleFilterComponent comp : components) { + comp.resetAllFilters(); + } + } + + @Override + public void applyFilters() { + if(!hideGrid) { + grid.setFilter(getFilter()); + } + } + + @FunctionalInterface + interface Callback { + void callback(); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringGridComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringGridComponent.java new file mode 100644 index 0000000..56d833b --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/FilteringGridComponent.java
@@ -0,0 +1,150 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.function.Consumer; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService; +import org.eclipse.osbp.ecview.core.common.context.IViewContext; +import org.eclipse.osbp.runtime.common.i18n.II18nService; +import org.eclipse.osbp.runtime.common.util.BeanUtils; +import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory; +import org.vaadin.gridutil.renderer.BooleanRenderer; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.Column; +import com.vaadin.ui.Grid.SelectionMode; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.renderers.DateRenderer; +import com.vaadin.ui.renderers.NumberRenderer; + +@SuppressWarnings("serial") +public class FilteringGridComponent<T> extends CustomComponent implements ILocaleChangedService.LocaleListener { + + final IViewContext viewContext; + + Class<T> type; + + VerticalLayout mainLayout; + Grid grid; + + IBeanSearchService<T> service; + BeanServiceLazyLoadingContainer<T> container; + + private List<Object> columns = new ArrayList<>(); + + private Consumer<T> selectionConsumer; + + private II18nService i18nService; + + @Inject + public FilteringGridComponent(IViewContext viewContext) { + this.viewContext = viewContext; + } + + @SuppressWarnings("unchecked") + @PostConstruct + public void init(Class<T> type, IBeanSearchServiceFactory factory) { + this.type = type; + service = factory.createService(type); + container = new BeanServiceLazyLoadingContainer<T>(service, type, null); + + mainLayout = new VerticalLayout(); + mainLayout.setSizeFull(); + setCompositionRoot(mainLayout); + + grid = new Grid(); + grid.setSizeFull(); + mainLayout.addComponent(grid); + + grid.setContainerDataSource(container); + grid.removeAllColumns(); + + grid.addSelectionListener(e -> { + if (selectionConsumer != null) { + selectionConsumer.accept((T) grid.getSelectedRow()); + } + }); + + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.addLocaleListener(this); + + i18nService = viewContext.getService(II18nService.ID); + } + + public void dispose() { + ILocaleChangedService service = viewContext.getService(ILocaleChangedService.class.getName()); + service.removeLocaleListener(this); + } + + public void setSelectionMode(SelectionMode mode) { + if (grid == null) { + throw new IllegalStateException("Call #init before"); + } + grid.setSelectionMode(mode); + } + + public void addColumn(String propertyId) { + if (columns.contains(propertyId)) { + return; + } + + if (propertyId.contains(".")) { + container.addNestedContainerProperty(propertyId); + } + + columns.add(propertyId); + grid.setColumns(columns.toArray(new Object[columns.size()])); + + Column col = grid.getColumn(propertyId); + if (BeanUtils.isBoolean(type, propertyId)) { + col.setRenderer(new BooleanRenderer()); + } else if (BeanUtils.isDecimal(type, propertyId)) { + col.setRenderer(new NumberRenderer()); + } else if (BeanUtils.isDate(type, propertyId)) { + col.setRenderer(new DateRenderer()); + } + + } + + protected Class<?> getType(String propertyId) { + return BeanUtils.getNestedFieldType(type, propertyId); + } + + /** + * Sets a filter to the container. + * + * @param filter + */ + public void setFilter(Filter filter) { + container.removeAllContainerFilters(); + if (filter != null) { + container.addContainerFilter(filter); + } + } + + public void removeAllColumns() { + columns.clear(); + grid.removeAllColumns(); + } + + public void setSelectionConsumer(Consumer<T> selectionConsumer) { + this.selectionConsumer = selectionConsumer; + } + + @Override + public void localeChanged(Locale locale) { + for (Column col : grid.getColumns()) { + col.setHeaderCaption( + Util.getCaption(i18nService, (String) col.getPropertyId(), (String) col.getPropertyId(), locale)); + } + } +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/IFilteringComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/IFilteringComponent.java new file mode 100644 index 0000000..e74b512 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/IFilteringComponent.java
@@ -0,0 +1,38 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.Component; + +public interface IFilteringComponent extends Component { + + /** + * Returns a proper vaadin filter. + * + * @return + */ + Filter getFilter(); + + /** + * Resets all filters. + */ + void resetAllFilters(); + + void applyFilters(); + + void addComponent(ISingleFilterComponent component, int index); + + void addBetweenTextComponent(String propertyId, int index); + + <T extends Number & Comparable<?>> void addBetweenDecimalComponent(String propertyId, Class<T> type, int index); + + void addCompareTextComponent(String propertyId, int index); + + void addCompareDecimalComponent(String propertyId, Class<? extends Number> type, int index); + + void addCompareDateComponent(String propertyId, int index); + + void addBetweenDateComponent(String propertyId, int index); + + void addCompareBooleanComponent(String propertyId, int index); + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/ISingleFilterComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/ISingleFilterComponent.java new file mode 100644 index 0000000..0dfd41e --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/ISingleFilterComponent.java
@@ -0,0 +1,25 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import com.vaadin.data.Container.Filter; +import com.vaadin.ui.Component; + +public interface ISingleFilterComponent extends Component { + + /** + * Returns a proper vaadin filter. + * + * @return + */ + Filter getFilter(); + + /** + * Resets all filters. + */ + void resetAllFilters(); + + /** + * Dispose the element + */ + void dispose(); + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/OnlyFilteringComponent.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/OnlyFilteringComponent.java new file mode 100644 index 0000000..557d641 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/OnlyFilteringComponent.java
@@ -0,0 +1,230 @@ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.eclipse.osbp.ecview.core.common.context.IViewContext; + +import com.vaadin.data.Container.Filter; +import com.vaadin.data.util.filter.And; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class OnlyFilteringComponent<T> extends CustomComponent implements IFilteringComponent { + + IViewContext viewContext; + + ComponentContainer mainLayout; + FormLayout leftForm; + FormLayout rightForm; + List<ISingleFilterComponent> components = new ArrayList<>(); + + private Class<T> rootType; + + private Callback resetFilterCallback; + + private Callback applyFilterCallback; + + private int filterCols; + + public OnlyFilteringComponent(IViewContext viewContext, Class<T> rootType) { + this(viewContext, rootType, 2); + } + + public OnlyFilteringComponent(IViewContext viewContext, Class<T> rootType, int filterCols) { + this.viewContext = viewContext; + this.rootType = rootType; + + if (filterCols < 1 || filterCols > 2) { + throw new IllegalArgumentException("Columns must be between 1 and 2"); + } + this.filterCols = filterCols; + + init(); + } + + protected void init() { + mainLayout = createMainLayout(); + setCompositionRoot(mainLayout); + setSizeFull(); + } + + protected ComponentContainer createMainLayout() { + + VerticalLayout mainLayout = new VerticalLayout(); + mainLayout.setSizeFull(); + + // buttons + // + Button search = new Button("search", e -> { + applyFilters(); + }); + search.setSizeUndefined(); + + Button reset = new Button("reset", e -> { + resetAllFilters(); + }); + reset.setSizeUndefined(); + + HorizontalLayout buttonBar = new HorizontalLayout(search, reset); + buttonBar.setSizeUndefined(); + mainLayout.addComponent(buttonBar); + + // filter part + // + leftForm = new FormLayout(); + leftForm.setSizeFull(); + leftForm.setSpacing(false); + leftForm.setMargin(false); + + HorizontalLayout filterColsLayout = new HorizontalLayout(leftForm); + mainLayout.addComponent(filterColsLayout); + filterColsLayout.setSizeUndefined(); + filterColsLayout.setWidth("100%"); + mainLayout.setComponentAlignment(filterColsLayout, Alignment.TOP_LEFT); + + filterColsLayout.setMargin(new MarginInfo(true, true)); + filterColsLayout.setExpandRatio(leftForm, 1.0f); + + if (filterCols > 1) { + rightForm = new FormLayout(); + rightForm.setSizeFull(); + rightForm.setSpacing(false); + rightForm.setMargin(false); + filterColsLayout.addComponent(rightForm); + } + + if (rightForm != null) { + filterColsLayout.setExpandRatio(rightForm, 1.0f); + } + + return mainLayout; + } + + /** + * Adds a component to the filter component. + * + * @param component + * @param index + */ + public void addComponent(ISingleFilterComponent component, int index) { + if (filterCols > 1 && index % 2 == 0) { + rightForm.addComponent(component); + } else { + leftForm.addComponent(component); + } + component.setSizeFull(); + + components.add(component); + } + + public void removeAllComponents() { + components.clear(); + leftForm.removeAllComponents(); + if (rightForm != null) { + rightForm.removeAllComponents(); + } + } + + public void setResetFilterCallback(Callback resetFilterCallback) { + this.resetFilterCallback = resetFilterCallback; + } + + public void setApplyFilterCallback(Callback applyFilterCallback) { + this.applyFilterCallback = applyFilterCallback; + } + + public void addBetweenTextComponent(String propertyId, int index) { + BetweenTextComponent comp = new BetweenTextComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public <X extends Number & Comparable<?>> void addBetweenDecimalComponent(String propertyId, Class<X> type, + int index) { + BetweenDecimalComponent<X> comp = new BetweenDecimalComponent<X>(propertyId, type, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareTextComponent(String propertyId, int index) { + CompareTextComponent comp = new CompareTextComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareDecimalComponent(String propertyId, Class<? extends Number> type, int index) { + CompareDecimalComponent comp = new CompareDecimalComponent(propertyId, type, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareDateComponent(String propertyId, int index) { + CompareDateComponent comp = new CompareDateComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addBetweenDateComponent(String propertyId, int index) { + BetweenDateComponent comp = new BetweenDateComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void addCompareBooleanComponent(String propertyId, int index) { + CompareBooleanComponent comp = new CompareBooleanComponent(propertyId, viewContext); + comp.init(); + addComponent(comp, index); + } + + public void dispose() { + for (ISingleFilterComponent comp : components) { + comp.dispose(); + } + components.clear(); + } + + /** + * Returns a proper filter for all components contained. + * + * @return + */ + public Filter getFilter() { + List<Filter> filters = components.stream().filter(c -> c.getFilter() != null).map(c -> c.getFilter()) + .collect(Collectors.toList()); + And andFilter = new And(filters.toArray(new Filter[filters.size()])); + return andFilter; + } + + @Override + public void resetAllFilters() { + for (ISingleFilterComponent comp : components) { + comp.resetAllFilters(); + } + + if (resetFilterCallback != null) { + resetFilterCallback.callback(); + } + } + + @Override + public void applyFilters() { + if (applyFilterCallback != null) { + applyFilterCallback.callback(); + } + } + + @FunctionalInterface + interface Callback { + void callback(); + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/Util.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/Util.java new file mode 100644 index 0000000..967bbc5 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/filter2/Util.java
@@ -0,0 +1,177 @@ +/** + * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Florian Pirchner - Initial implementation + */ +package org.eclipse.osbp.runtime.web.vaadin.components.fields.filter2; + +import java.util.Locale; + +import org.eclipse.osbp.runtime.common.i18n.I18nUtil; +import org.eclipse.osbp.runtime.common.i18n.II18nService; +import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider; + +import com.vaadin.server.Resource; +import com.vaadin.ui.Component; + +/** + * The Class Util. + */ +public class Util { + + /** + * Apply captions. + * + * @param service + * the service + * @param label + * the label + * @param i18nLabelKey + * the i18n label key + * @param locale + * the locale + * @param component + * the component + */ + public static void applyCaptions(II18nService service, String label, + String i18nLabelKey, Locale locale, Component component) { + if(component != null) { + if (service != null && isValid(i18nLabelKey)) { + String translation = service.getValue(i18nLabelKey, locale); + if (translation == null || translation.equals("")) { + // caption must be set in all cases - even if it is null, else icon-only mode will not work + // if already set by other process then do not translate + component.setCaption(label); + } else { + component.setCaption(translation); + } + + } else { + // caption must be set in all cases - even if it is null, else icon-only mode will not work + component.setCaption(label); + } + } + } + + /** + * Gets the caption. + * + * @param service + * the service + * @param label + * the label + * @param i18nLabelKey + * the i18n label key + * @param locale + * the locale + * @return the caption + */ + public static String getCaption(II18nService service, String label, + String i18nLabelKey, Locale locale) { + + String result = i18nLabelKey; + + if (service != null && isValid(i18nLabelKey)) { + String translation = service.getValue(i18nLabelKey, locale); + if (translation == null || translation.equals("")) { + if (isValid(label)) { + result = label; + } + } else { + result = translation; + } + + } else { + if (isValid(label)) { + result = label; + } + } + return result != null ? result : ""; + } + + /** + * Apply caption icons. + * + * @param service + * the service + * @param provider + * the provider + * @param i18nLabelKey + * the i18n label key + * @param locale + * the locale + * @param component + * the component + */ + public static void applyCaptionIcons(II18nService service, + IResourceProvider provider, String i18nLabelKey, Locale locale, + Component component) { + String iconKey = I18nUtil.getImageKey(i18nLabelKey); + + if (service != null && provider != null && isValid(iconKey)) { + String iconResourcePath = service.getValue(iconKey, locale); + if (iconResourcePath != null && !iconResourcePath.equals("")) { + component.setIcon(provider.getResource(iconResourcePath)); + } + } + } + + /** + * Apply caption icons. + * + * @param service + * the service + * @param provider + * the provider + * @param i18nLabelKey + * the i18n label key + * @param locale + * the locale + * @param callback + * the callback + */ + public static void applyCaptionIcons(II18nService service, + IResourceProvider provider, String i18nLabelKey, Locale locale, + ResourceCallback callback) { + String iconKey = I18nUtil.getImageKey(i18nLabelKey); + + if (service != null && provider != null && isValid(iconKey)) { + String iconResourcePath = service.getValue(iconKey, locale); + if (iconResourcePath != null && !iconResourcePath.equals("")) { + callback.setIcon(provider.getResource(iconResourcePath)); + } + } + } + + /** + * Checks if is valid. + * + * @param value + * the value + * @return true, if is valid + */ + private static boolean isValid(String value) { + return value != null && !value.equals(""); + } + + /** + * Callback to set resources. + */ + public interface ResourceCallback { + + /** + * Sets the icon. + * + * @param resource + * the new icon + */ + void setIcon(Resource resource); + + } + +}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.classpath b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF index 3e1ad67..c870354 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF
@@ -5,16 +5,16 @@ Bundle-Version: 0.9.0.qualifier Bundle-ActivationPolicy: lazy Require-Bundle: javax.servlet;bundle-version="3.0.0";visibility:=reexport, - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)";visibility:=reexport, - com.vaadin.server;bundle-version="[7.5.7,7.7.0)";visibility:=reexport, - org.eclipse.core.databinding;bundle-version="1.4.1";visibility:=reexport, - org.eclipse.core.databinding.beans;bundle-version="1.2.200";visibility:=reexport, - org.eclipse.core.databinding.observable;bundle-version="1.4.1";visibility:=reexport, - org.eclipse.core.databinding.property;bundle-version="1.4.200";visibility:=reexport, + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)";visibility:=reexport, + com.vaadin.server;bundle-version="[7.7.6,7.8.0)";visibility:=reexport, + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)";visibility:=reexport, + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)";visibility:=reexport, + org.eclipse.core.databinding.observable;bundle-version="[1.6.0,1.7.0)";visibility:=reexport, + org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)";visibility:=reexport, org.apache.commons.beanutils;bundle-version="1.9.2", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", org.junit;bundle-version="4.10.0", org.apache.commons.logging;bundle-version="1.0.4", org.jsoup;bundle-version="1.7.2" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Eclipse OSBP
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java index df46133..05124ef 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java
@@ -30,6 +30,7 @@ try { VaadinSession session = new CustomVaadinSession(new VaadinServletService( null, new CustomDeploymentConfiguration())); + session.lock(); setSession(session); VaadinSession.setCurrent(session);
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.classpath b/org.eclipse.osbp.runtime.web.vaadin.databinding/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.project b/org.eclipse.osbp.runtime.web.vaadin.databinding/.project index 31b2223..03bd858 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding/.project +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.project
@@ -31,11 +31,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF index 486871d..700e32c 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF
@@ -5,12 +5,12 @@ Bundle-Version: 0.9.0.qualifier Bundle-ActivationPolicy: lazy Require-Bundle: javax.servlet;bundle-version="3.0.0", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - org.eclipse.core.databinding;bundle-version="[1.4.1,2.0.0)", - org.eclipse.core.databinding.observable;bundle-version="[1.4.1,2.0.0)", - org.eclipse.core.databinding.beans;bundle-version="[1.2.200,2.0.0)", - org.eclipse.core.databinding.property;bundle-version="[1.4.200,2.0.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.observable;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)", + org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)", org.apache.commons.beanutils;bundle-version="1.9.2", org.eclipse.core.runtime;bundle-version="3.9.0", com.ibm.icu;bundle-version="50.1.1"
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java index 1a509d8..f107074 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java
@@ -64,7 +64,7 @@ } @Override - @SuppressWarnings("rawtypes") + @SuppressWarnings({ "rawtypes", "unchecked" }) protected void doSetList(final Object source, List list, ListDiff diff) { final Container ds = Util.getContainer(source); // set changes on datasource. It will notify listener - BUT ensure @@ -75,7 +75,6 @@ // if (source instanceof AbstractSelect) { AbstractSelect select = (AbstractSelect) source; - select.unselect(element); } ds.removeItem(element); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java index a6d7347..18c2043 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java +++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java
@@ -27,8 +27,7 @@ } - public INativePropertyListener adaptListener( - ISimplePropertyListener listener) { + public INativePropertyListener adaptListener(ISimplePropertyListener listener) { return new PropertyValueChangeListener(this, listener); } @@ -46,18 +45,28 @@ @SuppressWarnings("rawtypes") @Override protected void doSetValue(Object source, Object value) { + // if (source instanceof AbstractField) { + // AbstractField field = (AbstractField) source; + // if (!field.isValid()) { + // // workaround - if value is invalid, then property#setValue will + // // not change the field value. So we need to reset the value + // // internally to the datasource value + // field.discard(); + // } + // } + + Property<Object> property = Util.getProperty(source); + property.setValue(value); + if (source instanceof AbstractField) { AbstractField field = (AbstractField) source; - if (!field.isValid()) { + if (field.getValue() != value) { // workaround - if value is invalid, then property#setValue will // not change the field value. So we need to reset the value // internally to the datasource value field.discard(); } } - - Property<Object> property = Util.getProperty(source); - property.setValue(value); } } \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF index ae21bd7..4074309 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.filter.jpa Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.filter.jpa Bundle-Version: 0.9.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: Eclipse OSBP Import-Package: javax.persistence;version="2.1.0", @@ -13,9 +13,9 @@ org.osgi.framework;version="1.8.0", org.osgi.service.component;version="1.2.2", org.osgi.service.component.annotations;version="1.2.0" -Require-Bundle: com.vaadin.client;bundle-version="[7.0.0,7.7.0)", - com.vaadin.server;bundle-version="[7.0.0,7.7.0)", - com.vaadin.shared;bundle-version="[7.0.0,7.7.0)", +Require-Bundle: com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", com.google.guava;bundle-version="15.0.0", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)" Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.filter.jpa.Filters.xml
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.classpath b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..fe45c94 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,7 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF index e521c3c..e59328f 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF
@@ -17,10 +17,10 @@ org.apache.shiro.core;bundle-version="1.2.1", org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)", org.eclipse.equinox.common;bundle-version="3.6.100", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", org.jsoup;bundle-version="1.7.2" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: Eclipse OSBP Service-Component: OSGI-INF/*.xml Import-Package: javax.servlet;version="2.6.0",
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.classpath b/org.eclipse.osbp.runtime.web.vaadin.osgi/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.project b/org.eclipse.osbp.runtime.web.vaadin.osgi/.project index 79fa0c5..739e18e 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.osgi/.project +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.project
@@ -31,11 +31,6 @@ </arguments> </buildCommand> <buildCommand> - <name>com.vaadin.integration.eclipse.addonStylesBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments> @@ -45,11 +40,17 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>org.eclipse.babel.editor.rbeBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.babel.editor.rbeNature</nature> </natures> </projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/com.vaadin.integration.eclipse.prefs
@@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF index e748a10..50f0433 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF
@@ -5,10 +5,10 @@ Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.osgi Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.osgi;singleton:=true Created-By: ApacheMaven -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.100", - com.vaadin.server;bundle-version="[7.0.0,7.7.0)", - com.vaadin.shared;bundle-version="[7.0.0,7.7.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", org.jsoup;bundle-version="1.7.2", org.slf4j.api;bundle-version="1.7.2" Build-Jdk: 1.7.0_15 @@ -18,10 +18,9 @@ Bundle-ManifestVersion: 2 Import-Package: javax.servlet;version="2.6.0", javax.servlet.http;version="2.6.0", - org.apache.shiro.web.servlet;version="1.2.0", org.eclipse.equinox.http.servlet;version="1.1.0", - org.eclipse.osgi.framework.console;version="1.1.0", org.eclipse.osbp.runtime.common.dispose;version="0.9.0", + org.eclipse.osgi.framework.console;version="1.1.0", org.osgi.framework;version="1.7.0", org.osgi.framework.wiring;version="1.1.0", org.osgi.service.cm;version="1.4.0",
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java index 19ddedf..dc3af06 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java +++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java
@@ -23,7 +23,6 @@ import javax.servlet.ServletException; -import org.apache.shiro.web.servlet.IniShiroFilter; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.http.servlet.ExtendedHttpService; @@ -111,7 +110,7 @@ /** The filter. */ // web - private IniShiroFilter filter; +// private IniShiroFilter filter; /** The servlet. */ private VaadinOSGiServlet servlet; @@ -287,6 +286,7 @@ * * @return the name */ + @Override public String getName() { return name; } @@ -391,6 +391,7 @@ /* (non-Javadoc) * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#isStarted() */ + @Override public boolean isStarted() { return started; } @@ -398,6 +399,7 @@ /* (non-Javadoc) * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#isDeployed() */ + @Override public boolean isDeployed() { return httpService != null; } @@ -406,6 +408,7 @@ * Is called to start the application. All resources should be registered * and the http service is registered. */ + @Override public void start() { if (started) { LOGGER.debug("HttpApplication {} is already started", getName()); @@ -544,15 +547,15 @@ servletAlias = String.format("/%s", getUIAlias()); defaultContext = new WebResourcesHttpContext(Activator .getBundleContext().getBundle()); - filter = new IniShiroFilter(); +// filter = new IniShiroFilter(); try { - try { - httpService.registerFilter("/", filter, properties, - defaultContext); - } catch (Exception e) { - LOGGER.error("{}", e); - throw new AppException(e); - } +// try { +// httpService.registerFilter("/", filter, properties, +// defaultContext); +// } catch (Exception e) { +// LOGGER.error("{}", e); +// throw new AppException(e); +// } httpService.registerResources(RESOURCE_BASE, RESOURCE_BASE, defaultContext); httpService.registerServlet(servletAlias, servlet, properties, @@ -598,15 +601,15 @@ servlet = null; } - try { - if (filter != null) { - httpService.unregisterFilter(filter); - } - } catch (Exception e) { - LOGGER.info("{}", e.getMessage()); - } finally { - filter = null; - } +// try { +// if (filter != null) { +// httpService.unregisterFilter(filter); +// } +// } catch (Exception e) { +// LOGGER.info("{}", e.getMessage()); +// } finally { +// filter = null; +// } try { httpService.unregister(RESOURCE_BASE); @@ -643,6 +646,7 @@ * Is called to stop the application. All resources should be unregistered * and the http service will become disposed. */ + @Override public void stop() { stop(false); } @@ -732,7 +736,7 @@ for (Iterator<OSGiUIProvider> iterator = uiProviders.iterator(); iterator .hasNext();) { - OSGiUIProvider provider = (OSGiUIProvider) iterator.next(); + OSGiUIProvider provider = iterator.next(); if (provider.getUIFactory() == uiFactory) { iterator.remove(); }
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.classpath b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.classpath new file mode 100644 index 0000000..cf36b56 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.classpath
@@ -0,0 +1,7 @@ +<?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.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.gitignore b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.gitignore new file mode 100644 index 0000000..44733b9 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.gitignore
@@ -0,0 +1,4 @@ +/resources/ +/gwt-unitCache +/VAADIN/* +/target/
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF index b59301d..699ae3a 100644 --- a/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF
@@ -3,17 +3,17 @@ Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.widgetset Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.widgetset Bundle-Version: 0.9.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: Eclipse OSBP -Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", +Require-Bundle: com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", com.google.guava;bundle-version="[10.0.0,19.0.0)", - org.eclipse.core.databinding;bundle-version="[1.4.1,1.5.0)", - org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)", - org.eclipse.core.databinding.observable;bundle-version="[1.4.1,1.5.0)", - org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)", + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)", + org.eclipse.core.databinding.observable;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", org.jsoup;bundle-version="1.7.2" Export-Package: org.eclipse.osbp.runtime.web.vaadin.widgetset;
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/license/THIRD-PARTY.properties b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/license/THIRD-PARTY.properties new file mode 100644 index 0000000..9af7a58 --- /dev/null +++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/license/THIRD-PARTY.properties
@@ -0,0 +1,31 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License, Version 2.0 +# - BSD 3-Clause License +# - BSD License +# - BSD style +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE +# (CDDL) +# Version +# 1.0 +# - Common Public License Version 1.0 +# - Eclipse Public License - v 1.0 +# - Indiana University Extreme! Lab Software +# License, +# vesion 1.1.1 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - The Apache Software License, Version 2.0 +# - The MIT License +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Wed May 21 17:53:35 BRT 2014 +ant--ant-launcher--1.6.5=Apache License, Version 2.0 +commons-collections--commons-collections--3.1=Apache License, Version 2.0 +javax.servlet--servlet-api--2.5=Common Development and Distribution license - v1.0.1 +org.jdesktop--swing-worker--1.1=Lesser General Public License (LGPL) +
diff --git a/pom.xml b/pom.xml index 17156d3..5d42a6f 100644 --- a/pom.xml +++ b/pom.xml
@@ -63,9 +63,9 @@ <module>org.eclipse.osbp.runtime.web.vaadin.widgetset</module> <!-- <module>org.eclipse.osbp.runtime.web.common.tests</module> --> - <module>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</module> +<!-- <module>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</module> --> <!-- <module>org.eclipse.osbp.runtime.web.vaadin.common.tests</module> --> - <module>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</module> +<!-- <module>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</module> --> <!-- <module>org.eclipse.osbp.runtime.web.vaadin.osgi.tests</module> --> </modules>
diff --git a/setup/target-luna.target b/setup/target-luna.target deleted file mode 100644 index 248464e..0000000 --- a/setup/target-luna.target +++ /dev/null
@@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?pde version="3.8"?><target includeMode="feature" name="org.eclipse.osbp.xtext.builder.target.luna" sequenceNumber="105"> -<locations> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="org.apache.commons.lang3" version="3.1.0.v201403281430"/> -<unit id="org.apache.commons.collections.source" version="3.2.0.v2013030210310"/> -<unit id="org.apache.commons.beanutils.source" version="1.8.0.v201205091237"/> -<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/> -<unit id="org.apache.commons.lang3.source" version="3.1.0.v201403281430"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/> -</location> -<location path="${eclipse_home}" type="Profile"/> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="org.eclipse.osbp.dependencies.feature.atmosphere.feature.group" version="2.1.2.vaadin3"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.service.xbase.source.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.source.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.service.jvmtypes.source.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.2.5"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.types.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.dependencies.feature.jetty.websockets.feature.group" version="8.1.14"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.source.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.7.1.201407011710"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.service.jvmtypes.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.types.source.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.7.1.201407011710"/> -<unit id="org.eclipse.osbp.xtext.builder.feature.service.xbase.feature.group" version="0.8.2.201408121142"/> -<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.source.feature.group" version="0.0.1.201408110750"/> -<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.source.feature.group" version="0.0.1.201408110750"/> -<repository location="http://lun.lunifera.org/downloads/p2/lunifera/luna/latest/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="org.apache.commons.collections.source" version="3.2.0.v2013030210310"/> -<unit id="javax.xml.bind" version="2.2.0.v201105210648"/> -<unit id="org.apache.commons.collections" version="3.2.0.v2013030210310"/> -<unit id="javax.xml.stream" version="1.0.1.v201004272200"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="javax.activation.source" version="1.1.0.v201211130549"/> -<unit id="javax.activation" version="1.1.0.v201211130549"/> -<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.7.0"/> -<unit id="org.eclipse.emf.ecp.ecview.feature.core.source.feature.group" version="0.7.0"/> -<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/> -</location> -<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> -<unit id="org.eclipse.osbp.dependencies.feature.security.shiro.feature.group" version="1.2.3"/> -<repository location="http://lun.lunifera.org/downloads/p2/lunifera/luna/latest/"/> -</location> -</locations> -</target>