diff artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java @ 9232:5030c46d8cb4

Implemented xpath function that selectes the 'mean year' of a fixation-artifact. Needs to provide the ArtifactDatabase to the builder implementation.
author gernotbelger
date Fri, 06 Jul 2018 13:09:54 +0200
parents 468d9ebda4ce
children 1d59da89b00d
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java	Fri Jul 06 13:09:25 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java	Fri Jul 06 13:09:54 2018 +0200
@@ -31,7 +31,7 @@
 import org.hibernate.SessionFactory;
 
 import org.hibernate.jdbc.Work;
-
+import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.artifacts.common.utils.Config;
 import org.dive4elements.artifacts.common.utils.XMLUtils;
 import org.dive4elements.artifacts.common.utils.StringUtils;
@@ -175,13 +175,15 @@
     /**
      * Append recommendations to \param result.
      * @param extraParameters parameters (typical example: 'recommended')
+     * @param context 
      */
     public void  recommend(
         D4EArtifact         artifact,
         String              userId,
         String []           outs,
         Map<String, Object> extraParameters,
-        Node                result
+        Node                result, 
+        final CallContext   context
     ) {
         Map<String, Object> parameters = new HashMap<String, Object>();
 
@@ -201,27 +203,19 @@
 
         parameters.put("PARAMETERS", parameters);
 
-        recommend(parameters, userId, result);
+        recommend(parameters, userId, result, context);
     }
 
 
     /**
      * Append recommendations to \param result.
+     * @param context 
      */
-    public void recommend(
-        Map<String, Object> parameters,
-        String              userId,
-        Node                result
-    ) {
-        recommend(parameters, userId, result, SessionHolder.HOLDER.get());
+    public void recommend( final Map<String, Object> parameters, final String userId, final Node result, final CallContext context ) {
+        recommend(parameters, userId, result, SessionHolder.HOLDER.get(), context);
     }
 
-    public void recommend(
-        final Map<String, Object> parameters,
-        final String              userId,
-        final Node                result,
-        Session                   systemSession
-    ) {
+    public void recommend( final Map<String, Object> parameters, final String userId, final Node result, final Session systemSession, final CallContext context ) {
         systemSession.doWork(new Work() {
             @Override
             public void execute(final Connection systemConnection)
@@ -237,10 +231,7 @@
                         public void execute(Connection sedDBConnection)
                         throws SQLException
                         {
-                            recommend(
-                                parameters, userId, result,
-                                systemConnection,
-                                sedDBConnection);
+                            recommend( parameters, userId, result, systemConnection, sedDBConnection, context);
                         }
                     });
                 }
@@ -252,11 +243,12 @@
     }
 
     public void recommend(
-        Map<String, Object> parameters,
-        String              userId,
-        Node                result,
-        Connection          systemConnection,
-        Connection          seddbConnection
+        final Map<String, Object> parameters,
+        final String              userId,
+        final Node                result,
+        final Connection          systemConnection,
+        final Connection          seddbConnection, 
+        final CallContext         context
     ) throws SQLException
     {
         List<Builder.NamedConnection> connections =
@@ -285,7 +277,7 @@
                     CONNECTION_USER, userConnection, false));
             }
 
-            getBuilderPool().build(connections, result, parameters);
+            getBuilderPool().build(connections, result, parameters, context);
         }
         finally {
             if (userConnection != null) {

http://dive4elements.wald.intevation.org