adjusted legal info, new filter, historized
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/DtoUtils.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/DtoUtils.java
index 3895173..d843a02 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/DtoUtils.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/DtoUtils.java
@@ -212,6 +212,16 @@
}
/**
+ * Gets the historized current field. Field annotated with {@link HistIsCurrent}.
+ * @param clazz the class
+ * @return the histCurrent field
+ */
+ public static Field getHistCurrentField(Class<?> clazz) {
+ Info info = getInfo(clazz);
+ return info.getHistCurrentField();
+ }
+
+ /**
* Returns the id field. Field annotated with {@link Id}.
*
* @param dto
@@ -339,6 +349,17 @@
}
}
+ public static Boolean isHistCurrent(Object dto) {
+ Info info = getInfo(dto.getClass());
+ Field f = info.getHistCurrentField();
+ f.setAccessible(true);
+ try {
+ return (Boolean) f.get(dto);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
public static List<Field> getAllFields(Class<?> clazz) {
if (clazz == null) {
return null;
@@ -878,6 +899,9 @@
if (field.getAnnotation(UpdateBy.class) != null) {
info.updateByField = field;
}
+ if (field.getAnnotation(HistIsCurrent.class) != null) {
+ info.histCurrentField = field;
+ }
if (field.getAnnotation(DomainReference.class) != null) {
if (field.getType().isAssignableFrom(List.class)) {
@@ -1025,6 +1049,8 @@
public Field createByField;
public Field createAtField;
+
+ public Field histCurrentField;
/** The property change support field. */
private Field propertyChangeSupportField;
@@ -1189,6 +1215,10 @@
public Field getCreateAtField() {
return createAtField;
}
+
+ public Field getHistCurrentField() {
+ return histCurrentField;
+ }
}
public static class CompoundHistIdInfo {
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/ExtraStyle.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/ExtraStyle.java
new file mode 100644
index 0000000..5187cc6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/ExtraStyle.java
@@ -0,0 +1,21 @@
+package org.eclipse.osbp.runtime.common.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/*
+ * This annotation adds an extra style to a field derived from the annotated entity attribute
+ */
+@Retention(RUNTIME)
+@Target(FIELD)
+public @interface ExtraStyle {
+ /**
+ * The name of the style.
+ *
+ * @return
+ */
+ String name();
+}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/HistDomainKey.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/HistDomainKey.java
new file mode 100644
index 0000000..c024477
--- /dev/null
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/annotations/HistDomainKey.java
@@ -0,0 +1,18 @@
+package org.eclipse.osbp.runtime.common.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a field to keep the historized domainkey.
+ * <p>
+ * Eg. {domainkey} + " - " + {validFrom as Date}. The domainkey will be updated
+ * automatically bei listeners.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HistDomainKey {
+
+}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/event/SelectionStore.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/event/SelectionStore.java
index 2f8e5d2..65f3aca 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/event/SelectionStore.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/event/SelectionStore.java
@@ -1,6 +1,8 @@
package org.eclipse.osbp.runtime.common.event;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -25,6 +27,75 @@
}
return null;
}
+
+ @SuppressWarnings("unchecked")
+ private void addSelection(String fqn, Object id) {
+ if(!selections.containsKey(fqn) || !(selections.get(fqn) instanceof List<?>)) {
+ selections.put(fqn, new ArrayList<Object>());
+ }
+ ((List<Object>)selections.get(fqn)).add(id);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void removeSelection(String fqn, Object id) {
+ if(selections.containsKey(fqn) && selections.get(fqn) instanceof List<?>) {
+ ((List<Object>)selections.get(fqn)).remove(id);
+ if(((List<Object>)selections.get(fqn)).isEmpty()) {
+ selections.remove(fqn);
+ }
+ }
+ }
+
+ private static IEclipseContext getContext(MPart part) {
+ MUIElement element = part;
+ while(element != null && !(element instanceof MPerspective)) {
+ element = element.getParent();
+ }
+ if(element != null) {
+ return ((MPerspective)element).getContext();
+ }
+ return null;
+ }
+
+ /**
+ * Adds a selection to perspective context.
+ *
+ * @param part the part
+ * @param fqn the fqn
+ * @param id the id
+ * @return true, if successful
+ */
+ public static boolean addSelectionToPerspectiveContext(MPart part, String fqn, Object id) {
+ IEclipseContext context = getContext(part);
+ if(context != null) {
+ if(context.get(SelectionStore.class) == null) {
+ context.set(SelectionStore.class, new SelectionStore());
+ }
+ context.get(SelectionStore.class).addSelection(fqn, id);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Removes a selection from perspective context.
+ *
+ * @param part the part
+ * @param fqn the fqn
+ * @param id the id
+ * @return true, if successful
+ */
+ public static boolean removeSelectionFromPerspectiveContext(MPart part, String fqn, Object id) {
+ IEclipseContext context = getContext(part);
+ if(context != null) {
+ if(context.get(SelectionStore.class) == null) {
+ context.set(SelectionStore.class, new SelectionStore());
+ }
+ context.get(SelectionStore.class).removeSelection(fqn, id);
+ return true;
+ }
+ return false;
+ }
/**
* Store a selection by id to perspective context.
@@ -34,12 +105,8 @@
* @return true, if successful
*/
public static boolean putSelectionToPerspectiveContext(MPart part, String key, Object value) {
- MUIElement element = part;
- while(element != null && !(element instanceof MPerspective)) {
- element = element.getParent();
- }
- if(element != null) {
- IEclipseContext context = ((MPerspective)element).getContext();
+ IEclipseContext context = getContext(part);
+ if(context != null) {
if(context.get(SelectionStore.class) == null) {
context.set(SelectionStore.class, new SelectionStore());
}
@@ -56,12 +123,8 @@
* @return the selected id object from perspective context
*/
public static Object getSelectionFromPerspectiveContext(MPart part, String key) {
- MUIElement element = part;
- while(element != null && !(element instanceof MPerspective)) {
- element = element.getParent();
- }
- if(element != null) {
- IEclipseContext context = ((MPerspective)element).getContext();
+ IEclipseContext context = getContext(part);
+ if(context != null) {
if(context.get(SelectionStore.class) != null) {
return context.get(SelectionStore.class).getSelection(key);
}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOHistorizedService.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOHistorizedService.java
new file mode 100644
index 0000000..8616817
--- /dev/null
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOHistorizedService.java
@@ -0,0 +1,5 @@
+package org.eclipse.osbp.runtime.common.filter;
+
+public interface IDTOHistorizedService<A> extends IDTOService<A> {
+
+}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOService.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOService.java
index d663517..579f90c 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOService.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOService.java
@@ -17,6 +17,7 @@
import java.util.Map;
import java.util.Set;
+import javax.persistence.EntityManagerFactory;
import javax.persistence.LockModeType;
import org.eclipse.osbp.runtime.common.validation.IStatus;
@@ -34,6 +35,20 @@
public static final int PROP_MAX_COLLECTION_CONTENT = 100000;
/**
+ * Checks if historized filter is ignored.
+ *
+ * @return true, if ignore historized filter
+ */
+ boolean isIgnoreHistorizedFilter();
+
+ /**
+ * Sets the historized filter to be ignored.
+ *
+ * @param ignoreHistorizedFilter the new ignore historized filter
+ */
+ void setIgnoreHistorizedFilter(boolean ignoreHistorizedFilter);
+
+ /**
* Returns the dto for the given id.
*
* @param id
@@ -340,4 +355,21 @@
* @return the id
*/
Object getId(A dto);
+
+ /**
+ * Returns the persistence Id which is used to find the proper
+ * {@link EntityManagerFactory},
+ *
+ * @return
+ */
+ String getPersistenceId();
+
+ /**
+ * Sets the persistence Id which is used to find the proper
+ * {@link EntityManagerFactory},
+ *
+ * @param persistenceId
+ */
+ void setPersistenceId(String persistenceId);
+
}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOServiceWithMutablePersistence.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOServiceWithMutablePersistence.java
deleted file mode 100644
index 334ab5f..0000000
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/filter/IDTOServiceWithMutablePersistence.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Pirchner - Initial implementation
- */
-package org.eclipse.osbp.runtime.common.filter;
-
-import javax.persistence.EntityManagerFactory;
-
-/**
- * This DTO service allows to specify a deviating persistence ID.
- *
- * @param <A>
- */
-public interface IDTOServiceWithMutablePersistence<A> extends IDTOService<A> {
-
- /**
- * Returns the persistence Id which is used to find the proper
- * {@link EntityManagerFactory},
- *
- * @return
- */
- String getPersistenceId();
-
- /**
- * Sets the persistence Id which is used to find the proper
- * {@link EntityManagerFactory},
- *
- * @param persistenceId
- */
- void setPersistenceId(String persistenceId);
-
-}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/historized/UUIDHist.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/historized/UUIDHist.java
index 280c081..0603951 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/historized/UUIDHist.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/historized/UUIDHist.java
@@ -4,6 +4,7 @@
import java.util.Date;
import java.util.UUID;
+import javax.persistence.Column;
import javax.persistence.Embeddable;
import org.eclipse.osbp.runtime.common.annotations.HistUUID;
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/ISession.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/ISession.java
index 96db123..2e189f1 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/ISession.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/ISession.java
@@ -44,7 +44,8 @@
String HOSTNAME = "hostname";
String IS_SLAVE = "slave";
- String DTO_SEPARATOR = "§";
+ String PARAMETER_SEPARATOR = "?";
+ String SUBSEQUENT_PARAMETER = "&";
/**
* Registers this session instance in a ThreadLocal variable.
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/SessionUtil.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/SessionUtil.java
index a0e13ca..dd7d841 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/SessionUtil.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/session/SessionUtil.java
@@ -13,6 +13,8 @@
package org.eclipse.osbp.runtime.common.session;
+import java.util.regex.Pattern;
+
public class SessionUtil {
private SessionUtil(){
@@ -20,7 +22,7 @@
}
/**
- * Splits the fragment by ISession.DTO_SEPARATOR and returns the encoded info. Returns null, if no fragment available.
+ * Splits the fragment by ISession.PARAMETER_SEPARATOR and returns the encoded info. Returns null, if no fragment available.
* @param fragment
* @return
*/
@@ -28,20 +30,31 @@
if(fragment == null){
return null;
}
- String[] tokens = fragment.split(ISession.DTO_SEPARATOR);
- if(tokens.length == 1) {
- return null;
+ String[] masterPara = fragment.split(Pattern.quote(ISession.PARAMETER_SEPARATOR));
+ String masterId = masterPara[0];
+ String displayId = null;
+ String languageTag = "en-US";
+ String[] parameters = masterPara[1].split(Pattern.quote(ISession.SUBSEQUENT_PARAMETER));
+ for(String parameter:parameters) {
+ String[] keyValue = parameter.split("=");
+ if("display".equalsIgnoreCase(keyValue[0].trim())) {
+ displayId = keyValue[1].trim();
+ } else if("locale".equalsIgnoreCase(keyValue[0].trim())) {
+ languageTag = keyValue[1].trim();
+ }
}
- return new Info(tokens[0], tokens[1]);
+ return new Info(masterId, displayId, languageTag);
}
public static class Info {
public final String host;
public final String ui;
- public Info(String host, String ui) {
+ public final String languageTag;
+ public Info(String host, String ui, String languageTag) {
super();
this.host = host;
this.ui = ui;
+ this.languageTag = languageTag;
}
}
}
diff --git a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/util/BeanUtils.java b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/util/BeanUtils.java
index b7834bd..c98c9f4 100644
--- a/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/util/BeanUtils.java
+++ b/org.eclipse.osbp.runtime.common/src/org/eclipse/osbp/runtime/common/util/BeanUtils.java
@@ -37,6 +37,7 @@
import org.eclipse.osbp.runtime.common.annotations.DomainReference;
import org.eclipse.osbp.runtime.common.annotations.DtoUtils;
import org.eclipse.osbp.runtime.common.annotations.Filter;
+import org.eclipse.osbp.runtime.common.annotations.HistorizedObject;
import org.eclipse.osbp.runtime.common.annotations.OnKanbanCard;
import org.eclipse.osbp.runtime.common.annotations.Range;
import org.eclipse.osbp.runtime.common.annotations.UpdateAt;
@@ -320,6 +321,22 @@
return field.isAnnotationPresent(annotation);
}
+ /**
+ * Returns true, if {@link HistorizedObject} annotation is present.
+ * @param clazz
+ * @return
+ */
+ public static boolean isHistorized(Class<?> clazz) {
+ Class<?> type = clazz;
+ while(type != null) {
+ if(type.isAnnotationPresent(HistorizedObject.class)){
+ return true;
+ }
+ type = type.getSuperclass();
+ }
+ return false;
+ }
+
public static void setCreateUser(Object bean, String user){
List<Field> fields = getAllFields(bean.getClass(), CreateBy.class);
for(Field field : fields) {
diff --git a/org.eclipse.osbp.runtime.feature.allinone.testframework/feature.xml b/org.eclipse.osbp.runtime.feature.allinone.testframework/feature.xml
index 37bd11d..9abc4c7 100644
--- a/org.eclipse.osbp.runtime.feature.allinone.testframework/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.allinone.testframework/feature.xml
@@ -16,7 +16,8 @@
id="org.eclipse.osbp.runtime.feature.allinone.testframework"
label="%featureName"
version="0.9.0.qualifier"
- provider-name="%providerName">
+ provider-name="%providerName"
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.common/feature.xml b/org.eclipse.osbp.runtime.feature.common/feature.xml
index f515cdd..c1abecd 100644
--- a/org.eclipse.osbp.runtime.feature.common/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.common/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.common">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.datasource.provider/feature.xml b/org.eclipse.osbp.runtime.feature.datasource.provider/feature.xml
index 0515dfb..0583fc0 100644
--- a/org.eclipse.osbp.runtime.feature.datasource.provider/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.datasource.provider/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.datasource.provider">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.e4eventmanager/feature.xml b/org.eclipse.osbp.runtime.feature.e4eventmanager/feature.xml
index dfc75f2..d94fc7d 100644
--- a/org.eclipse.osbp.runtime.feature.e4eventmanager/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.e4eventmanager/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.event">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.eclipselink.core.fragment/feature.xml b/org.eclipse.osbp.runtime.feature.eclipselink.core.fragment/feature.xml
index 544dab4..df9ecc5 100644
--- a/org.eclipse.osbp.runtime.feature.eclipselink.core.fragment/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.eclipselink.core.fragment/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.eclipselink.core.fragment">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.ecore.bundlespace/feature.xml b/org.eclipse.osbp.runtime.feature.ecore.bundlespace/feature.xml
index d832d10..1bedccc 100644
--- a/org.eclipse.osbp.runtime.feature.ecore.bundlespace/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.ecore.bundlespace/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.ecore.bundlespace">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.jsr303.validation/feature.xml b/org.eclipse.osbp.runtime.feature.jsr303.validation/feature.xml
index 8ccc278..9366825 100644
--- a/org.eclipse.osbp.runtime.feature.jsr303.validation/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.jsr303.validation/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.jsr303.validation">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.resolverhooks/feature.xml b/org.eclipse.osbp.runtime.feature.resolverhooks/feature.xml
index e9a073d..cc14f95 100644
--- a/org.eclipse.osbp.runtime.feature.resolverhooks/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.resolverhooks/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.systemextension">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.runtime.feature.typeprovider.bundlespace/feature.xml b/org.eclipse.osbp.runtime.feature.typeprovider.bundlespace/feature.xml
index 48031ce..0100ee0 100644
--- a/org.eclipse.osbp.runtime.feature.typeprovider.bundlespace/feature.xml
+++ b/org.eclipse.osbp.runtime.feature.typeprovider.bundlespace/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.runtime.typeprovider.bundlespace">
+ plugin="org.eclipse.osbp.license">
<description>
%description