Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2018-02-23 08:26:10 -0500
committerRalf Mollik2018-02-23 08:26:10 -0500
commit146e0edcc4ed7bdf589239238fdd5aff87bbad43 (patch)
tree395d413121bf0f5b014ee29171ca80a982716c40
parentbfaca759382f2e3fb8c33d479c744a73dea86474 (diff)
downloadorg.eclipse.osbp.filter-146e0edcc4ed7bdf589239238fdd5aff87bbad43.tar.gz
org.eclipse.osbp.filter-146e0edcc4ed7bdf589239238fdd5aff87bbad43.tar.xz
org.eclipse.osbp.filter-146e0edcc4ed7bdf589239238fdd5aff87bbad43.zip
catch up with development
-rw-r--r--.gitignore36
-rw-r--r--.settings/org.eclipse.core.resources.prefs2
-rw-r--r--.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--jenkins.build.config.xml2
-rw-r--r--org.eclipse.osbp.filter.feature/.gitignore1
-rw-r--r--org.eclipse.osbp.filter.feature/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.osbp.filter.feature/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--org.eclipse.osbp.filter.feature/.settings/org.eclipse.xtend.core.Xtend.prefs9
-rw-r--r--org.eclipse.osbp.filter.feature/feature.xml3
-rw-r--r--org.eclipse.osbp.filter/.classpath7
-rw-r--r--org.eclipse.osbp.filter/.gitignore1
-rw-r--r--org.eclipse.osbp.filter/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.osbp.filter/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--org.eclipse.osbp.filter/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--org.eclipse.osbp.filter/.settings/org.eclipse.xtend.core.Xtend.prefs10
-rw-r--r--org.eclipse.osbp.filter/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.osbp.filter/OSGI-INF/org.eclipse.osbp.filter.DefaultFilterEnhancer.xml2
-rw-r--r--org.eclipse.osbp.filter/src/org/eclipse/osbp/filter/DefaultFilterEnhancer.java91
18 files changed, 153 insertions, 42 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8504523
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
+**/target/
+**git.properties
+
+**/target/
+**/.metadata/
+
+**/emf-gen/**/.gitignore
+**/src-gen/**/.gitignore
+**/git.properties
+**/*.java._trace
+**/*.log
+**/*.log.properties
+
+**/bin/
+**/build/
+*.class
+*.ctrl
+**/Debug/
+.DS_Store
+*.ear
+*.war
+
+**/*.actionbin
+**/*.blipbin
+**/*.chartbin
+**/*.cubebin
+**/*.datatypebin
+**/*.dtobin
+**/*.entitybin
+**/*.servicebin
+**/*.tablebin
+**/*.uibin
+**/*.uisemanticbin
+**/*.xtendbin
+**/*.xtextbin
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index ad9b2fa..7fd59ba 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -17,6 +17,8 @@
<jenkins.build.dependencies>
<jenkins.build.dependency>org.eclipse.osbp.authentication</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.jpa.services</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency>
</jenkins.build.dependencies>
</jenkins>
diff --git a/org.eclipse.osbp.filter.feature/.gitignore b/org.eclipse.osbp.filter.feature/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/org.eclipse.osbp.filter.feature/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/org.eclipse.osbp.filter.feature/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.filter.feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.eclipse.osbp.filter.feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.filter.feature/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.filter.feature/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/org.eclipse.osbp.filter.feature/.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.filter.feature/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.filter.feature/.settings/org.eclipse.xtend.core.Xtend.prefs
new file mode 100644
index 0000000..6155a21
--- /dev/null
+++ b/org.eclipse.osbp.filter.feature/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,9 @@
+//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
+eclipse.preferences.version=1
+is_project_specific=true
+outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
+outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
+outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.filter.feature/feature.xml b/org.eclipse.osbp.filter.feature/feature.xml
index a8d0f94..912cad4 100644
--- a/org.eclipse.osbp.filter.feature/feature.xml
+++ b/org.eclipse.osbp.filter.feature/feature.xml
@@ -14,7 +14,8 @@
id="org.eclipse.osbp.filter.feature"
label="%featureName"
version="0.9.0.qualifier"
- provider-name="%providerName">
+ provider-name="%providerName"
+ plugin="org.eclipse.osbp.filter">
<description>
%description
diff --git a/org.eclipse.osbp.filter/.classpath b/org.eclipse.osbp.filter/.classpath
new file mode 100644
index 0000000..43b9862
--- /dev/null
+++ b/org.eclipse.osbp.filter/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.osbp.filter/.gitignore b/org.eclipse.osbp.filter/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/org.eclipse.osbp.filter/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/org.eclipse.osbp.filter/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.filter/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/org.eclipse.osbp.filter/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.osbp.filter/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.filter/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/org.eclipse.osbp.filter/.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.filter/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.filter/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/org.eclipse.osbp.filter/.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.filter/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.filter/.settings/org.eclipse.xtend.core.Xtend.prefs
new file mode 100644
index 0000000..0933f8c
--- /dev/null
+++ b/org.eclipse.osbp.filter/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,10 @@
+//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
+eclipse.preferences.version=1
+is_project_specific=true
+outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
+outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
+outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/org.eclipse.osbp.filter/META-INF/MANIFEST.MF b/org.eclipse.osbp.filter/META-INF/MANIFEST.MF
index 1d7959e..34622c1 100644
--- a/org.eclipse.osbp.filter/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.filter/META-INF/MANIFEST.MF
@@ -8,13 +8,13 @@ Bundle-Activator: org.eclipse.osbp.filter.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.slf4j.api;bundle-version="1.7.2",
- org.eclipse.osbp.gitinfo;bundle-version="0.9.0",
- org.eclipse.core.runtime;bundle-version="3.10.0"
+ org.eclipse.osbp.gitinfo;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.eclipse.osbp.runtime.common;bundle-version="0.9.0",
+ org.eclipse.osbp.jpa.services;bundle-version="0.9.0"
Import-Package: org.eclipse.osbp.authentication.account.dtos;version="0.9.0",
org.eclipse.osbp.authentication.providerimpl;version="0.9.0",
org.eclipse.osbp.dsl.common.datatypes;version="0.9.0",
- org.eclipse.osbp.dsl.dto.lib.services;version="0.9.0",
- org.eclipse.osbp.dsl.dto.lib.services.filters;version="0.9.0",
org.eclipse.osbp.ui.api.useraccess;version="0.9.0",
org.eclipse.osbp.ui.api.userfilter;version="0.9.0",
org.osgi.service.component.annotations;version="1.2.0"
diff --git a/org.eclipse.osbp.filter/OSGI-INF/org.eclipse.osbp.filter.DefaultFilterEnhancer.xml b/org.eclipse.osbp.filter/OSGI-INF/org.eclipse.osbp.filter.DefaultFilterEnhancer.xml
index 862b65f..a58549b 100644
--- a/org.eclipse.osbp.filter/OSGI-INF/org.eclipse.osbp.filter.DefaultFilterEnhancer.xml
+++ b/org.eclipse.osbp.filter/OSGI-INF/org.eclipse.osbp.filter.DefaultFilterEnhancer.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.filter.DefaultFilterEnhancer">
<service>
- <provide interface="org.eclipse.osbp.dsl.dto.lib.services.filters.IFilterEnhancer"/>
+ <provide interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer"/>
</service>
<reference bind="bindUserAccessService" cardinality="1..1" interface="org.eclipse.osbp.ui.api.useraccess.IUserAccessService" name="UserAccessService" policy="static" unbind="unbindUserAccessService"/>
<implementation class="org.eclipse.osbp.filter.DefaultFilterEnhancer"/>
diff --git a/org.eclipse.osbp.filter/src/org/eclipse/osbp/filter/DefaultFilterEnhancer.java b/org.eclipse.osbp.filter/src/org/eclipse/osbp/filter/DefaultFilterEnhancer.java
index 7f51c0d..4fcb1ee 100644
--- a/org.eclipse.osbp.filter/src/org/eclipse/osbp/filter/DefaultFilterEnhancer.java
+++ b/org.eclipse.osbp.filter/src/org/eclipse/osbp/filter/DefaultFilterEnhancer.java
@@ -16,12 +16,12 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.osbp.authentication.account.dtos.UserAccountDto;
-import org.eclipse.osbp.dsl.dto.lib.services.IQuery;
-import org.eclipse.osbp.dsl.dto.lib.services.Query;
-import org.eclipse.osbp.dsl.dto.lib.services.filters.IFilterEnhancer;
-import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd;
-import org.eclipse.osbp.dsl.dto.lib.services.filters.LIn;
-import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot;
+import org.eclipse.osbp.jpa.services.Query;
+import org.eclipse.osbp.jpa.services.filters.LAnd;
+import org.eclipse.osbp.jpa.services.filters.LIn;
+import org.eclipse.osbp.jpa.services.filters.LNot;
+import org.eclipse.osbp.runtime.common.filter.IFilterEnhancer;
+import org.eclipse.osbp.runtime.common.filter.IQuery;
import org.eclipse.osbp.ui.api.useraccess.IUserAccessService;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@@ -34,23 +34,25 @@ import org.slf4j.LoggerFactory;
*/
@Component(immediate = true)
public class DefaultFilterEnhancer implements IFilterEnhancer {
-
+
/** The user access service. */
private IUserAccessService userAccessService;
-
+
/** The logger. */
- private final Logger LOGGER = LoggerFactory.getLogger(DefaultFilterEnhancer.class);
+ private final Logger LOGGER = LoggerFactory.getLogger("servicebinder");
- /* (non-Javadoc)
- * @see org.eclipse.osbp.dsl.dto.lib.services.filters.IFilterEnhancer#enhanceQuery(org.eclipse.osbp.dsl.dto.lib.services.IQuery)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.dsl.dto.lib.services.filters.IFilterEnhancer#
+ * enhanceQuery(org.eclipse.osbp.dsl.dto.lib.services.IQuery)
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void enhanceQuery(IQuery query) {
if (userAccessService != null && userAccessService.isAuthenticated()) {
- UserAccountDto user = (UserAccountDto)userAccessService.getUser();
+ UserAccountDto user = (UserAccountDto) userAccessService.getUser();
if (user != null) {
- List<Class> queryMap = (List<Class>) query.getMap().get(
- Query.ENTITY_CLASSES_KEY);
+ List<Class> queryMap = (List<Class>) query.getMap().get(Query.ENTITY_CLASSES_KEY);
if (queryMap != null) {
LIn inFilter = null;
LNot notFilter = null;
@@ -60,7 +62,7 @@ public class DefaultFilterEnhancer implements IFilterEnhancer {
List<String> filterInValues = userAccessService.getUserFilterMap().getInFilterMap()
.get(entityClass.getName());
if (filterInValues != null) {
- List<Comparable<?>> values = new ArrayList<Comparable<?>>();
+ List<Comparable<?>> values = new ArrayList<>();
for (Comparable<?> value : filterInValues) {
values.add(value);
}
@@ -70,37 +72,26 @@ public class DefaultFilterEnhancer implements IFilterEnhancer {
List<String> filterNotValues = userAccessService.getUserFilterMap().getNotFilterMap()
.get(entityClass.getName());
if (filterNotValues != null) {
- List<Comparable<?>> values = new ArrayList<Comparable<?>>();
+ List<Comparable<?>> values = new ArrayList<>();
for (Comparable<?> value : filterNotValues) {
values.add(value);
}
notFilter = new LNot(new LIn(propertyId, values));
}
// ReplaceFilter
- if ((inFilter!=null) && (notFilter!=null)){
+ if ((inFilter != null) && (notFilter != null)) {
query.replaceFilter(new LAnd(inFilter, notFilter));
- } else if (inFilter!=null){
+ } else if (inFilter != null) {
query.replaceFilter(inFilter);
- } else if (notFilter!=null){
+ } else if (notFilter != null) {
query.replaceFilter(notFilter);
}
- // Only for test purposes
- // if (entityClass ==
- // org.eclipse.osbp.foodmart.dtos.MdepartmentDto.class)
- // {
- // List<Comparable<?>> values = new
- // ArrayList<Comparable<?>>();
- // values.add("11");
- // values.add("16");
- // LIn inFilter = new LIn(propertyId, values);
- // }
}
}
}
}
}
-
/**
* Bind user access service.
*
@@ -108,10 +99,9 @@ public class DefaultFilterEnhancer implements IFilterEnhancer {
* the user access service
*/
@Reference(cardinality = ReferenceCardinality.MANDATORY)
- public synchronized void bindUserAccessService(
- final IUserAccessService userAccessService) {
+ public synchronized void bindUserAccessService(final IUserAccessService userAccessService) {
this.userAccessService = userAccessService;
- LOGGER.debug("AuthenticationProviderService bound");
+ LOGGER.debug("DefaultFilterEnhancer UserAcccessService bound");
}
/**
@@ -120,10 +110,39 @@ public class DefaultFilterEnhancer implements IFilterEnhancer {
* @param userAccessService
* the user access service
*/
- public synchronized void unbindUserAccessService(
- final IUserAccessService userAccessService) {
+ public synchronized void unbindUserAccessService(final IUserAccessService userAccessService) { // NOSONAR
this.userAccessService = null;
- LOGGER.debug("AuthenticationProviderService unbound");
+ LOGGER.debug("DefaultFilterEnhancer UserAcccessService unbound");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.common.filter.IFilterEnhancer#checkGet(java.lang.Class, java.lang.Object)
+ */
+ @Override
+ public boolean checkGet(Class<?> entityClass, Object id) {
+ if (userAccessService != null && userAccessService.isAuthenticated()) {
+ UserAccountDto user = (UserAccountDto) userAccessService.getUser();
+ if (user != null) {
+ List<String> filterInValues = userAccessService.getUserFilterMap().getInFilterMap().get(entityClass.getName());
+ if (filterInValues != null) {
+ if(id instanceof String) {
+ return (filterInValues.contains((String) id));
+ } else {
+ return (filterInValues.contains(new Integer((int) id).toString()));
+ }
+ }
+ List<String> filterNotValues = userAccessService.getUserFilterMap().getNotFilterMap()
+ .get(entityClass.getName());
+ if (filterNotValues != null) {
+ if(id instanceof String) {
+ return !(filterNotValues.contains((String) id));
+ } else {
+ return !(filterNotValues.contains(new Integer((int) id).toString()));
+ }
+ }
+ }
+ }
+ return true;
}
}

Back to the top