catch up with branch development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
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/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/EditpartManager.java b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/EditpartManager.java
index 2e80d44..abf1be2 100644
--- a/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/EditpartManager.java
+++ b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/EditpartManager.java
@@ -25,6 +25,7 @@
import org.eclipse.osbp.ecview.extension.editparts.emf.components.BlobUploadComponentEditpart;
import org.eclipse.osbp.ecview.extension.editparts.emf.components.ContentSensitiveLayoutEditpart;
import org.eclipse.osbp.ecview.extension.editparts.emf.components.CustomDecimalFieldEditpart;
+import org.eclipse.osbp.ecview.extension.editparts.emf.components.I18nComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.editparts.emf.components.IconComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.editparts.emf.components.PairComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.editparts.emf.converter.CustomDecimalConverterEditpart;
@@ -49,13 +50,14 @@
import org.eclipse.osbp.ecview.extension.model.YDelegatingFocusingStrategy;
import org.eclipse.osbp.ecview.extension.model.YDelegatingLayoutingStrategy;
import org.eclipse.osbp.ecview.extension.model.YECviewPackage;
+import org.eclipse.osbp.ecview.extension.model.YI18nComboBox;
import org.eclipse.osbp.ecview.extension.model.YIconComboBox;
import org.eclipse.osbp.ecview.extension.model.YLayoutingInfo;
import org.eclipse.osbp.ecview.extension.model.YMaskedDecimalField;
import org.eclipse.osbp.ecview.extension.model.YMaskedNumericField;
import org.eclipse.osbp.ecview.extension.model.YMaskedTextField;
-import org.eclipse.osbp.ecview.extension.model.YPrefixedMaskedTextField;
import org.eclipse.osbp.ecview.extension.model.YPairComboBox;
+import org.eclipse.osbp.ecview.extension.model.YPrefixedMaskedTextField;
import org.eclipse.osbp.ecview.extension.model.YQuantityTextField;
import org.eclipse.osbp.ecview.extension.model.YRichTextArea;
import org.eclipse.osbp.ecview.extension.model.YStrategyLayout;
@@ -183,6 +185,8 @@
result = createNewInstance(AuthorizationVisibilityProcessorEditpart.class);
} else if (yElement instanceof YIconComboBox) {
result = createNewInstance(IconComboBoxEditpart.class);
+ } else if (yElement instanceof YI18nComboBox) {
+ result = createNewInstance(I18nComboBoxEditpart.class);
} else if (yElement instanceof YPairComboBox) {
result = createNewInstance(PairComboBoxEditpart.class);
} else if (yElement instanceof YContentSensitiveLayout) {
diff --git a/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/components/I18nComboBoxEditpart.java b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/components/I18nComboBoxEditpart.java
new file mode 100644
index 0000000..99ea5d2
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/components/I18nComboBoxEditpart.java
@@ -0,0 +1,28 @@
+/**
+ * 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.ecview.extension.editparts.emf.components;
+
+import org.eclipse.osbp.ecview.core.common.editpart.emf.FieldEditpart;
+import org.eclipse.osbp.ecview.extension.editparts.components.II18nComboBoxEditpart;
+import org.eclipse.osbp.ecview.extension.model.YECviewPackage;
+import org.eclipse.osbp.ecview.extension.model.YI18nComboBox;
+
+/**
+ * The implementation of the IUiComboBoxEditpart.
+ */
+public class I18nComboBoxEditpart extends FieldEditpart<YI18nComboBox>
+ implements II18nComboBoxEditpart {
+
+ public I18nComboBoxEditpart() {
+ super(YECviewPackage.Literals.YI1_8N_COMBO_BOX__DATATYPE);
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/EditpartManager.java b/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/EditpartManager.java
index 18ad543..6bb160c 100644
--- a/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/EditpartManager.java
+++ b/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/EditpartManager.java
@@ -50,6 +50,7 @@
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridHtmlRenderer;
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridImageRenderer;
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridIndicatorRenderer;
+import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridNestedConverter;
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridNumberRenderer;
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridPriceRenderer;
import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridProgressBarRenderer;
@@ -154,6 +155,8 @@
result = createNewInstance(GridPriceRendererEditpart.class);
} else if (yElement instanceof CxGridIndicatorRenderer) {
result = createNewInstance(GridIndicatorRendererEditpart.class);
+ } else if (yElement instanceof CxGridNestedConverter) {
+ result = createNewInstance(GridNestedPropertyConverterEditpart.class);
}
if (result != null) {
diff --git a/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/GridNestedPropertyConverterEditpart.java b/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/GridNestedPropertyConverterEditpart.java
new file mode 100644
index 0000000..da7ce4a
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.grid.editparts.emf/src/org/eclipse/osbp/ecview/extension/grid/editparts/emf/GridNestedPropertyConverterEditpart.java
@@ -0,0 +1,9 @@
+package org.eclipse.osbp.ecview.extension.grid.editparts.emf;
+
+import org.eclipse.osbp.ecview.core.common.editpart.emf.ConverterEditpart;
+import org.eclipse.osbp.ecview.extension.grid.editparts.converter.IGridNestedPropertyConverterEditpart;
+
+public class GridNestedPropertyConverterEditpart extends ConverterEditpart
+ implements IGridNestedPropertyConverterEditpart {
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/OSGI-INF/org.eclipse.osbp.ecview.extension.grid.presentation.converter.ConverterFactory.xml b/org.eclipse.osbp.ecview.extension.grid.presentation/OSGI-INF/org.eclipse.osbp.ecview.extension.grid.presentation.converter.ConverterFactory.xml
new file mode 100644
index 0000000..5cd23bc
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/OSGI-INF/org.eclipse.osbp.ecview.extension.grid.presentation.converter.ConverterFactory.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.ecview.extension.grid.presentation.converter.ConverterFactory">
+ <service>
+ <provide interface="org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory"/>
+ </service>
+ <implementation class="org.eclipse.osbp.ecview.extension.grid.presentation.converter.ConverterFactory"/>
+</scr:component>
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridCellFilter.java b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridCellFilter.java
index eee64a2..aa0bdb0 100644
--- a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridCellFilter.java
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridCellFilter.java
@@ -14,16 +14,46 @@
package org.eclipse.osbp.ecview.extension.grid.presentation;
import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
import org.eclipse.osbp.runtime.common.annotations.DtoUtils;
import org.eclipse.osbp.runtime.web.vaadin.common.data.filter.JoinFilter;
import org.vaadin.gridutil.cell.CellFilterComponent;
+import org.vaadin.gridutil.cell.RangeCellFilterComponent;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitHandler;
+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.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.filter.Between;
+import com.vaadin.data.util.filter.Compare.Equal;
import com.vaadin.data.util.filter.Or;
import com.vaadin.data.util.filter.SimpleStringFilter;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
+import com.vaadin.server.FontAwesome;
+import com.vaadin.server.FontIcon;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.DateField;
import com.vaadin.ui.Grid;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextField;
import com.vaadin.ui.themes.ValoTheme;
@@ -33,6 +63,7 @@
@SuppressWarnings("serial")
public class GridCellFilter extends org.vaadin.gridutil.cell.GridCellFilter {
+ protected static final String STYLENAME_GRIDCELLFILTER = "gridcellfilter";
/** The grid. */
private Grid grid;
@@ -58,8 +89,7 @@
* the input prompt
* @return the text field
*/
- public TextField setDtoFilter(final Object columnId,
- final Class<?> dtoClass, final String inputPrompt) {
+ public TextField setDtoFilter(final Object columnId, final Class<?> dtoClass, final String inputPrompt) {
CellFilterComponent<TextField> filter = new CellFilterComponent<TextField>() {
@@ -77,11 +107,9 @@
domainKeyPropertyId = domainKeyField.getName();
}
- Field domainDescriptionField = DtoUtils
- .getDomainDescriptionField(dtoClass);
+ Field domainDescriptionField = DtoUtils.getDomainDescriptionField(dtoClass);
if (domainDescriptionField != null) {
- domainDescriptionPropertyId = domainDescriptionField
- .getName();
+ domainDescriptionPropertyId = domainDescriptionField.getName();
}
this.textField.setImmediate(true);
@@ -93,28 +121,21 @@
@Override
public void textChange(final TextChangeEvent event) {
- if (event.getText() != null
- && event.getText().length() > 0) {
+ if (event.getText() != null && event.getText().length() > 0) {
- if (isValid(domainKeyPropertyId)
- && isValid(domainDescriptionPropertyId)) {
+ if (isValid(domainKeyPropertyId) && isValid(domainDescriptionPropertyId)) {
// filter for key or description
- SimpleStringFilter numberFilter = new SimpleStringFilter(
- domainKeyPropertyId, event.getText(),
- true, false);
+ SimpleStringFilter numberFilter = new SimpleStringFilter(domainKeyPropertyId,
+ event.getText(), true, false);
SimpleStringFilter descriptionFilter = new SimpleStringFilter(
- domainDescriptionPropertyId, event
- .getText(), true, false);
+ domainDescriptionPropertyId, event.getText(), true, false);
Or or = new Or(numberFilter, descriptionFilter);
- replaceFilter(new JoinFilter((String) columnId,
- or), columnId);
+ replaceFilter(new JoinFilter((String) columnId, or), columnId);
} else if (isValid(domainKeyPropertyId)) {
// filter for key
- SimpleStringFilter numberFilter = new SimpleStringFilter(
- domainKeyPropertyId, event.getText(),
- true, false);
- replaceFilter(new JoinFilter((String) columnId,
- numberFilter), columnId);
+ SimpleStringFilter numberFilter = new SimpleStringFilter(domainKeyPropertyId,
+ event.getText(), true, false);
+ replaceFilter(new JoinFilter((String) columnId, numberFilter), columnId);
}
} else {
removeFilter(columnId);
@@ -138,6 +159,446 @@
}
/**
+ * assign a <b>SimpleStringFilter</b> to grid for given columnId<br>
+ * could also be used for NumberField when you would like to do filter by
+ * startWith for example
+ *
+ * @param columnId
+ * id of property
+ * @param filterProperty
+ * property used to filter
+ * @param ignoreCase
+ * property of SimpleStringFilter
+ * @param onlyMatchPrefix
+ * property of SimpleStringFilter
+ * @param inputPrompt
+ * hint for user
+ * @return generated TextField
+ */
+ public TextField setTextFilter(final Object columnId, final Object filterProperty, final boolean ignoreCase,
+ final boolean onlyMatchPrefix, final String inputPrompt) {
+ CellFilterComponent<TextField> filter = new CellFilterComponent<TextField>() {
+
+ private static final long serialVersionUID = 1L;
+ TextField textField = new TextField();
+
+ @Override
+ public TextField layoutComponent() {
+ this.textField.setImmediate(true);
+ this.textField.setInputPrompt(inputPrompt);
+ this.textField.addStyleName("gridcellfilter");
+ this.textField.addStyleName(ValoTheme.TEXTFIELD_TINY);
+ this.textField.addTextChangeListener(new TextChangeListener() {
+
+ private static final long serialVersionUID = -3567212620627878001L;
+
+ @Override
+ public void textChange(final TextChangeEvent event) {
+ if (event.getText() != null && event.getText().length() > 0) {
+ replaceFilter(new SimpleStringFilter(filterProperty, event.getText(), ignoreCase,
+ onlyMatchPrefix), columnId);
+ } else {
+ removeFilter(columnId);
+ }
+ }
+ });
+ return this.textField;
+ }
+
+ @Override
+ public void clearFilter() {
+ this.textField.clear();
+ }
+ };
+
+ setCustomFilter(columnId, filter);
+ return filter.getComponent();
+ }
+
+ /**
+ * assign a <b>EqualFilter</b> to grid for given columnId
+ *
+ * @param columnId
+ * id of property
+ * @param filterPropertyPath
+ * path for filtering
+ * @return drawn comboBox in order to add some custom styles
+ */
+ public ComboBox setBooleanFilter(final Object columnId, final String filterPropertyPath) {
+ CellFilterComponent<ComboBox> filter = new CellFilterComponent<ComboBox>() {
+
+ private static final long serialVersionUID = 1L;
+ ComboBox comboBox = new ComboBox();
+
+ @SuppressWarnings("unchecked")
+ private Item genItem(final Boolean value) {
+ Item item = this.comboBox.getItem(this.comboBox.addItem());
+ item.getItemProperty("icon").setValue(value ? FontAwesome.CHECK_SQUARE : FontAwesome.TIMES);
+ item.getItemProperty("value").setValue(value);
+ item.getItemProperty("caption").setValue(value.toString());
+ return item;
+ }
+
+ @Override
+ public ComboBox layoutComponent() {
+
+ this.comboBox.addContainerProperty("icon", FontIcon.class, null);
+ this.comboBox.addContainerProperty("value", Boolean.class, null);
+ this.comboBox.addContainerProperty("caption", String.class, null);
+
+ this.comboBox.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ this.comboBox.setItemCaptionPropertyId("caption");
+ this.comboBox.setItemIconPropertyId("icon");
+
+ genItem(Boolean.TRUE);
+ genItem(Boolean.FALSE);
+
+ this.comboBox.setNullSelectionAllowed(true);
+ this.comboBox.setImmediate(true);
+ this.comboBox.addStyleName(STYLENAME_GRIDCELLFILTER);
+ this.comboBox.addStyleName(ValoTheme.COMBOBOX_TINY);
+ this.comboBox.addValueChangeListener(new ValueChangeListener() {
+
+ private static final long serialVersionUID = 75672745825037750L;
+
+ @Override
+ public void valueChange(final ValueChangeEvent event) {
+ Integer internalId = (Integer) comboBox.getValue();
+ if (internalId != null && internalId > 0) {
+ replaceFilter(
+ new Equal(filterPropertyPath, internalId.equals(1) ? Boolean.TRUE : Boolean.FALSE),
+ columnId);
+ } else {
+ removeFilter(columnId);
+ }
+ }
+ });
+ return this.comboBox;
+ }
+
+ @Override
+ public void clearFilter() {
+ this.comboBox.setValue(null);
+ }
+ };
+
+ setCustomFilter(columnId, filter);
+ return filter.getComponent();
+ }
+
+ /**
+ * assign a <b>EqualFilter</b> to grid for given columnId
+ *
+ * @param columnId
+ * id of property
+ * @param filterPropertyPath
+ * path for filtering
+ * @param list
+ * selection for ComboBox
+ * @return drawn comboBox in order to add some custom styles
+ */
+ public ComboBox setComboBoxFilter(final Object columnId, String filterPropertyPath, final List<?> list) {
+ CellFilterComponent<ComboBox> filter = new CellFilterComponent<ComboBox>() {
+
+ private static final long serialVersionUID = 1L;
+ ComboBox comboBox = new ComboBox();
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public ComboBox layoutComponent() {
+ BeanItemContainer container = new BeanItemContainer(list.get(0).getClass(), list);
+
+ this.comboBox.setNullSelectionAllowed(true);
+ this.comboBox.setImmediate(true);
+ this.comboBox.setContainerDataSource(container);
+ this.comboBox.addStyleName(STYLENAME_GRIDCELLFILTER);
+ this.comboBox.addStyleName(ValoTheme.COMBOBOX_TINY);
+ this.comboBox.addValueChangeListener(new ValueChangeListener() {
+
+ private static final long serialVersionUID = 4657429154535483528L;
+
+ @Override
+ public void valueChange(final ValueChangeEvent event) {
+ if (comboBox.getValue() != null) {
+ replaceFilter(new Equal(filterPropertyPath, comboBox.getValue()), columnId);
+ } else {
+ removeFilter(columnId);
+ }
+ }
+ });
+ return this.comboBox;
+ }
+
+ @Override
+ public void clearFilter() {
+ this.comboBox.setValue(null);
+ }
+ };
+
+ setCustomFilter(columnId, filter);
+ return filter.getComponent();
+ }
+
+ private final static Date MIN_DATE_VALUE = new Date(0); // 1970-01-01
+ // 00:00:00
+ private final static Date MAX_DATE_VALUE = new Date(32503676399000L); // 2999-12-31
+ // 23:59:59
+
+ /**
+ * assign a <b>BetweenFilter</b> to grid for given columnId<br>
+ *
+ * @param columnId
+ * id of property
+ * @param filterPropertyPath
+ * path for filtering
+ * @return FieldGroup that holds both TextFields (smallest and biggest as
+ * propertyId)
+ */
+ public FieldGroup setDateFilter(final Object columnId, String filterPropertyPath) {
+ RangeCellFilterComponent<HorizontalLayout> filter = new RangeCellFilterComponent<HorizontalLayout>() {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private DateField genDateField(final String propertyId) {
+ final DateField dateField = new DateField();
+ getFieldGroup().bind(dateField, propertyId);
+ dateField.setWidth("100%");
+ dateField.setImmediate(true);
+ dateField.setInvalidAllowed(false);
+ dateField.setInvalidCommitted(false);
+ dateField.setResolution(Resolution.DAY);
+ dateField.addStyleName(STYLENAME_GRIDCELLFILTER);
+ dateField.addStyleName(ValoTheme.DATEFIELD_TINY);
+ dateField.addValueChangeListener(new ValueChangeListener() {
+
+ private static final long serialVersionUID = 9147606627660840906L;
+
+ @Override
+ public void valueChange(final ValueChangeEvent event) {
+ try {
+ if (dateField.isValid()) {
+ dateField.setComponentError(null);
+ getFieldGroup().commit();
+ }
+ } catch (CommitException e) {
+ }
+ }
+ });
+ return dateField;
+ }
+
+ @Override
+ public HorizontalLayout layoutComponent() {
+ getFieldGroup().setItemDataSource(genPropertysetItem(Date.class));
+
+ DateField smallest = genDateField("smallest");
+ DateField biggest = genDateField("biggest");
+ getHLayout().addComponent(smallest);
+ getHLayout().addComponent(biggest);
+ getHLayout().setExpandRatio(smallest, 1);
+ getHLayout().setExpandRatio(biggest, 1);
+
+ initCommitHandler();
+
+ return getHLayout();
+ }
+
+ private void initCommitHandler() {
+ getFieldGroup().addCommitHandler(new CommitHandler() {
+
+ private static final long serialVersionUID = 2617591142986829655L;
+
+ @Override
+ public void preCommit(final CommitEvent commitEvent) throws CommitException {
+ }
+
+ private Date fixTiming(Date date, boolean beginning) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.MILLISECOND, beginning ? 0 : 999);
+ calendar.set(Calendar.SECOND, beginning ? 0 : 99);
+ calendar.set(Calendar.MINUTE, beginning ? 0 : 59);
+ calendar.set(Calendar.HOUR, beginning ? 0 : 23);
+ return calendar.getTime();
+ }
+
+ @Override
+ public void postCommit(final CommitEvent commitEvent) throws CommitException {
+ Date smallestValue = (Date) getFieldGroup().getItemDataSource().getItemProperty("smallest")
+ .getValue();
+ Date biggestValue = (Date) getFieldGroup().getItemDataSource().getItemProperty("biggest")
+ .getValue();
+ if (smallestValue != null || biggestValue != null) {
+ replaceFilter(
+ new Between(filterPropertyPath,
+ smallestValue != null ? fixTiming(smallestValue, true) : MIN_DATE_VALUE,
+ biggestValue != null ? fixTiming(biggestValue, false) : MAX_DATE_VALUE),
+ columnId);
+ } else {
+ removeFilter(columnId);
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public void clearFilter() {
+ getFieldGroup().clear();
+ }
+ };
+
+ setCustomFilter(columnId, filter);
+ return filter.getFieldGroup();
+ }
+
+ /**
+ * assign a <b>BetweenFilter</b> to grid for given columnId<br>
+ * only supports type of <b>Integer, Double, Float, BigInteger and
+ * BigDecimal</b>
+ *
+ * @param columnId
+ * id of property
+ * @param filterPropertyPath
+ * path for filtering
+ * @return FieldGroup that holds both TextFields (smallest and biggest as
+ * propertyId)
+ */
+ public FieldGroup setNumberFilter(final Object columnId, final String filterPropertyPath) {
+ final Class<?> type = this.grid.getContainerDataSource().getType(columnId);
+ RangeCellFilterComponent<HorizontalLayout> filter = new RangeCellFilterComponent<HorizontalLayout>() {
+
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings("rawtypes")
+ private Converter getConverter() {
+ if (type == Integer.class) {
+ return new StringToIntegerConverter();
+ } else if (type == Double.class) {
+ return new StringToDoubleConverter();
+ } else if (type == Float.class) {
+ return new StringToFloatConverter();
+ } else if (type == BigInteger.class) {
+ return new StringToBigIntegerConverter();
+ } else if (type == BigDecimal.class) {
+ return new StringToBigDecimalConverter();
+ } else {
+ return new StringToLongConverter();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private TextField genNumberField(final String propertyId) {
+ final TextField field = new TextField();
+ getFieldGroup().bind(field, propertyId);
+ field.setWidth("100%");
+ field.setImmediate(true);
+ field.setInvalidAllowed(false);
+ field.setInvalidCommitted(false);
+ field.setNullSettingAllowed(true);
+ field.setNullRepresentation("");
+ field.setConverter(getConverter());
+ field.addStyleName(STYLENAME_GRIDCELLFILTER);
+ field.addStyleName(ValoTheme.TEXTFIELD_TINY);
+ field.addValueChangeListener(new ValueChangeListener() {
+
+ private static final long serialVersionUID = -8404344833239596320L;
+
+ @Override
+ public void valueChange(final ValueChangeEvent event) {
+ try {
+ if (field.isValid()) {
+ field.setComponentError(null);
+ getFieldGroup().commit();
+ }
+ } catch (CommitException e) {
+ }
+ }
+ });
+ return field;
+ }
+
+ @Override
+ public HorizontalLayout layoutComponent() {
+ getFieldGroup().setItemDataSource(genPropertysetItem(type));
+
+ TextField smallest = genNumberField("smallest");
+ TextField biggest = genNumberField("biggest");
+ getHLayout().addComponent(smallest);
+ getHLayout().addComponent(biggest);
+ getHLayout().setExpandRatio(smallest, 1);
+ getHLayout().setExpandRatio(biggest, 1);
+
+ initCommitHandler();
+
+ return getHLayout();
+ }
+
+ // BigInteger and BigDecimal is a bit dirty
+ public Number getValue(final boolean max) {
+ if (type == Integer.class) {
+ return max ? Integer.MAX_VALUE : Integer.MIN_VALUE;
+ } else if (type == Double.class) {
+ return max ? Double.MAX_VALUE : Double.MIN_VALUE;
+ } else if (type == Float.class) {
+ return max ? Float.MAX_VALUE : Float.MIN_VALUE;
+ } else if (type == BigInteger.class) {
+ return max ? new BigInteger(String.valueOf(Long.MAX_VALUE))
+ : new BigInteger(String.valueOf(Long.MIN_VALUE));
+ } else if (type == BigDecimal.class) {
+ return max ? new BigDecimal(String.valueOf(Long.MAX_VALUE))
+ : new BigDecimal(String.valueOf(Long.MIN_VALUE));
+ } else {
+ return max ? Long.MAX_VALUE : Long.MIN_VALUE;
+ }
+ }
+
+ private void initCommitHandler() {
+ getFieldGroup().addCommitHandler(new CommitHandler() {
+
+ private static final long serialVersionUID = -2912534421548359666L;
+
+ @Override
+ public void preCommit(final CommitEvent commitEvent) throws CommitException {
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void postCommit(final CommitEvent commitEvent) throws CommitException {
+ Object smallestValue = getFieldGroup().getItemDataSource().getItemProperty("smallest")
+ .getValue();
+ Object biggestValue = getFieldGroup().getItemDataSource().getItemProperty("biggest").getValue();
+ if (smallestValue != null || biggestValue != null) {
+ if (smallestValue != null && biggestValue != null && smallestValue.equals(biggestValue)) {
+ replaceFilter(new Equal(filterPropertyPath, smallestValue), columnId);
+ } else {
+ replaceFilter(
+ new Between(filterPropertyPath,
+ (Comparable) (smallestValue != null ? smallestValue : getValue(false)),
+ (Comparable) (biggestValue != null ? biggestValue : getValue(true))),
+ columnId);
+ }
+ } else {
+ removeFilter(columnId);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void clearFilter() {
+ getFieldGroup().clear();
+ }
+ };
+
+ setCustomFilter(columnId, filter);
+ return filter.getFieldGroup();
+ }
+
+ /**
* Destroys the filter.
*/
public void destroy() {
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
index 554cf8f..1e136ef 100644
--- a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
@@ -40,6 +40,7 @@
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.editpart.IFieldEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YConverter;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
@@ -69,6 +70,7 @@
import org.eclipse.osbp.ecview.extension.grid.memento.CxGridMementoColumn;
import org.eclipse.osbp.ecview.extension.grid.memento.CxGridMementoFactory;
import org.eclipse.osbp.ecview.extension.grid.memento.CxGridMementoSortable;
+import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridNestedConverter;
import org.eclipse.osbp.runtime.common.annotations.DtoUtils;
import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent;
@@ -241,13 +243,21 @@
}
// set the visible columns and icons
- List<String> visibleColumns = new ArrayList<String>();
+ List<String> visibleColumns = new ArrayList<>();
+ List<CxGridColumn> visibleColumnObjs = new ArrayList<>();
Collection<?> propertyIds = grid.getContainerDataSource().getContainerPropertyIds();
for (CxGridColumn cxColumn : modelAccess.yField.getColumns()) {
if (!cxColumn.isHidden()
&& (propertyIds.contains(cxColumn.getPropertyPath()) || isNestedColumn(cxColumn))) {
visibleColumns.add(cxColumn.getPropertyPath());
- cxColumn.setLabelI18nKey(cxColumn.getPropertyPath());
+ visibleColumnObjs.add(cxColumn);
+ if(cxColumn.getLabelI18nKey() == null || cxColumn.getLabelI18nKey().equals("")){
+ cxColumn.setLabelI18nKey(cxColumn.getPropertyPath());
+ }
+ YConverter converter = cxColumn.getConverter();
+ if (converter instanceof CxGridNestedConverter) {
+ CxGridNestedConverter nestedConverter = (CxGridNestedConverter) converter;
+ }
}
}
@@ -346,12 +356,19 @@
CxGrid cxGrid = modelAccess.yField;
for (CxGridHeaderRow cxHeader : cxGrid.getHeaders()) {
+
+ boolean addedCells = false;
HeaderRow headerRow = grid.prependHeaderRow();
groupingHeaders.put(cxHeader, headerRow);
// create the grouping headers
//
for (CxGridGroupedCell groupingColumn : cxHeader.getGroupings()) {
+ if (groupingColumn.getGroupables().size() <= 1) {
+ continue;
+ }
+ addedCells = true;
+
List<Grid.HeaderCell> headerCells = getCells(headerRow, groupingColumn);
Grid.HeaderCell cell = headerRow.join(headerCells.toArray(new Grid.HeaderCell[headerCells.size()]));
@@ -366,6 +383,10 @@
}
}
+ if (!addedCells) {
+ grid.removeHeaderRow(headerRow);
+ }
+
// create the custom cells
//
for (CxGridMetaCell cxCell : cxHeader.getCustomCells()) {
@@ -464,23 +485,34 @@
*/
protected void createAutoFilters() {
cellFilters = new GridCellFilter(grid);
- Container.Filterable container = (Container.Filterable) grid.getContainerDataSource();
- for (Grid.Column column : grid.getColumns()) {
- Class<?> propertyType = container.getType(column.getPropertyId());
+ for (CxGridColumn cxColumn : modelAccess.yField.getColumns()) {
+ Class<?> propertyType = cxColumn.getType();
+
+ String propertyPath = cxColumn.getPropertyPath();
+ String filterPropertyPath = cxColumn.getPropertyPath();
+ if (cxColumn.isEditsDto()) {
+ // if the column edits a dto, its property path points to
+ // the dto. Eg. person.country.
+ // So we need to use a special path for filtering which
+ // points
+ // to the domainkey. person.country.isoCode
+ filterPropertyPath = cxColumn.getFilterPropertyPathForEditsDto();
+ }
if (Number.class.isAssignableFrom(propertyType) || isPrimitiveNumber(propertyType)) {
- cellFilters.setNumberFilter(column.getPropertyId());
+ cellFilters.setNumberFilter(propertyPath, filterPropertyPath);
} else if (propertyType == String.class) {
- cellFilters.setTextFilter(column.getPropertyId(), true, false);
+ cellFilters.setTextFilter(propertyPath, filterPropertyPath, true, false, null);
} else if (propertyType == Date.class) {
- cellFilters.setDateFilter(column.getPropertyId());
+ cellFilters.setDateFilter(propertyPath, filterPropertyPath);
// otherwise the column is to wide
- column.setMaximumWidth(175);
+ grid.getColumn(propertyPath).setMaximumWidth(175);
} else if (propertyType == Boolean.class || propertyType == Boolean.TYPE) {
- cellFilters.setBooleanFilter(column.getPropertyId());
+ cellFilters.setBooleanFilter(propertyPath, filterPropertyPath);
} else if (propertyType.isEnum()) {
- cellFilters.setComboBoxFilter(column.getPropertyId(), Arrays.asList(propertyType.getEnumConstants()));
+ cellFilters.setComboBoxFilter(propertyPath, filterPropertyPath,
+ Arrays.asList(propertyType.getEnumConstants()));
} else if (DtoUtils.getDomainKeyField(propertyType) != null) {
- cellFilters.setDtoFilter(column.getPropertyId(), propertyType, "");
+ cellFilters.setDtoFilter(propertyPath, propertyType, "");
}
}
}
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/ConverterFactory.java b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/ConverterFactory.java
new file mode 100644
index 0000000..f524dbc
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/ConverterFactory.java
@@ -0,0 +1,34 @@
+package org.eclipse.osbp.ecview.extension.grid.presentation.converter;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory;
+import org.eclipse.osbp.ecview.extension.grid.editparts.converter.IGridNestedPropertyConverterEditpart;
+import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridNestedConverter;
+import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridRendererPackage;
+import org.osgi.service.component.annotations.Component;
+
+/**
+ * A factory for creating Converter objects.
+ */
+@Component(immediate = true)
+public class ConverterFactory implements IConverterFactory {
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IConverterEditpart editpart) {
+ EObject model = (EObject) editpart.getModel();
+ return model.eClass().getEPackage() == CxGridRendererPackage.eINSTANCE;
+ }
+
+ @Override
+ public Object createConverter(IViewContext uiContext, IConverterEditpart editpart) throws IllegalArgumentException {
+
+ if (editpart instanceof IGridNestedPropertyConverterEditpart) {
+ return new GridNestedPropertyConverter((IGridNestedPropertyConverterEditpart) editpart);
+ }
+
+ throw new IllegalArgumentException("Not a valid editpart: " + editpart.getClass().getName());
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/GridNestedPropertyConverter.java b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/GridNestedPropertyConverter.java
new file mode 100644
index 0000000..c9eb045
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/converter/GridNestedPropertyConverter.java
@@ -0,0 +1,83 @@
+package org.eclipse.osbp.ecview.extension.grid.presentation.converter;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Locale;
+
+import org.apache.commons.beanutils.NestedNullException;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.extension.grid.editparts.converter.IGridNestedPropertyConverterEditpart;
+import org.eclipse.osbp.ecview.extension.grid.renderer.CxGridNestedConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.converter.Converter;
+
+public class GridNestedPropertyConverter implements Converter<Object, Object> {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GridNestedPropertyConverter.class);
+
+ final IGridNestedPropertyConverterEditpart editpart;
+ final CxGridNestedConverter model;
+
+ Converter<Object, Object> nestedTypeConverter;
+
+ public GridNestedPropertyConverter(IGridNestedPropertyConverterEditpart editpart) {
+ this.editpart = editpart;
+ this.model = (CxGridNestedConverter) editpart.getModel();
+
+ }
+
+ @Override
+ public Object convertToModel(Object value, Class<? extends Object> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+
+ @Override
+ public Object convertToPresentation(Object value, Class<? extends Object> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+
+ checkDelegatingConverter();
+
+ if (value != null && model.getNestedDotPath() != null && !model.getNestedDotPath().equals("")) {
+ Object property = null;
+ try {
+ property = PropertyUtils.getProperty(value, model.getNestedDotPath());
+ if (nestedTypeConverter != null) {
+ property = nestedTypeConverter.convertToPresentation(property, model.getNestedType(), locale);
+ }
+ return property;
+ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException
+ | NestedNullException e) {
+ LOGGER.error("{}", e);
+ throw new IllegalStateException();
+ }
+ } else {
+ return value;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void checkDelegatingConverter() {
+ if (model.getNestedTypeConverter() != null && nestedTypeConverter == null) {
+ IConverterEditpart nestedTypeConverterEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(editpart.getContext(), model.getNestedTypeConverter());
+ nestedTypeConverter = (Converter<Object, Object>) nestedTypeConverterEP.getDelegate();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<Object> getModelType() {
+ return (Class<Object>) model.getBaseType();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<Object> getPresentationType() {
+ return (Class<Object>) model.getNestedType();
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
index 2d15d90..e27de06 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
@@ -40,7 +40,8 @@
org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)",
org.eclipse.xtext.util;bundle-version="[2.11.0,2.12.0)",
org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)",
- org.eclipse.osbp.blob;bundle-version="0.9.0"
+ org.eclipse.osbp.blob;bundle-version="0.9.0",
+ org.eclipse.osbp.preferences;bundle-version="0.9.0"
Import-Package: org.apache.commons.lang,
org.eclipse.core.databinding.property.value,
org.eclipse.e4.core.services.events,
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/PresenterFactory.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/PresenterFactory.java
index 64b2eba..d4fa3e3 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/PresenterFactory.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/PresenterFactory.java
@@ -26,11 +26,13 @@
import org.eclipse.osbp.ecview.extension.editparts.IStrategyLayoutEditpart;
import org.eclipse.osbp.ecview.extension.editparts.components.IBlobUploadComponentEditpart;
import org.eclipse.osbp.ecview.extension.editparts.components.ICustomDecimalFieldEditpart;
+import org.eclipse.osbp.ecview.extension.editparts.components.II18nComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.editparts.components.IIconComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.editparts.components.IPairComboBoxEditpart;
import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.BlobUploadComponentPresentation;
import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.ContentSensitiveLayoutPresentation;
import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.CustomDecimalFieldPresentation;
+import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.I18nComboBoxPresentation;
import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.IconComboBoxPresentation;
//lunifera@80.156.28.28/osbpgit/org.eclipse.osbp.ecview.extension.git
import org.eclipse.osbp.ecview.extension.presentation.vaadin.components.MaskedDecimalFieldPresentation;
@@ -93,6 +95,8 @@
return (A) new CustomDecimalFieldPresentation(editpart);
} else if (editpart instanceof IIconComboBoxEditpart) {
return (A) new IconComboBoxPresentation(editpart);
+ } else if (editpart instanceof II18nComboBoxEditpart) {
+ return (A) new I18nComboBoxPresentation(editpart);
} else if (editpart instanceof IPairComboBoxEditpart) {
return (A) new PairComboBoxPresentation(editpart);
} else if (editpart instanceof IContentSensitiveLayoutEditpart) {
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/I18nComboBoxPresentation.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/I18nComboBoxPresentation.java
new file mode 100644
index 0000000..9808f47
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/I18nComboBoxPresentation.java
@@ -0,0 +1,386 @@
+/**
+ *
+ * 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 implementation
+ *
+ */
+package org.eclipse.osbp.ecview.extension.presentation.vaadin.components;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.extension.editparts.components.II18nComboBoxEditpart;
+import org.eclipse.osbp.ecview.extension.model.YECviewPackage;
+import org.eclipse.osbp.ecview.extension.model.YI18nComboBox;
+import org.eclipse.osbp.preferences.LocaleUtils;
+import org.eclipse.osbp.preferences.ProductConfiguration;
+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.ui.api.themes.EnumCssClass;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.UI;
+
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class I18nComboBoxPresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(I18nComboBoxPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The combo. */
+ private ComboBox combo;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public I18nComboBoxPresentation(IElementEditpart editpart) {
+ super((II18nComboBoxEditpart) editpart);
+ this.modelAccess = new ModelAccess((YI18nComboBox) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (combo == null) {
+ // Get Map from FunctionLibraryDSL
+ IThemeResourceService themeResourceService = getViewContext().getService(IThemeResourceService.class.getName());
+ combo = new ComboBox();
+// combo.addStyleName(CSS_CLASS_CONTROL);
+ combo.addStyleName(EnumCssClass.COMBOBOX_WITH_ICON.styleName());
+ combo.setImmediate(true);
+ combo.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
+// combo.setItemCaptionMode(ItemCaptionMode.ICON_ONLY);
+ combo.setTextInputAllowed(false);
+ combo.setNullSelectionAllowed(false);
+
+ setupComponent(combo, getCastedModel());
+
+ associateWidget(combo, modelAccess.yI18nComboBox);
+ if (modelAccess.isCssIdValid()) {
+ combo.setId(modelAccess.getCssID());
+ } else {
+ combo.setId(getEditpart().getId());
+ }
+
+ // Datasource
+ IndexedContainer datasource = new IndexedContainer();
+ combo.setContainerDataSource(datasource);
+ property = new ObjectProperty<String>("", String.class);
+ combo.setPropertyDataSource(property);
+
+ boolean needCountry = false;
+ if (UI.getCurrent().getLocale().getCountry().length() == 0) {
+ needCountry = true;
+ }
+ Locale[] locales = Locale.getAvailableLocales();
+ // --- sort by display name used in the respective locale, if it is
+ // configured ---
+ LocaleUtils.sortLocalesOnDisplayName(locales);
+ for (Locale locale : locales) {
+ // only allow locales with country due to currency sign formatters
+ if (locale.getCountry().length() > 0) {
+ String loc = locale.toLanguageTag();
+ if (needCountry && locale.getLanguage().equals(UI.getCurrent().getLocale().getLanguage())) {
+ // force a default country if not already given by default
+ Locale newLocale = new Locale(locale.getLanguage(), locale.getCountry());
+ UI.getCurrent().setLocale(newLocale);
+ Locale.setDefault(newLocale);
+ needCountry = false;
+ }
+ if (ProductConfiguration.getLanguages().containsKey(locale.getLanguage())) {
+ // --- set the display name used in the respective
+ // locale, if it is configured ---
+ combo.setItemCaption(loc, LocaleUtils.getDisplayName(locale));
+ datasource.addItem(loc);
+ if (themeResourceService != null) {
+ combo.setItemIcon(loc, themeResourceService.getThemeResource(locale.getCountry().toLowerCase(), ThemeResourceType.FLAG));
+ }
+ }
+ }
+ }
+
+
+ // creates the binding for the field
+ createBindings(modelAccess.yI18nComboBox, combo);
+
+ if (modelAccess.isCssClassValid()) {
+ combo.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(combo);
+
+ }
+ return combo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @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(), combo);
+ }
+
+ /*
+ * (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)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException("BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ }
+ throw new IllegalArgumentException("Not a valid input: " + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(YECviewPackage.Literals.YI1_8N_COMBO_BOX__SELECTION, yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yI18nComboBox.getType(), modelAccess.yI18nComboBox.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yCombo
+ * the y combo
+ * @param combo
+ * the combo
+ */
+ protected void createBindings(YI18nComboBox yCombo, ComboBox combo) {
+ // ATTENTION!!!!
+ // The creation of the model container binding from widget to
+ // ECView-model as in the ComboBoxPresentation
+ // (registerBinding(createBindings_ContainerContents...)) is in
+ // this case not required due to the existing fixed content collection
+ // on the creation of the icon comboBox.
+
+ // create the model binding from widget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()), YECviewPackage.Literals.YI1_8N_COMBO_BOX__SELECTION, combo, yCombo.getType()));
+
+ super.createBindings(yCombo, combo, null);
+ }
+
+ /*
+ * (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()
+ */
+ @Override
+ public boolean isRendered() {
+ return combo != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (combo != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) combo.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(combo);
+ }
+
+ // remove assocations
+ unassociateWidget(combo);
+
+ combo = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y icon combo box. */
+ private final YI18nComboBox yI18nComboBox;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param YI18nComboBox
+ * the y icon combo box
+ */
+ public ModelAccess(YI18nComboBox YI18nComboBox) {
+ super();
+ this.yI18nComboBox = YI18nComboBox;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yI18nComboBox.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 yI18nComboBox.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 yI18nComboBox.getDatadescription() != null ? yI18nComboBox.getDatadescription().getLabel() : null;
+ // return YI18nComboBox.getLabel();
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yI18nComboBox.getDatadescription() != null ? yI18nComboBox.getDatadescription().getLabelI18nKey() : null;
+ // return YI18nComboBox.getLabelI18nKey();
+ }
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public EMap<String, String> getProperties() {
+ if (modelAccess.yI18nComboBox != null) {
+ return modelAccess.yI18nComboBox.getProperties();
+ }
+ return new BasicEMap<String, String>();
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/Person.java b/org.eclipse.osbp.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/Person.java
new file mode 100644
index 0000000..f924c48
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/Person.java
@@ -0,0 +1,314 @@
+/**
+ * All rights reserved by Loetz KG Heidelberg 2015.
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.ecview.extension.tests.dtos;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+import java.util.Date;
+import javax.validation.Valid;
+import org.eclipse.osbp.dsl.common.datatypes.IDto;
+import org.eclipse.osbp.dsl.dto.lib.MappingContext;
+import org.eclipse.osbp.runtime.common.annotations.Dispose;
+
+@SuppressWarnings("all")
+public class Person implements IDto, Serializable, PropertyChangeListener {
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
+
+ @Dispose
+ private boolean disposed;
+
+ private String id = java.util.UUID.randomUUID().toString();
+
+ private String name;
+
+ private String name2;
+
+ private int age;
+
+ @Valid
+ private Date birthday;
+
+ /**
+ * @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);
+ }
+
+ /**
+ * Installs lazy collection resolving for entity {@link } to the dto {@link Person}.
+ *
+ */
+ protected void installLazyCollections() {
+
+ }
+
+ /**
+ * 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();
+ }
+
+ /**
+ * 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 name2 property or <code>null</code> if not present.
+ */
+ public String getName2() {
+ return this.name2;
+ }
+
+ /**
+ * Sets the <code>name2</code> property to this instance.
+ *
+ * @param name2 - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setName2(final String name2) {
+ firePropertyChange("name2", this.name2, this.name2 = name2 );
+ }
+
+ /**
+ * Returns the age property or <code>null</code> if not present.
+ */
+ public int getAge() {
+ return this.age;
+ }
+
+ /**
+ * Sets the <code>age</code> property to this instance.
+ *
+ * @param age - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setAge(final int age) {
+ firePropertyChange("age", this.age, this.age = age );
+ }
+
+ /**
+ * Returns the birthday property or <code>null</code> if not present.
+ */
+ public Date getBirthday() {
+ return this.birthday;
+ }
+
+ /**
+ * Sets the <code>birthday</code> property to this instance.
+ *
+ * @param birthday - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setBirthday(final Date birthday) {
+ firePropertyChange("birthday", this.birthday, this.birthday = birthday );
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Person other = (Person) 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 Person createDto() {
+ return new Person();
+ }
+
+ public Person copy(final MappingContext context) {
+ checkDisposed();
+
+ if (context == null) {
+ throw new IllegalArgumentException("Context must not be null!");
+ }
+
+ if(context.isMaxLevel()){
+ return null;
+ }
+
+ // if context contains a copied instance of this object
+ // then return it
+ Person newDto = context.get(this);
+ if(newDto != null){
+ return newDto;
+ }
+
+ try{
+ context.increaseLevel();
+
+ newDto = createDto();
+ context.register(this, newDto);
+
+ // first copy the containments and attributes
+ copyContainments(this, newDto, context);
+
+ // then copy cross references to ensure proper
+ // opposite references are copied too.
+ copyCrossReferences(this, newDto, context);
+ } finally {
+ context.decreaseLevel();
+ }
+
+ return newDto;
+ }
+
+ public void copyContainments(final Person dto, final Person newDto, final MappingContext context) {
+ checkDisposed();
+
+ if (context == null) {
+ throw new IllegalArgumentException("Context must not be null!");
+ }
+
+
+ // copy attributes and beans (beans if derived from entity model)
+ // copy id
+ newDto.setId(getId());
+ // copy name
+ newDto.setName(getName());
+ // copy name2
+ newDto.setName2(getName2());
+ // copy age
+ newDto.setAge(getAge());
+ // copy birthday
+ newDto.setBirthday(getBirthday());
+
+ // copy containment references (cascading is true)
+ }
+
+ public void copyCrossReferences(final Person dto, final Person newDto, final org.eclipse.osbp.dsl.dto.lib.MappingContext context) {
+ checkDisposed();
+
+ if (context == null) {
+ throw new IllegalArgumentException("Context must not be null!");
+ }
+
+
+ // copy cross references (cascading is false)
+ }
+
+ 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.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/TestsDtosTranslator.java b/org.eclipse.osbp.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/TestsDtosTranslator.java
new file mode 100644
index 0000000..f7a981d
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.sample/src-gen/org/eclipse/osbp/ecview/extension/tests/dtos/TestsDtosTranslator.java
@@ -0,0 +1,69 @@
+package org.eclipse.osbp.ecview.extension.tests.dtos;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.HashMap;
+import java.util.Locale;
+import org.eclipse.osbp.runtime.common.i18n.ITranslator;
+import org.slf4j.Logger;
+
+@SuppressWarnings("all")
+public class TestsDtosTranslator implements ITranslator {
+ private static Logger log = org.slf4j.LoggerFactory.getLogger("translations by translator");
+
+ private static TestsDtosTranslator instance = null;
+
+ private static Locale lastLocale = null;
+
+ private PropertyChangeSupport pcs = new java.beans.PropertyChangeSupport(this);
+
+ private HashMap<String, String> translations = new HashMap<String,String>() {{
+ }};
+
+ public static TestsDtosTranslator getInstance(final Locale locale) {
+ if(instance == null) {
+ instance = new org.eclipse.osbp.ecview.extension.tests.dtos.TestsDtosTranslator();
+ if (lastLocale == null) {
+ instance.changeLocale(locale);
+ }
+ }
+ return instance;
+ }
+
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ this.pcs.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(final PropertyChangeListener listener) {
+ this.pcs.removePropertyChangeListener(listener);
+ }
+
+ public void mergeTranslations() {
+
+ }
+
+ public HashMap<String, String> getTranslations() {
+ return translations;
+ }
+
+ public void changeLocale(final Locale locale) {
+ // avoid unnecessary settings
+ if (locale == null) {
+ if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.ecview.extension.tests.dtos is null.");
+ return;
+ }
+ if (locale.equals(lastLocale)) {
+ if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.ecview.extension.tests.dtos already set to "+locale.getDisplayLanguage());
+ return;
+ }
+ if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.ecview.extension.tests.dtos set to "+locale.getDisplayLanguage());
+ lastLocale = locale;
+ // call the imported translators change locale method
+ try {
+ java.util.ResourceBundle resource = java.util.ResourceBundle.getBundle("i18n.I18N", locale, getClass().getClassLoader());
+ } catch (java.util.MissingResourceException mre) {
+ System.err.println(getClass().getCanonicalName()+" - "+mre.getLocalizedMessage());
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/.classpath b/org.eclipse.osbp.ecview.extension.samples/.classpath
new file mode 100644
index 0000000..a831b68
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/.classpath
@@ -0,0 +1,10 @@
+<?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="OSGI-INF"/>
+ <classpathentry kind="src" path="i18n"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.osbp.ecview.extension.samples/.project b/org.eclipse.osbp.ecview.extension.samples/.project
new file mode 100644
index 0000000..c277920
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.ecview.extension.samples</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>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</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.ecview.extension.samples/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.ecview.extension.samples/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/.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.ecview.extension.samples/LICENSE.txt b/org.eclipse.osbp.ecview.extension.samples/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation.
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.samples/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.samples/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..37fc01e
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/META-INF/MANIFEST.MF
@@ -0,0 +1,61 @@
+Manifest-Version: 1.0
+Bundle-ActivationPolicy: lazy
+Built-By: root
+Bundle-Name: org.eclipse.osbp.ecview.extension.samples
+Created-By: ApacheMaven
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: com.vaadin.shared;bundle-version="7.7.6",
+ com.vaadin.server;bundle-version="[7.7.6,7.8.0)",
+ com.vaadin.external.org.slf4j;bundle-version="1.6.1",
+ 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="9.3.9",
+ org.eclipse.jetty.io;bundle-version="9.3.9",
+ org.eclipse.jetty.security;bundle-version="9.3.9",
+ org.eclipse.jetty.server;bundle-version="9.3.9",
+ org.eclipse.jetty.servlet;bundle-version="9.3.9",
+ org.eclipse.jetty.util;bundle-version="9.3.9",
+ org.eclipse.equinox.http.servlet;bundle-version="1.3.1",
+ org.jsoup;bundle-version="1.8.3",
+ org.eclipse.xtext.xbase.lib;bundle-version="2.11.0",
+ javax.persistence;bundle-version="2.1.0",
+ javax.validation.api;bundle-version="1.1.0",
+ org.eclipse.osbp.dsl.dto.lib;bundle-version="0.9.0",
+ org.eclipse.osbp.dsl.datatype.lib;bundle-version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common,
+ org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="0.9.0",
+ org.eclipse.equinox.ds;bundle-version="1.4.400",
+ org.eclipse.osgi;bundle-version="3.11.3",
+ org.eclipse.osgi.services;bundle-version="3.5.100",
+ org.eclipse.osgi.util;bundle-version="3.3.100",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin,
+ org.eclipse.osbp.ecview.core.common;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.core.emf.api;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.extension.grid.model,
+ org.eclipse.osbp.ecview.extension.grid.editparts;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.extension.grid.editparts.emf;bundle-version="0.9.0",
+ org.eclipse.osbp.ecview.extension.grid.presentation;bundle-version="0.9.0",
+ org.vaadin.addons.vaadin-grid-util;bundle-version="1.0.8",
+ org.eclipse.persistence.core;bundle-version="2.6.1",
+ org.eclipse.persistence.asm;bundle-version="5.0.1",
+ org.eclipse.persistence.jpa;bundle-version="2.6.1",
+ org.eclipse.persistence.jpa.jpql;bundle-version="2.6.1",
+ org.apache.derby;bundle-version="10.11.1"
+Build-Jdk: 1.7.0_15
+Bundle-Vendor: Eclipse OSBP
+Bundle-Version: 0.9.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.osbp.runtime.web.sample.Activator
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.framework.wiring;version="1.1.0",
+ org.osgi.service.http;version="1.2.1",
+ org.osgi.util.tracker;version="1.5.1",
+ org.slf4j;version="1.7.2"
+Bundle-SymbolicName: org.eclipse.osbp.ecview.extension.samples
+Service-Component: OSGI-INF/*.xml
diff --git a/org.eclipse.osbp.ecview.extension.samples/META-INF/persistence.xml b/org.eclipse.osbp.ecview.extension.samples/META-INF/persistence.xml
new file mode 100644
index 0000000..5578a81
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/META-INF/persistence.xml
@@ -0,0 +1,15 @@
+<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="sample"
+ transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.BaseUUID</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Person</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Address</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Country</class>
+
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ </persistence-unit>
+</persistence>
diff --git a/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.JPAStartup.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.JPAStartup.xml
new file mode 100644
index 0000000..9200eca
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.JPAStartup.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" immediate="true" name="org.eclipse.osbp.runtime.web.sample.JPAStartup">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.JPAStartup"/>
+</scr:component>
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.AddressDtoMapper.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.AddressDtoMapper.xml
new file mode 100644
index 0000000..f49688b
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.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.eclipse.osbp.runtime.web.sample.dtos.mapper.addressdtomapper">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.mapper.AddressDtoMapper"/>
+ <service>
+ <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/>
+ </service>
+
+ <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.runtime.web.sample.entities.Address"/>
+ <property name="fordto.to.dto" type="String">org.eclipse.osbp.runtime.web.sample.dtos.AddressDto
+ org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto
+ </property>
+
+ <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.AddressDto"/>
+ <property name="forentity.to.entity" type="String">org.eclipse.osbp.runtime.web.sample.entities.Address
+ org.eclipse.osbp.runtime.web.sample.entities.BaseUUID
+ </property>
+
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper.xml
new file mode 100644
index 0000000..dfbe9a0
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.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.eclipse.osbp.runtime.web.sample.dtos.mapper.baseuuiddtomapper">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper"/>
+ <service>
+ <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/>
+ </service>
+
+ <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.runtime.web.sample.entities.BaseUUID"/>
+ <property name="fordto.to.dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto"/>
+
+ <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto"/>
+ <property name="forentity.to.entity" type="String" value="org.eclipse.osbp.runtime.web.sample.entities.BaseUUID"/>
+
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.CountryDtoMapper.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.CountryDtoMapper.xml
new file mode 100644
index 0000000..a3b1949
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.CountryDtoMapper.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.eclipse.osbp.runtime.web.sample.dtos.mapper.countrydtomapper">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.mapper.CountryDtoMapper"/>
+ <service>
+ <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/>
+ </service>
+
+ <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.runtime.web.sample.entities.Country"/>
+ <property name="fordto.to.dto" type="String">org.eclipse.osbp.runtime.web.sample.dtos.CountryDto
+ org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto
+ </property>
+
+ <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.CountryDto"/>
+ <property name="forentity.to.entity" type="String">org.eclipse.osbp.runtime.web.sample.entities.Country
+ org.eclipse.osbp.runtime.web.sample.entities.BaseUUID
+ </property>
+
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.mapper.countrydtomapper"/>
+ <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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.PersonDtoMapper.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.PersonDtoMapper.xml
new file mode 100644
index 0000000..bd3cd40
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.mapper.PersonDtoMapper.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.eclipse.osbp.runtime.web.sample.dtos.mapper.persondtomapper">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.mapper.PersonDtoMapper"/>
+ <service>
+ <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/>
+ </service>
+
+ <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.runtime.web.sample.entities.Person"/>
+ <property name="fordto.to.dto" type="String">org.eclipse.osbp.runtime.web.sample.dtos.PersonDto
+ org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto
+ </property>
+
+ <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.PersonDto"/>
+ <property name="forentity.to.entity" type="String">org.eclipse.osbp.runtime.web.sample.entities.Person
+ org.eclipse.osbp.runtime.web.sample.entities.BaseUUID
+ </property>
+
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.mapper.persondtomapper"/>
+ <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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.AddressDtoService.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.AddressDtoService.xml
new file mode 100644
index 0000000..fbd68bd
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.AddressDtoService.xml
@@ -0,0 +1,15 @@
+<?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.sample.dtos.service.addressdtoservice">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.service.AddressDtoService"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/>
+ </service>
+ <property name="dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.AddressDto"/>
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.service.addressdtoservice"/>
+<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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.BaseUUIDDtoService.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.BaseUUIDDtoService.xml
new file mode 100644
index 0000000..9259f49
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.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.eclipse.osbp.runtime.web.sample.dtos.service.baseuuiddtoservice">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.service.BaseUUIDDtoService"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/>
+ </service>
+ <property name="dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto"/>
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.CountryDtoService.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.CountryDtoService.xml
new file mode 100644
index 0000000..59406e2
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.CountryDtoService.xml
@@ -0,0 +1,15 @@
+<?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.sample.dtos.service.countrydtoservice">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.service.CountryDtoService"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/>
+ </service>
+ <property name="dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.CountryDto"/>
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.service.countrydtoservice"/>
+<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.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.PersonDtoService.xml b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.PersonDtoService.xml
new file mode 100644
index 0000000..d007125
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/OSGI-INF/org.eclipse.osbp.runtime.web.sample.dtos.service.PersonDtoService.xml
@@ -0,0 +1,15 @@
+<?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.sample.dtos.service.persondtoservice">
+ <implementation class="org.eclipse.osbp.runtime.web.sample.dtos.service.PersonDtoService"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/>
+ </service>
+ <property name="dto" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.PersonDto"/>
+ <property name="service.pid" type="String" value="org.eclipse.osbp.runtime.web.sample.dtos.service.persondtoservice"/>
+<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.ecview.extension.samples/build.properties b/org.eclipse.osbp.ecview.extension.samples/build.properties
new file mode 100644
index 0000000..4707318
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/org.eclipse.osbp.runtime.web.sample.JPAStartup.xml
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N.properties
new file mode 100644
index 0000000..76abf7d
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N.properties
@@ -0,0 +1,32 @@
+#default
+activation_time=activation_time
+actual_owner=actual_owner
+address=address
+age=age
+base_uuid=base_uuid
+birthdate=birthdate
+city=city
+country=country
+created_by=created_by
+created_on=created_on
+description=description
+eu_member=eu_member
+expiration_time=expiration_time
+female=female
+firstname=firstname
+gender=gender
+iso_code=iso_code
+lastname=lastname
+male=male
+name=name
+person=person
+priority=priority
+process_id=process_id
+process_instance_id=process_instance_id
+process_session_id=process_session_id
+status=status
+street=street
+subject=subject
+task_id=task_id
+uuid=uuid
+weight=weight
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de.properties
new file mode 100644
index 0000000..52f8f00
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de.properties
@@ -0,0 +1,32 @@
+#de
+activation_time=Activation time
+actual_owner=Actual owner
+address=Address
+age=Age
+base_uuid=Identifier
+birthdate=Birthdate
+city=City
+country=Country
+created_by=Created by
+created_on=Created on
+description=Description
+eu_member=Eu member
+expiration_time=Expiration time
+female=Female
+firstname=Firstname
+gender=Gender
+iso_code=Iso code
+lastname=Lastname
+male=Male
+name=Name
+person=Person
+priority=Priority
+process_id=Process identifier
+process_instance_id=Process instance identifier
+process_session_id=Process session identifier
+status=Status
+street=Street
+subject=Subject
+task_id=Task identifier
+uuid=Uuid
+weight=Weight
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties
new file mode 100644
index 0000000..6c73e1d
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties
@@ -0,0 +1 @@
+#de_AT
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en.properties
new file mode 100644
index 0000000..731788b
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en.properties
@@ -0,0 +1,32 @@
+#en
+activation_time=Activation time
+actual_owner=Actual owner
+address=Address
+age=Age
+base_uuid=Identifier
+birthdate=Birthdate
+city=City
+country=Country
+created_by=Created by
+created_on=Created on
+description=Description
+eu_member=Eu member
+expiration_time=Expiration time
+female=Female
+firstname=Firstname
+gender=Gender
+iso_code=Iso code
+lastname=Lastname
+male=Male
+name=Name
+person=Person
+priority=Priority
+process_id=Process identifier
+process_instance_id=Process instance identifier
+process_session_id=Process session identifier
+status=Status
+street=Street
+subject=Subject
+task_id=Task identifier
+uuid=Uuid
+weight=Weight
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties
new file mode 100644
index 0000000..d89e21c
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties
@@ -0,0 +1 @@
+#en_US
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_fr.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_fr.properties
new file mode 100644
index 0000000..a84da83
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_fr.properties
@@ -0,0 +1 @@
+#fr
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/AddressDto.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/AddressDto.java
new file mode 100644
index 0000000..72fef95
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/AddressDto.java
@@ -0,0 +1,126 @@
+package org.eclipse.osbp.runtime.web.sample.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.eclipse.osbp.runtime.common.annotations.Filter;
+import org.eclipse.osbp.runtime.common.annotations.FilterDepth;
+import org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.CountryDto;
+
+@SuppressWarnings("all")
+public class AddressDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener {
+ @Filter
+ private String street;
+
+ @Filter
+ private String city;
+
+ @DomainReference
+ @FilterDepth(depth = 3)
+ private CountryDto country;
+
+ 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 street property or <code>null</code> if not present.
+ */
+ public String getStreet() {
+ return this.street;
+ }
+
+ /**
+ * Sets the <code>street</code> property to this instance.
+ *
+ * @param street - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setStreet(final String street) {
+ firePropertyChange("street", this.street, this.street = street );
+ }
+
+ /**
+ * 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 country property or <code>null</code> if not present.
+ */
+ public CountryDto 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 CountryDto country) {
+ checkDisposed();
+ firePropertyChange("country", this.country, this.country = country);
+ }
+
+ 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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/BaseUUIDDto.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/BaseUUIDDto.java
new file mode 100644
index 0000000..bb6b08a
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/BaseUUIDDto.java
@@ -0,0 +1,154 @@
+package org.eclipse.osbp.runtime.web.sample.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 uuid = 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 uuid property or <code>null</code> if not present.
+ */
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ /**
+ * Sets the <code>uuid</code> property to this instance.
+ *
+ * @param uuid - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setUuid(final String uuid) {
+ firePropertyChange("uuid", this.uuid, this.uuid = uuid );
+ installLazyCollections();
+ }
+
+ public boolean equalVersions(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.uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!this.uuid.equals(other.uuid))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.uuid== null) ? 0 : this.uuid.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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/CountryDto.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/CountryDto.java
new file mode 100644
index 0000000..a92d748
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/CountryDto.java
@@ -0,0 +1,121 @@
+package org.eclipse.osbp.runtime.web.sample.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.Filter;
+import org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto;
+
+@SuppressWarnings("all")
+public class CountryDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener {
+ @Filter
+ private String name;
+
+ @Filter
+ private String isoCode;
+
+ @Filter
+ private boolean euMember;
+
+ public CountryDto() {
+ installLazyCollections();
+ }
+
+ /**
+ * Installs lazy collection resolving for entity {@link Country} to the dto {@link CountryDto}.
+ *
+ */
+ 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 isoCode property or <code>null</code> if not present.
+ */
+ public String getIsoCode() {
+ return this.isoCode;
+ }
+
+ /**
+ * Sets the <code>isoCode</code> property to this instance.
+ *
+ * @param isoCode - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setIsoCode(final String isoCode) {
+ firePropertyChange("isoCode", this.isoCode, this.isoCode = isoCode );
+ }
+
+ /**
+ * Returns the euMember property or <code>null</code> if not present.
+ */
+ public boolean getEuMember() {
+ return this.euMember;
+ }
+
+ /**
+ * Sets the <code>euMember</code> property to this instance.
+ *
+ * @param euMember - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setEuMember(final boolean euMember) {
+ firePropertyChange("euMember", this.euMember, this.euMember = euMember );
+ }
+
+ 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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/Gender.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/Gender.java
new file mode 100644
index 0000000..2342655
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/Gender.java
@@ -0,0 +1,8 @@
+package org.eclipse.osbp.runtime.web.sample.dtos;
+
+@SuppressWarnings("all")
+public enum Gender {
+ MALE,
+
+ FEMALE;
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/PersonDto.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/PersonDto.java
new file mode 100644
index 0000000..53c6a50
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/PersonDto.java
@@ -0,0 +1,214 @@
+package org.eclipse.osbp.runtime.web.sample.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.Filter;
+import org.eclipse.osbp.runtime.common.annotations.FilterDepth;
+import org.eclipse.osbp.runtime.common.annotations.Range;
+import org.eclipse.osbp.runtime.web.sample.dtos.AddressDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.Gender;
+
+@SuppressWarnings("all")
+public class PersonDto extends BaseUUIDDto implements IDto, Serializable, PropertyChangeListener {
+ @Filter
+ private String firstname;
+
+ @Range
+ private String lastname;
+
+ @Valid
+ @Filter
+ private Date birthdate;
+
+ @Filter
+ private int age;
+
+ @Range
+ private double weight;
+
+ private Gender gender;
+
+ @DomainReference
+ @FilterDepth(depth = 3)
+ private AddressDto address;
+
+ public PersonDto() {
+ installLazyCollections();
+ }
+
+ /**
+ * Installs lazy collection resolving for entity {@link Person} to the dto {@link PersonDto}.
+ *
+ */
+ 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 firstname property or <code>null</code> if not present.
+ */
+ public String getFirstname() {
+ return this.firstname;
+ }
+
+ /**
+ * Sets the <code>firstname</code> property to this instance.
+ *
+ * @param firstname - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setFirstname(final String firstname) {
+ firePropertyChange("firstname", this.firstname, this.firstname = firstname );
+ }
+
+ /**
+ * Returns the lastname property or <code>null</code> if not present.
+ */
+ public String getLastname() {
+ return this.lastname;
+ }
+
+ /**
+ * Sets the <code>lastname</code> property to this instance.
+ *
+ * @param lastname - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setLastname(final String lastname) {
+ firePropertyChange("lastname", this.lastname, this.lastname = lastname );
+ }
+
+ /**
+ * 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 age property or <code>null</code> if not present.
+ */
+ public int getAge() {
+ return this.age;
+ }
+
+ /**
+ * Sets the <code>age</code> property to this instance.
+ *
+ * @param age - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setAge(final int age) {
+ firePropertyChange("age", this.age, this.age = age );
+ }
+
+ /**
+ * Returns the weight property or <code>null</code> if not present.
+ */
+ public double getWeight() {
+ return this.weight;
+ }
+
+ /**
+ * Sets the <code>weight</code> property to this instance.
+ *
+ * @param weight - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setWeight(final double weight) {
+ firePropertyChange("weight", this.weight, this.weight = weight );
+ }
+
+ /**
+ * Returns the gender property or <code>null</code> if not present.
+ */
+ public Gender 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 Gender gender) {
+ firePropertyChange("gender", this.gender, this.gender = gender );
+ }
+
+ /**
+ * Returns the address property or <code>null</code> if not present.
+ */
+ public AddressDto getAddress() {
+ return this.address;
+ }
+
+ /**
+ * Sets the <code>address</code> property to this instance.
+ *
+ * @param address - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setAddress(final AddressDto address) {
+ checkDisposed();
+ firePropertyChange("address", this.address, this.address = address);
+ }
+
+ 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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/AddressDtoMapper.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/AddressDtoMapper.java
new file mode 100644
index 0000000..3922149
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/AddressDtoMapper.java
@@ -0,0 +1,202 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.mapper;
+
+import org.eclipse.osbp.dsl.dto.lib.MappingContext;
+import org.eclipse.osbp.runtime.web.sample.dtos.AddressDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.CountryDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper;
+import org.eclipse.osbp.runtime.web.sample.entities.Address;
+import org.eclipse.osbp.runtime.web.sample.entities.Country;
+
+/**
+ * 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.setStreet(toDto_street(entity, context));
+ dto.setCity(toDto_city(entity, context));
+ dto.setCountry(toDto_country(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.setStreet(toEntity_street(dto, entity, context));
+ entity.setCity(toEntity_city(dto, entity, context));
+ entity.setCountry(toEntity_country(dto, entity, context));
+ }
+
+ /**
+ * Maps the property street 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_street(final Address in, final MappingContext context) {
+ return in.getStreet();
+ }
+
+ /**
+ * Maps the property street 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_street(final AddressDto in, final Address parentEntity, final MappingContext context) {
+ return in.getStreet();
+ }
+
+ /**
+ * 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 country 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 CountryDto toDto_country(final Address in, final MappingContext context) {
+ if(in.getCountry() != null) {
+ // find a mapper that knows how to map the concrete input type.
+ org.eclipse.osbp.dsl.dto.lib.IMapper<CountryDto, Country> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CountryDto, Country>) getToDtoMapper(CountryDto.class, in.getCountry().getClass());
+ if(mapper == null) {
+ throw new IllegalStateException("Mapper must not be null!");
+ }
+ CountryDto dto = null;
+ dto = context.get(mapper.createDtoHash(in.getCountry()));
+ if(dto != null) {
+ if(context.isRefresh()){
+ mapper.mapToDTO(dto, in.getCountry(), context);
+ }
+ return dto;
+ }
+
+ context.increaseLevel();
+ dto = mapper.createDto();
+ mapper.mapToDTO(dto, in.getCountry(), context);
+ context.decreaseLevel();
+ return dto;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Maps the property country 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 Country toEntity_country(final AddressDto in, final Address parentEntity, final MappingContext context) {
+ if(in.getCountry() != null) {
+ // find a mapper that knows how to map the concrete input type.
+ org.eclipse.osbp.dsl.dto.lib.IMapper<CountryDto, Country> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<CountryDto, Country>) getToEntityMapper(in.getCountry().getClass(), Country.class);
+ if(mapper == null) {
+ throw new IllegalStateException("Mapper must not be null!");
+ }
+
+ Country entity = null;
+ entity = context.get(mapper.createEntityHash(in.getCountry()));
+ if(entity != null) {
+ return entity;
+ } else {
+ entity = (Country) context
+ .findEntityByEntityManager(Country.class, in.getCountry().getUuid());
+ if (entity != null) {
+ context.register(mapper.createEntityHash(in.getCountry()), entity);
+ return entity;
+ }
+ }
+
+ entity = mapper.createEntity();
+ mapper.mapToEntity(in.getCountry(), entity, context);
+ return entity;
+ } else {
+ return null;
+ }
+ }
+
+ 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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/BaseUUIDDtoMapper.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/BaseUUIDDtoMapper.java
new file mode 100644
index 0000000..9f2e86c
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/BaseUUIDDtoMapper.java
@@ -0,0 +1,141 @@
+package org.eclipse.osbp.runtime.web.sample.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.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto;
+import org.eclipse.osbp.runtime.web.sample.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.setUuid(toDto_uuid(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.setUuid(toEntity_uuid(dto, entity, context));
+ }
+
+ /**
+ * Maps the property uuid 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_uuid(final BaseUUID in, final MappingContext context) {
+ return in.getUuid();
+ }
+
+ /**
+ * Maps the property uuid 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_uuid(final BaseUUIDDto in, final BaseUUID parentEntity, final MappingContext context) {
+ return in.getUuid();
+ }
+
+ 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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/CountryDtoMapper.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/CountryDtoMapper.java
new file mode 100644
index 0000000..c6f3a5a
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/CountryDtoMapper.java
@@ -0,0 +1,153 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.mapper;
+
+import org.eclipse.osbp.dsl.dto.lib.MappingContext;
+import org.eclipse.osbp.runtime.web.sample.dtos.CountryDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper;
+import org.eclipse.osbp.runtime.web.sample.entities.Country;
+
+/**
+ * This class maps the dto {@link CountryDto} to and from the entity {@link Country}.
+ *
+ */
+@SuppressWarnings("all")
+public class CountryDtoMapper<DTO extends CountryDto, ENTITY extends Country> extends BaseUUIDDtoMapper<DTO, ENTITY> {
+ /**
+ * Creates a new instance of the entity
+ */
+ public Country createEntity() {
+ return new Country();
+ }
+
+ /**
+ * Creates a new instance of the dto
+ */
+ public CountryDto createDto() {
+ return new CountryDto();
+ }
+
+ /**
+ * Maps the entity {@link Country} to the dto {@link CountryDto}.
+ *
+ * @param dto - The target dto
+ * @param entity - The source entity
+ * @param context - The context to get information about depth,...
+ *
+ */
+ public void mapToDTO(final CountryDto dto, final Country 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.setIsoCode(toDto_isoCode(entity, context));
+ dto.setEuMember(toDto_euMember(entity, context));
+ }
+
+ /**
+ * Maps the dto {@link CountryDto} to the entity {@link Country}.
+ *
+ * @param dto - The source dto
+ * @param entity - The target entity
+ * @param context - The context to get information about depth,...
+ *
+ */
+ public void mapToEntity(final CountryDto dto, final Country 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.setIsoCode(toEntity_isoCode(dto, entity, context));
+ entity.setEuMember(toEntity_euMember(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 Country 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 CountryDto in, final Country parentEntity, final MappingContext context) {
+ return in.getName();
+ }
+
+ /**
+ * Maps the property isoCode 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_isoCode(final Country in, final MappingContext context) {
+ return in.getIsoCode();
+ }
+
+ /**
+ * Maps the property isoCode 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_isoCode(final CountryDto in, final Country parentEntity, final MappingContext context) {
+ return in.getIsoCode();
+ }
+
+ /**
+ * Maps the property euMember 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_euMember(final Country in, final MappingContext context) {
+ return in.getEuMember();
+ }
+
+ /**
+ * Maps the property euMember 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_euMember(final CountryDto in, final Country parentEntity, final MappingContext context) {
+ return in.getEuMember();
+ }
+
+ public String createDtoHash(final Object in) {
+ return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(CountryDto.class, in);
+ }
+
+ public String createEntityHash(final Object in) {
+ return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Country.class, in);
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/PersonDtoMapper.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/PersonDtoMapper.java
new file mode 100644
index 0000000..4fcd6c8
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/mapper/PersonDtoMapper.java
@@ -0,0 +1,320 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.mapper;
+
+import java.util.Date;
+import org.eclipse.osbp.dsl.dto.lib.MappingContext;
+import org.eclipse.osbp.runtime.web.sample.dtos.AddressDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.Gender;
+import org.eclipse.osbp.runtime.web.sample.dtos.PersonDto;
+import org.eclipse.osbp.runtime.web.sample.dtos.mapper.BaseUUIDDtoMapper;
+import org.eclipse.osbp.runtime.web.sample.entities.Address;
+import org.eclipse.osbp.runtime.web.sample.entities.Person;
+
+/**
+ * This class maps the dto {@link PersonDto} to and from the entity {@link Person}.
+ *
+ */
+@SuppressWarnings("all")
+public class PersonDtoMapper<DTO extends PersonDto, ENTITY extends Person> extends BaseUUIDDtoMapper<DTO, ENTITY> {
+ /**
+ * Creates a new instance of the entity
+ */
+ public Person createEntity() {
+ return new Person();
+ }
+
+ /**
+ * Creates a new instance of the dto
+ */
+ public PersonDto createDto() {
+ return new PersonDto();
+ }
+
+ /**
+ * Maps the entity {@link Person} to the dto {@link PersonDto}.
+ *
+ * @param dto - The target dto
+ * @param entity - The source entity
+ * @param context - The context to get information about depth,...
+ *
+ */
+ public void mapToDTO(final PersonDto dto, final Person 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.setFirstname(toDto_firstname(entity, context));
+ dto.setLastname(toDto_lastname(entity, context));
+ dto.setBirthdate(toDto_birthdate(entity, context));
+ dto.setAge(toDto_age(entity, context));
+ dto.setWeight(toDto_weight(entity, context));
+ dto.setGender(toDto_gender(entity, context));
+ dto.setAddress(toDto_address(entity, context));
+ }
+
+ /**
+ * Maps the dto {@link PersonDto} to the entity {@link Person}.
+ *
+ * @param dto - The source dto
+ * @param entity - The target entity
+ * @param context - The context to get information about depth,...
+ *
+ */
+ public void mapToEntity(final PersonDto dto, final Person 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.setFirstname(toEntity_firstname(dto, entity, context));
+ entity.setLastname(toEntity_lastname(dto, entity, context));
+ entity.setBirthdate(toEntity_birthdate(dto, entity, context));
+ entity.setAge(toEntity_age(dto, entity, context));
+ entity.setWeight(toEntity_weight(dto, entity, context));
+ entity.setGender(toEntity_gender(dto, entity, context));
+ entity.setAddress(toEntity_address(dto, entity, context));
+ }
+
+ /**
+ * Maps the property firstname 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_firstname(final Person in, final MappingContext context) {
+ return in.getFirstname();
+ }
+
+ /**
+ * Maps the property firstname 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_firstname(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ return in.getFirstname();
+ }
+
+ /**
+ * Maps the property lastname 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_lastname(final Person in, final MappingContext context) {
+ return in.getLastname();
+ }
+
+ /**
+ * Maps the property lastname 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_lastname(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ return in.getLastname();
+ }
+
+ /**
+ * 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 Person 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 PersonDto in, final Person parentEntity, final MappingContext context) {
+ return in.getBirthdate();
+ }
+
+ /**
+ * Maps the property age 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_age(final Person in, final MappingContext context) {
+ return in.getAge();
+ }
+
+ /**
+ * Maps the property age 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_age(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ return in.getAge();
+ }
+
+ /**
+ * Maps the property weight 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_weight(final Person in, final MappingContext context) {
+ return in.getWeight();
+ }
+
+ /**
+ * Maps the property weight 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_weight(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ return in.getWeight();
+ }
+
+ /**
+ * 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 Gender toDto_gender(final Person in, final MappingContext context) {
+ if(in.getGender() != null) {
+ return org.eclipse.osbp.runtime.web.sample.dtos.Gender.valueOf(in.getGender().name());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 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 org.eclipse.osbp.runtime.web.sample.entities.Gender toEntity_gender(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ if(in.getGender() != null) {
+ return org.eclipse.osbp.runtime.web.sample.entities.Gender.valueOf(in.getGender().name());
+ } 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 the mapped dto
+ *
+ */
+ protected AddressDto toDto_address(final Person in, final MappingContext context) {
+ if(in.getAddress() != null) {
+ // find a mapper that knows how to map the concrete input type.
+ org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address>) getToDtoMapper(AddressDto.class, in.getAddress().getClass());
+ if(mapper == null) {
+ throw new IllegalStateException("Mapper must not be null!");
+ }
+ AddressDto dto = null;
+ dto = context.get(mapper.createDtoHash(in.getAddress()));
+ if(dto != null) {
+ if(context.isRefresh()){
+ mapper.mapToDTO(dto, in.getAddress(), context);
+ }
+ return dto;
+ }
+
+ context.increaseLevel();
+ dto = mapper.createDto();
+ mapper.mapToDTO(dto, in.getAddress(), context);
+ context.decreaseLevel();
+ return dto;
+ } else {
+ 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 the mapped entity
+ *
+ */
+ protected Address toEntity_address(final PersonDto in, final Person parentEntity, final MappingContext context) {
+ if(in.getAddress() != null) {
+ // find a mapper that knows how to map the concrete input type.
+ org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<AddressDto, Address>) getToEntityMapper(in.getAddress().getClass(), Address.class);
+ if(mapper == null) {
+ throw new IllegalStateException("Mapper must not be null!");
+ }
+
+ Address entity = null;
+ entity = context.get(mapper.createEntityHash(in.getAddress()));
+ if(entity != null) {
+ return entity;
+ } else {
+ entity = (Address) context
+ .findEntityByEntityManager(Address.class, in.getAddress().getUuid());
+ if (entity != null) {
+ context.register(mapper.createEntityHash(in.getAddress()), entity);
+ return entity;
+ }
+ }
+
+ entity = mapper.createEntity();
+ mapper.mapToEntity(in.getAddress(), entity, context);
+ return entity;
+ } else {
+ return null;
+ }
+ }
+
+ public String createDtoHash(final Object in) {
+ return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(PersonDto.class, in);
+ }
+
+ public String createEntityHash(final Object in) {
+ return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Person.class, in);
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/AddressDtoService.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/AddressDtoService.java
new file mode 100644
index 0000000..52523c5
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/AddressDtoService.java
@@ -0,0 +1,25 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.service;
+
+import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOServiceWithMutablePersistence;
+import org.eclipse.osbp.runtime.web.sample.dtos.AddressDto;
+import org.eclipse.osbp.runtime.web.sample.entities.Address;
+
+@SuppressWarnings("all")
+public class AddressDtoService extends AbstractDTOServiceWithMutablePersistence<AddressDto, Address> {
+ public AddressDtoService() {
+ // set the default persistence ID
+ setPersistenceId("sample");
+ }
+
+ public Class<AddressDto> getDtoClass() {
+ return AddressDto.class;
+ }
+
+ public Class<Address> getEntityClass() {
+ return Address.class;
+ }
+
+ public Object getId(final AddressDto dto) {
+ return dto.getUuid();
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/BaseUUIDDtoService.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/BaseUUIDDtoService.java
new file mode 100644
index 0000000..f94839f
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/BaseUUIDDtoService.java
@@ -0,0 +1,20 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.service;
+
+import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService;
+import org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto;
+import org.eclipse.osbp.runtime.web.sample.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.getUuid();
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/CountryDtoService.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/CountryDtoService.java
new file mode 100644
index 0000000..bd0b5a7
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/CountryDtoService.java
@@ -0,0 +1,25 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.service;
+
+import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOServiceWithMutablePersistence;
+import org.eclipse.osbp.runtime.web.sample.dtos.CountryDto;
+import org.eclipse.osbp.runtime.web.sample.entities.Country;
+
+@SuppressWarnings("all")
+public class CountryDtoService extends AbstractDTOServiceWithMutablePersistence<CountryDto, Country> {
+ public CountryDtoService() {
+ // set the default persistence ID
+ setPersistenceId("sample");
+ }
+
+ public Class<CountryDto> getDtoClass() {
+ return CountryDto.class;
+ }
+
+ public Class<Country> getEntityClass() {
+ return Country.class;
+ }
+
+ public Object getId(final CountryDto dto) {
+ return dto.getUuid();
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/PersonDtoService.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/PersonDtoService.java
new file mode 100644
index 0000000..854d3f7
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/dtos/service/PersonDtoService.java
@@ -0,0 +1,25 @@
+package org.eclipse.osbp.runtime.web.sample.dtos.service;
+
+import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOServiceWithMutablePersistence;
+import org.eclipse.osbp.runtime.web.sample.dtos.PersonDto;
+import org.eclipse.osbp.runtime.web.sample.entities.Person;
+
+@SuppressWarnings("all")
+public class PersonDtoService extends AbstractDTOServiceWithMutablePersistence<PersonDto, Person> {
+ public PersonDtoService() {
+ // set the default persistence ID
+ setPersistenceId("sample");
+ }
+
+ public Class<PersonDto> getDtoClass() {
+ return PersonDto.class;
+ }
+
+ public Class<Person> getEntityClass() {
+ return Person.class;
+ }
+
+ public Object getId(final PersonDto dto) {
+ return dto.getUuid();
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Address.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Address.java
new file mode 100644
index 0000000..5b3b671
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Address.java
@@ -0,0 +1,112 @@
+package org.eclipse.osbp.runtime.web.sample.entities;
+
+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.eclipse.osbp.runtime.common.annotations.Filter;
+import org.eclipse.osbp.runtime.web.sample.entities.BaseUUID;
+import org.eclipse.osbp.runtime.web.sample.entities.Country;
+
+@Entity
+@Table(name = "ADDRESS")
+@SuppressWarnings("all")
+public class Address extends BaseUUID implements IEntity {
+ @Column(name = "STREET")
+ @Filter
+ private String street;
+
+ @Column(name = "CITY")
+ @Filter
+ private String city;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "COUNTRY_ID")
+ private Country country;
+
+ /**
+ * 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 street property or <code>null</code> if not present.
+ */
+ public String getStreet() {
+ checkDisposed();
+ return this.street;
+ }
+
+ /**
+ * Sets the street property to this instance.
+ */
+ public void setStreet(final String street) {
+ checkDisposed();
+ this.street = street;
+ }
+
+ /**
+ * @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 country property or <code>null</code> if not present.
+ */
+ public Country getCountry() {
+ checkDisposed();
+ return this.country;
+ }
+
+ /**
+ * Sets the country property to this instance.
+ */
+ public void setCountry(final Country country) {
+ checkDisposed();
+ this.country = country;
+ }
+
+ /**
+ * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException
+ */
+ @PreRemove
+ protected void preRemove() {
+
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/BaseUUID.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/BaseUUID.java
new file mode 100644
index 0000000..e4e1edb
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/BaseUUID.java
@@ -0,0 +1,104 @@
+package org.eclipse.osbp.runtime.web.sample.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 uuid = 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 uuid property or <code>null</code> if not present.
+ */
+ public String getUuid() {
+ checkDisposed();
+ return this.uuid;
+ }
+
+ /**
+ * Sets the uuid property to this instance.
+ */
+ public void setUuid(final String uuid) {
+ checkDisposed();
+ this.uuid = uuid;
+ }
+
+ @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.uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!this.uuid.equals(other.uuid))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.uuid== null) ? 0 : this.uuid.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.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Country.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Country.java
new file mode 100644
index 0000000..be2171e
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Country.java
@@ -0,0 +1,108 @@
+package org.eclipse.osbp.runtime.web.sample.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.Filter;
+import org.eclipse.osbp.runtime.web.sample.entities.BaseUUID;
+
+@Entity
+@Table(name = "COUNTRY")
+@SuppressWarnings("all")
+public class Country extends BaseUUID implements IEntity {
+ @Column(name = "NAME")
+ @Filter
+ private String name;
+
+ @Column(name = "ISO_CODE")
+ @Filter
+ private String isoCode;
+
+ @Column(name = "EU_MEMBER")
+ @Filter
+ private boolean euMember;
+
+ /**
+ * 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 isoCode property or <code>null</code> if not present.
+ */
+ public String getIsoCode() {
+ checkDisposed();
+ return this.isoCode;
+ }
+
+ /**
+ * Sets the isoCode property to this instance.
+ */
+ public void setIsoCode(final String isoCode) {
+ checkDisposed();
+ this.isoCode = isoCode;
+ }
+
+ /**
+ * @return Returns the euMember property or <code>null</code> if not present.
+ */
+ public boolean getEuMember() {
+ checkDisposed();
+ return this.euMember;
+ }
+
+ /**
+ * Sets the euMember property to this instance.
+ */
+ public void setEuMember(final boolean euMember) {
+ checkDisposed();
+ this.euMember = euMember;
+ }
+
+ /**
+ * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException
+ */
+ @PreRemove
+ protected void preRemove() {
+
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Gender.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Gender.java
new file mode 100644
index 0000000..7d7673e
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Gender.java
@@ -0,0 +1,8 @@
+package org.eclipse.osbp.runtime.web.sample.entities;
+
+@SuppressWarnings("all")
+public enum Gender {
+ MALE,
+
+ FEMALE;
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Person.java b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Person.java
new file mode 100644
index 0000000..5a5e9d1
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src-gen/org/eclipse/osbp/runtime/web/sample/entities/Person.java
@@ -0,0 +1,199 @@
+package org.eclipse.osbp.runtime.web.sample.entities;
+
+import java.util.Date;
+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.Filter;
+import org.eclipse.osbp.runtime.common.annotations.Range;
+import org.eclipse.osbp.runtime.web.sample.entities.Address;
+import org.eclipse.osbp.runtime.web.sample.entities.BaseUUID;
+import org.eclipse.osbp.runtime.web.sample.entities.Gender;
+
+@Entity
+@Table(name = "PERSON")
+@SuppressWarnings("all")
+public class Person extends BaseUUID implements IEntity {
+ @Column(name = "FIRSTNAME")
+ @Filter
+ private String firstname;
+
+ @Column(name = "LASTNAME")
+ @Range
+ private String lastname;
+
+ @Column(name = "BIRTHDATE")
+ @Temporal(value = TemporalType.DATE)
+ @Filter
+ @Valid
+ private Date birthdate;
+
+ @Column(name = "AGE")
+ @Filter
+ private int age;
+
+ @Column(name = "WEIGHT")
+ @Range
+ private double weight;
+
+ @Column(name = "GENDER")
+ private Gender gender;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "ADDRESS_ID")
+ private Address address;
+
+ /**
+ * 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 firstname property or <code>null</code> if not present.
+ */
+ public String getFirstname() {
+ checkDisposed();
+ return this.firstname;
+ }
+
+ /**
+ * Sets the firstname property to this instance.
+ */
+ public void setFirstname(final String firstname) {
+ checkDisposed();
+ this.firstname = firstname;
+ }
+
+ /**
+ * @return Returns the lastname property or <code>null</code> if not present.
+ */
+ public String getLastname() {
+ checkDisposed();
+ return this.lastname;
+ }
+
+ /**
+ * Sets the lastname property to this instance.
+ */
+ public void setLastname(final String lastname) {
+ checkDisposed();
+ this.lastname = lastname;
+ }
+
+ /**
+ * @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 age property or <code>null</code> if not present.
+ */
+ public int getAge() {
+ checkDisposed();
+ return this.age;
+ }
+
+ /**
+ * Sets the age property to this instance.
+ */
+ public void setAge(final int age) {
+ checkDisposed();
+ this.age = age;
+ }
+
+ /**
+ * @return Returns the weight property or <code>null</code> if not present.
+ */
+ public double getWeight() {
+ checkDisposed();
+ return this.weight;
+ }
+
+ /**
+ * Sets the weight property to this instance.
+ */
+ public void setWeight(final double weight) {
+ checkDisposed();
+ this.weight = weight;
+ }
+
+ /**
+ * @return Returns the gender property or <code>null</code> if not present.
+ */
+ public Gender getGender() {
+ checkDisposed();
+ return this.gender;
+ }
+
+ /**
+ * Sets the gender property to this instance.
+ */
+ public void setGender(final Gender gender) {
+ checkDisposed();
+ this.gender = gender;
+ }
+
+ /**
+ * @return Returns the address property or <code>null</code> if not present.
+ */
+ public Address getAddress() {
+ checkDisposed();
+ return this.address;
+ }
+
+ /**
+ * Sets the address property to this instance.
+ */
+ public void setAddress(final Address address) {
+ checkDisposed();
+ this.address = address;
+ }
+
+ /**
+ * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException
+ */
+ @PreRemove
+ protected void preRemove() {
+
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/META-INF/persistence.xml b/org.eclipse.osbp.ecview.extension.samples/src/META-INF/persistence.xml
new file mode 100644
index 0000000..5250ba3
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/META-INF/persistence.xml
@@ -0,0 +1,30 @@
+<?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="sample"
+ transaction-type="RESOURCE_LOCAL">
+
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.BaseUUID</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Person</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Address</class>
+ <class>org.eclipse.osbp.runtime.web.sample.entities.Country</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.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/Activator.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/Activator.java
new file mode 100644
index 0000000..aa2b6c0
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/Activator.java
@@ -0,0 +1,150 @@
+/**
+ * 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
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.sample;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+/**
+ * Activator is used by OSGi framework to notify about the start and stop of the
+ * bundle. The activator will look for the HttpService and registers the vaadin
+ * servlet at it.
+ */
+public class Activator implements BundleActivator, ServiceTrackerCustomizer<HttpService, HttpService>, BundleListener {
+
+ public static final String URI_ALIAS = "/";
+ private static BundleContext context;
+ private static Activator instance;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns all registered test base bundles.
+ *
+ * @return
+ */
+ public static List<Bundle> getTestBaseBundles() {
+ return new ArrayList<Bundle>(instance.testBases);
+ }
+
+ // used to track the HttpService
+ private ServiceTracker<HttpService, HttpService> tracker;
+ // used to register servlets
+ private HttpService httpService;
+ private ResourceProvider resourceProvider;
+ private List<Bundle> testBases = new ArrayList<Bundle>();
+
+ //
+ // Helper methods to get an instance of the http service
+ //
+ @Override
+ public HttpService addingService(ServiceReference<HttpService> reference) {
+ httpService = context.getService(reference);
+
+ try {
+ // register the servlet at the http service
+ httpService.registerServlet(URI_ALIAS, new SampleVaadinServlet(), null, resourceProvider);
+ } catch (ServletException e) {
+ e.printStackTrace();
+ } catch (NamespaceException e) {
+ e.printStackTrace();
+ }
+
+ return httpService;
+ }
+
+ @Override
+ public void removedService(ServiceReference<HttpService> reference, HttpService service) {
+ // unregister the servlet from the http service
+ httpService.unregister("URI_ALIAS");
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<HttpService> reference, HttpService service) {
+
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ instance = this;
+
+ resourceProvider = new ResourceProvider();
+
+ handleStartedBundles(context);
+
+ // register this instance as a bundle listener to an reference to all
+ // vaadin bundles. Used to find the static resources.
+ bundleContext.addBundleListener(this);
+
+ // Start a HttpService-Tracker to get an instance of HttpService
+ tracker = new ServiceTracker<HttpService, HttpService>(bundleContext, HttpService.class, this);
+ tracker.open();
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // close the HttpService-tracker
+ tracker.close();
+ tracker = null;
+
+ resourceProvider = null;
+
+ bundleContext.removeBundleListener(this);
+
+ instance = null;
+ Activator.context = null;
+ }
+
+ /**
+ * Tries to find proper started bundles and adds them to resource provider.
+ * Since bundle changed listener will not find them.
+ *
+ * @param context
+ */
+ protected void handleStartedBundles(BundleContext context) {
+ for (Bundle bundle : context.getBundles()) {
+ String name = bundle.getSymbolicName();
+ if (bundle.getState() == Bundle.ACTIVE
+ && (name.startsWith("com.vaadin") || name.startsWith("org.eclipse.osbp.runtime.web.sample"))) {
+ resourceProvider.add(bundle);
+ }
+ }
+ }
+
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ // tracks the starting and stopping of vaadin bundles. If a bundle is a
+ // vaadin bundle it will be added to the resource provider for lookups.
+ String name = event.getBundle().getSymbolicName();
+ if (name.startsWith("com.vaadin") || name.startsWith("org.eclipse.osbp.runtime.web.sample")) {
+ if (event.getType() == BundleEvent.STARTED) {
+ resourceProvider.add(event.getBundle());
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ resourceProvider.remove(event.getBundle());
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUI.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUI.java
new file mode 100644
index 0000000..29595c4
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUI.java
@@ -0,0 +1,44 @@
+/**
+ * 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
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.sample;
+
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.FilteringComponentEmbeddable;
+import org.eclipse.osbp.runtime.web.sample.dtos.PersonDto;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.themes.ValoTheme;
+
+@SuppressWarnings("serial")
+@Theme(ValoTheme.THEME_NAME)
+public class ECViewSampleUI extends UI {
+
+ private CssLayout content = new CssLayout();
+
+ @Override
+ protected void init(VaadinRequest request) {
+ setContent(content);
+ content.setSizeFull();
+
+ FilteringComponentEmbeddable<PersonDto> comp = new FilteringComponentEmbeddable<>(PersonDto.class, 3);
+ comp.setSizeFull();
+ content.addComponent(comp);
+
+ comp.init(getLocale());
+
+ comp.setAcceptCallback(p -> {
+ System.out.println(p);
+ });
+
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUINative.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUINative.java
new file mode 100644
index 0000000..1bc9104
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ECViewSampleUINative.java
@@ -0,0 +1,104 @@
+/**
+ * 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
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.sample;
+
+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.YFilteringComponent;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YFilteringType;
+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.eclipse.osbp.runtime.web.sample.dtos.PersonDto;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.themes.ValoTheme;
+
+@SuppressWarnings("serial")
+@Theme(ValoTheme.THEME_NAME)
+public class ECViewSampleUINative extends UI {
+
+ private CssLayout content = new CssLayout();
+
+ // private DeepResolvingBeanItemContainer<Person> container;
+ // private FiltersComponent filtersComp;
+ private IViewContext viewContext;
+
+ CoreModelFactory coreModelFactory = CoreModelFactory.eINSTANCE;
+ ExtensionModelFactory modelFactory = ExtensionModelFactory.eINSTANCE;
+
+ @Override
+ protected void init(VaadinRequest request) {
+ setContent(content);
+
+ content.setWidth("800px");
+ content.setHeight("100%");
+
+ YView yView = createViewModel();
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ viewContext = renderer.render(content, yView, null);
+ } catch (ContextException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ private YView createViewModel() {
+
+ YView view = coreModelFactory.createYView();
+ YVerticalLayout content = modelFactory.createYVerticalLayout();
+ view.setContent(content);
+
+ YFilteringComponent comp = modelFactory.createYFilteringComponent();
+ content.getElements().add(comp);
+ YVerticalLayoutCellStyle cellStyle = content.addCellStyle(comp);
+ cellStyle.setAlignment(YAlignment.FILL_FILL);
+
+ // ALTERNATIVE 1
+ //
+ ECViewUtil.fill(PersonDto.class, 3, comp);
+
+ // ALTERNATIVE 2
+ //
+// comp.setType(PersonDto.class);
+// comp.setTypeQualifiedName(PersonDto.class.getCanonicalName());
+// comp.addFilterDescriptor(YFilteringType.RANGE, "firstname");
+// comp.addFilterDescriptor(YFilteringType.COMPARE, "lastname");
+// comp.addFilterDescriptor(YFilteringType.RANGE, "birthdate");
+// comp.addFilterDescriptor(YFilteringType.RANGE, "weight");
+// comp.addFilterDescriptor(YFilteringType.COMPARE, "age");
+// comp.addFilterDescriptor(YFilteringType.RANGE, "address.street");
+// comp.addFilterDescriptor(YFilteringType.COMPARE, "address.city");
+// comp.addFilterDescriptor(YFilteringType.RANGE, "address.country.name");
+// comp.addFilterDescriptor(YFilteringType.COMPARE, "address.country.isoCode");
+// comp.addFilterDescriptor(YFilteringType.COMPARE, "address.country.euMember");
+//
+// comp.addTableDescriptor("firstname");
+// comp.addTableDescriptor("birthdate");
+// comp.addTableDescriptor("weight");
+// comp.addTableDescriptor("age");
+// comp.addTableDescriptor("address.street");
+// comp.addTableDescriptor("address.country.name");
+// comp.addTableDescriptor("address.country.euMember");
+
+ return view;
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/JPAStartup.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/JPAStartup.java
new file mode 100644
index 0000000..e99db7c
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/JPAStartup.java
@@ -0,0 +1,150 @@
+/**
+ * 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.web.sample;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+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.osbp.runtime.web.sample.entities.Address;
+import org.eclipse.osbp.runtime.web.sample.entities.Country;
+import org.eclipse.osbp.runtime.web.sample.entities.Person;
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+
+@Component(immediate = true)
+public class JPAStartup {
+
+ private Country country_AT;
+ private Country country_DE;
+ private Country country_CH;
+ private Address vienna;
+ private Address berlin;
+ private Address zurich;
+ private Person person_V;
+ private Person person_B;
+ private Person person_Z;
+
+ protected Map<String, Object> properties = new HashMap<String, Object>();
+ protected EntityManagerFactory emf;
+
+ @Activate
+ public void activate() 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("sample", properties);
+ Bundle bundle = FrameworkUtil.getBundle(JPAStartup.class);
+
+ Dictionary<String, Object> props = new Hashtable<>();
+ props.put("osgi.unit.name", "sample");
+ bundle.getBundleContext().registerService(EntityManagerFactory.class, emf, props);
+
+ initData();
+
+ }
+
+ private void initData() {
+
+ EntityManager em = emf.createEntityManager();
+
+ em.getTransaction().begin();
+
+ country_AT = createCountry("Austria", "AT", true);
+ country_DE = createCountry("Germany", "DE", true);
+ country_CH = createCountry("Switzerland", "CH", false);
+
+ vienna = createAddress("Stephansplatz", "Vienna", country_AT);
+ berlin = createAddress("Somewhere", "Berlin", country_DE);
+ zurich = createAddress("Am See", "Zürich", country_CH);
+
+ person_V = createPerson("Florian", "Pirchner", toDate("1978-10-14"), 61.234, 30, vienna);
+ person_B = createPerson("Klemens", "Edler", toDate("1978-02-28"), 83.912, 40, berlin);
+ person_Z = createPerson("Jörg", "Riegel", toDate("1969-07-03"), 72.456, 50, zurich);
+
+ em.persist(country_AT);
+ em.persist(country_DE);
+ em.persist(country_CH);
+
+ em.persist(vienna);
+ em.persist(berlin);
+ em.persist(zurich);
+
+ em.persist(person_V);
+ em.persist(person_B);
+ em.persist(person_Z);
+
+ em.getTransaction().commit();
+ }
+
+ private Date toDate(String string) {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ try {
+ return df.parse(string);
+ } catch (ParseException e) {
+ }
+ return null;
+ }
+
+ Country createCountry(String name, String isoCode, boolean euMember) {
+ Country c = new Country();
+ c.setName(name);
+ c.setIsoCode(isoCode);
+ c.setEuMember(euMember);
+ return c;
+ }
+
+ Address createAddress(String street, String city, Country country) {
+ Address a = new Address();
+ a.setStreet(street);
+ a.setCity(city);
+ a.setCountry(country);
+ return a;
+ }
+
+ Person createPerson(String firstname, String lastname, Date birthdate, double weight, int age, Address address) {
+ Person a = new Person();
+ a.setFirstname(firstname);
+ a.setLastname(lastname);
+ a.setBirthdate(birthdate);
+ a.setWeight(weight);
+ a.setAge(age);
+ a.setAddress(address);
+ return a;
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ResourceProvider.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ResourceProvider.java
new file mode 100644
index 0000000..113a699
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/ResourceProvider.java
@@ -0,0 +1,76 @@
+/**
+ * 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
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.sample;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * Resource provider is responsible to look for resources requested by the
+ * HttpService. Therefore it uses the classpath of registered bundles.
+ */
+public class ResourceProvider implements HttpContext {
+
+ private List<Bundle> resources = new ArrayList<Bundle>();
+
+ @Override
+ public URL getResource(String uri) {
+ URL resource = null;
+ // iterate over the vaadin bundles and try to find the requested
+ // resource
+ for (Bundle bundle : resources) {
+ resource = bundle.getResource(uri);
+ if (resource != null) {
+ break;
+ }
+ }
+ return resource;
+ }
+
+ /**
+ * Adds a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void add(Bundle bundle) {
+ if(!resources.contains(bundle)){
+ resources.add(bundle);
+ }
+ }
+
+ /**
+ * Removes a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void remove(Bundle bundle) {
+ resources.remove(bundle);
+ }
+
+ @Override
+ public String getMimeType(String arg0) {
+ return null;
+ }
+
+ @Override
+ public boolean handleSecurity(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ return true;
+ }
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/SampleVaadinServlet.java b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/SampleVaadinServlet.java
new file mode 100644
index 0000000..d559225
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/SampleVaadinServlet.java
@@ -0,0 +1,49 @@
+/**
+ * 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
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.sample;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+
+/**
+ * An implementation of VaadinServlet that uses SimpleUI as its base UI.
+ */
+@SuppressWarnings("serial")
+@VaadinServletConfiguration(ui = ECViewSampleUI.class, productionMode = false)
+public class SampleVaadinServlet extends VaadinServlet {
+
+ @Override
+ protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ ServletService service = new ServletService(this, deploymentConfiguration);
+ service.init();
+ return service;
+ }
+
+ public static class ServletService extends VaadinServletService {
+
+ public ServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ super(servlet, deploymentConfiguration);
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ // return the bundle classloader
+ // see http://dev.vaadin.com/ticket/15516
+ return ServletService.class.getClassLoader();
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.dto b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.dto
new file mode 100644
index 0000000..567fba8
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.dto
@@ -0,0 +1,43 @@
+
+import ns org.eclipse.osbp.runtime.web.sample.entities.BaseUUID
+import ns org.eclipse.osbp.runtime.web.sample.entities.Person
+import ns org.eclipse.osbp.runtime.web.sample.entities.Address
+import ns org.eclipse.osbp.runtime.web.sample.entities.Country
+import ns org.eclipse.osbp.runtime.web.sample.entities.Gender
+package org.eclipse.osbp.runtime.web.sample.dtos {
+
+ autoDto BaseUUIDDto wraps BaseUUID {
+
+ inheritVar ^uuid
+ }
+
+ autoDto PersonDto extends BaseUUIDDto wraps Person {
+
+ inheritVar firstname
+ inheritVar lastname
+ inheritVar birthdate
+ inheritVar age
+ inheritVar weight
+ inheritVar gender
+ inheritRef address mapto AddressDto
+ }
+
+ autoDto AddressDto extends BaseUUIDDto wraps Address {
+
+ inheritVar street
+ inheritVar city
+ inheritRef country mapto CountryDto
+ }
+
+ autoDto CountryDto extends BaseUUIDDto wraps Country {
+
+ inheritVar name
+ inheritVar isoCode
+ inheritVar euMember
+ }
+ enum Gender {
+ MALE,
+
+ FEMALE
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.entity b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.entity
new file mode 100644
index 0000000..cea802c
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.entity
@@ -0,0 +1,43 @@
+package org.eclipse.osbp.runtime.web.sample.entities {
+
+ datatype String jvmType String
+ datatype double jvmType Double asPrimitive
+ datatype int jvmType Integer asPrimitive
+ datatype boolean jvmType Boolean asPrimitive
+ datatype Date dateType date
+
+ mappedSuperclass BaseUUID {
+ persistenceUnit "sample"
+ uuid String uuid
+ }
+
+ entity Person extends BaseUUID {
+ persistenceUnit "sample"
+ var filter String firstname
+ var range String lastname
+ var filter Date birthdate
+ var filter int age
+ var range double weight
+ var Gender gender
+ ref filterDepth 03 Address address
+ }
+
+ entity Address extends BaseUUID {
+ persistenceUnit "sample"
+ var filter String street
+ var filter String city
+ ref filterDepth 03 Country country
+ }
+
+ entity Country extends BaseUUID {
+ persistenceUnit "sample"
+ var filter String name
+ var filter String isoCode
+ var filter boolean euMember
+ }
+
+ enum Gender {
+ MALE, FEMALE
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.service b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.service
new file mode 100644
index 0000000..18e107e
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.samples/src/org/eclipse/osbp/runtime/web/sample/beans/Sample.service
@@ -0,0 +1,23 @@
+
+import ns org.eclipse.osbp.runtime.web.sample.dtos.AddressDto
+import ns org.eclipse.osbp.runtime.web.sample.dtos.BaseUUIDDto
+import ns org.eclipse.osbp.runtime.web.sample.dtos.CountryDto
+import ns org.eclipse.osbp.runtime.web.sample.dtos.PersonDto
+
+package org.eclipse.osbp.runtime.web.sample.dtos.service {
+
+ dtoservice BaseUUIDDtoService provides BaseUUIDDto {
+ }
+
+ dtoservice PersonDtoService provides PersonDto {
+ mutable persistenceUnit sample
+ }
+
+ dtoservice AddressDtoService provides AddressDto {
+ mutable persistenceUnit sample
+ }
+
+ dtoservice CountryDtoService provides CountryDto {
+ mutable persistenceUnit sample
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
index 536ecb2..a6f467f 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
@@ -32,5 +32,6 @@
org.eclipse.osbp.dsl.datatype.lib;bundle-version="[0.9.0,0.10.0)",
org.junit;bundle-version="4.11.0",
org.eclipse.osbp.ui.api;bundle-version="[0.9.0,0.10.0)",
- org.eclipse.osbp.preferences;bundle-version="[0.9.0,0.10.0)"
+ org.eclipse.osbp.preferences;bundle-version="[0.9.0,0.10.0)",
+ org.apache.pdfbox;bundle-version="2.0.6"
Service-Component: OSGI-INF/*.xml
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
index 0cbe04c..00d94e1 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
@@ -88,6 +88,7 @@
import org.eclipse.osbp.ecview.extension.model.YColumnInfo;
import org.eclipse.osbp.ecview.extension.model.YCustomDecimalField;
import org.eclipse.osbp.ecview.extension.model.YECviewFactory;
+import org.eclipse.osbp.ecview.extension.model.YI18nComboBox;
import org.eclipse.osbp.ecview.extension.model.YIconComboBox;
import org.eclipse.osbp.ecview.extension.model.YLayoutingInfo;
import org.eclipse.osbp.ecview.extension.model.YMaskedDecimalField;
@@ -107,6 +108,7 @@
import org.eclipse.osbp.ecview.extension.model.visibility.YSubTypeVisibilityProcessor;
import org.eclipse.osbp.ecview.extension.model.visibility.YVisibilityFactory;
import org.eclipse.osbp.ecview.extension.strategy.util.NamingConventionsUtil;
+import org.eclipse.osbp.ecview.extension.strategy.util.PdfPrintService;
import org.eclipse.osbp.preferences.ProductConfiguration;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
import org.eclipse.osbp.ui.api.themes.EnumCssClass;
@@ -483,8 +485,12 @@
yEmbeddable = createOrganizationCombo(ySuspect);
} else if (ySuspect.getTags().contains(TAG__PERSPECTIVE_COMBO)) {
yEmbeddable = createPerspectiveCombo(ySuspect);
+ } else if (ySuspect.getTags().contains(TAG__PRINTSERVICE_COMBO)) {
+ yEmbeddable = createPrintServiceCombo(ySuspect);
} else if (ySuspect.getTags().contains(TAG__THEME_COMBO)) {
yEmbeddable = createThemeCombo(ySuspect);
+ } else if (ySuspect.getTags().contains(TAG__I18N_COMBO)) {
+ yEmbeddable = createI18nCombo(ySuspect);
} else if (ySuspect.getTags().contains(TAG__IMAGE_PICKER)) {
yEmbeddable = createIconComboBox(ySuspect);
} else if (ySuspect.getTags().contains(TAG__SUBTYPES_ROOT)) {
@@ -984,6 +990,46 @@
return yEmbeddable;
}
+ /**
+ * Creates the print service combo box inclosing print services.
+ *
+ * @param ySuspect
+ * the y suspect
+ * @return the y embeddable
+ */
+ private YEmbeddable createPrintServiceCombo(YSuspect ySuspect) {
+ YEmbeddable yEmbeddable;
+ yEmbeddable = ExtensionModelFactory.eINSTANCE.createYComboBox();
+ YComboBox yCombo = (YComboBox) yEmbeddable;
+ yCombo.setUseBeanService(false);
+ yCombo.setType(String.class);
+ yCombo.setTypeQualifiedName(String.class.getCanonicalName());
+ yCombo.setModelSelectionType(String.class);
+ yCombo.setModelSelectionTypeQualifiedName(String.class.getCanonicalName());
+ yCombo.getCollection().addAll(PdfPrintService.reLookupPrintServiceNames());
+ return yEmbeddable;
+ }
+
+ /**
+ * Creates the i18n combo box inclosing the available languages.
+ *
+ * @param ySuspect
+ * the y suspect
+ * @return the y embeddable
+ */
+ private YEmbeddable createI18nCombo(YSuspect ySuspect) {
+ YEmbeddable yEmbeddable;
+ yEmbeddable = YECviewFactory.eINSTANCE.createYI18nComboBox();
+ YI18nComboBox yCombo = (YI18nComboBox) yEmbeddable;
+// yCombo.setUseBeanService(false);
+ yCombo.setType(String.class);
+ yCombo.setTypeQualifiedName(String.class.getCanonicalName());
+// yCombo.setModelSelectionType(String.class);
+// yCombo.setModelSelectionTypeQualifiedName(String.class.getCanonicalName());
+
+ return yEmbeddable;
+ }
+
private Collection<String> getOrganizationPositionNames(String organizationName) {
IOrganizationService organizationService = ServiceListener.getOrganizationService();
// In case of the open source solution a organization service is not
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/NotExistingPrintServiceNameException.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/NotExistingPrintServiceNameException.java
new file mode 100644
index 0000000..2a53e10
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/NotExistingPrintServiceNameException.java
@@ -0,0 +1,16 @@
+package org.eclipse.osbp.ecview.extension.strategy.util;
+
+public class NotExistingPrintServiceNameException extends NullPointerException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -277910182260901288L;
+
+ public NotExistingPrintServiceNameException() {
+ super("The print service name is null!");
+ }
+
+
+
+}
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/PdfPrintService.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/PdfPrintService.java
new file mode 100644
index 0000000..a12b982
--- /dev/null
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/util/PdfPrintService.java
@@ -0,0 +1,179 @@
+/**
+ *
+ * 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.ecview.extension.strategy.util;
+
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;
+import org.apache.pdfbox.printing.PDFPageable;
+import org.eclipse.osbp.ui.api.user.IUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handle and use print services available on the web server
+ */
+public class PdfPrintService {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PdfPrintService.class);
+ private static PrintService[] printServices;
+
+ /**
+ * @return the default print service name after re-looking up available print services
+ */
+ public static String reLookupDefaultPrintServiceName() {
+ return reLookupDefaultPrintServiceName(true);
+ }
+
+ /**
+ * @return the default print service name without re-looking up available print services
+ */
+ public static String lookupDefaultPrintServiceName() {
+ return reLookupDefaultPrintServiceName(false);
+ }
+
+ private static String reLookupDefaultPrintServiceName(boolean reLookup) {
+ PrintService[] pss = reLookupPrintServices(reLookup);
+ if (pss.length > 0) {
+ return pss[0].getName();
+ }
+ return null;
+ }
+
+ /**
+ * @return the sorted list of available print service names after re-looking up available print services
+ */
+ public static Set<String> reLookupPrintServiceNames() {
+ return reLookupDefaultPrintServiceNames(true);
+ }
+
+ /**
+ * @return the sorted list of available print service names without re-looking up available print services
+ */
+ public static Set<String> lookupPrintServiceNames() {
+ return reLookupDefaultPrintServiceNames(false);
+ }
+
+ private static Set<String> reLookupDefaultPrintServiceNames(boolean reLookup) {
+ Set<String> psn = new TreeSet<>();
+ PrintService[] pss = reLookupPrintServices(reLookup);
+ if (pss.length > 0) {
+ for (PrintService ps : pss) {
+ psn.add(ps.getName());
+ }
+ }
+ return psn;
+ }
+
+ /**
+ * @return the list of available print services after re-looking up available print services
+ */
+ public static PrintService[] reLookupPrintServices() {
+ return reLookupPrintServices(true);
+ }
+
+ /**
+ * @return the list of available print services without re-looking up available print services
+ */
+ public static PrintService[] lookupPrintServices() {
+ return reLookupPrintServices(false);
+ }
+
+ private static PrintService[] reLookupPrintServices(boolean reLookup) {
+ if (reLookup || (printServices == null)) {
+ DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
+ PrintRequestAttributeSet patts = new HashPrintRequestAttributeSet();
+ //patts.add(Sides.DUPLEX);
+ printServices = PrintServiceLookup.lookupPrintServices(flavor, patts);
+ }
+ return printServices;
+ }
+
+ /**
+ * @param name the name of the requested print service
+ * @return the print service instance without re-looking up
+ */
+ public static PrintService getPrintService(String name) throws NullPointerException{
+ PrintService[] pss = lookupPrintServices();
+ if (pss.length > 0) {
+ for (PrintService ps : pss) {
+ if (name.equals(ps.getName())) {
+ return ps;
+ }
+ }
+ }
+ return pss[0];
+ }
+
+ /**
+ * @param pdfInputStream the input stream containing the pdf
+ * @param printServiceName the name of the printer service to be used to print, or <code>PdfPrintService.DEFAULT_PRINTER</code>
+ */
+ public static void printReportAsPdf(InputStream pdfInputStream, String printServiceName) {
+ printObjectAsPdf(pdfInputStream, printServiceName);
+ }
+
+ /**
+ * @param pdfInputStream the input stream containing the pdf
+ * @param printServiceName the name of the printer service to be used to print, or <code>PdfPrintService.DEFAULT_PRINTER</code>
+ */
+ public static void printReportAsPdf(File pdfFile, String printServiceName) {
+ printObjectAsPdf(pdfFile, printServiceName);
+ }
+
+ /**
+ * @param pdfInputStream the input stream containing the pdf
+ * @param printServiceName the name of the printer service to be used to print, or <code>PdfPrintService.DEFAULT_PRINTER</code>
+ */
+ private static void printObjectAsPdf(Object object, String printServiceName) throws NotExistingPrintServiceNameException {
+ try {
+ PrintService printService = getPrintService(printServiceName);
+ if (printService != null) {
+ PDDocument document = getPDDocument(object);
+ if (document != null) {
+ PrinterJob job = PrinterJob.getPrinterJob();
+ job.setPageable(new PDFPageable(document));
+ job.setPrintService(printService);
+ job.print();
+ }
+ }
+ } catch (NullPointerException e) {
+ NotExistingPrintServiceNameException nepse = new NotExistingPrintServiceNameException();
+ LOGGER.error(nepse.getMessage() + printServiceName, new NotExistingPrintServiceNameException());
+ } catch (Exception e) {
+ LOGGER.error("error while printing pdf file to " + printServiceName, e);
+ }
+ }
+
+ private static PDDocument getPDDocument(Object object) throws InvalidPasswordException, IOException {
+ if (object instanceof File){
+ return PDDocument.load((File)object);
+ } else if (object instanceof InputStream){
+ return PDDocument.load((InputStream)object);
+ }
+ return null;
+ }
+}