From 40190d3b4dbf655a305f150644376e8a0e593f78 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 15 Feb 2010 14:14:00 +0000
Subject: [PATCH] LMS-1364 initial code for new plugin 'query'

SVN: 14737
---
 .../OpenBIS-without-entry-point.gwt.xml       |  6 ++
 .../DefaultClientPluginFactoryProvider.java   |  1 +
 .../client/application/plugin/IModule.java    | 13 ++++
 .../client/application/module/DemoModule.java | 21 ++++++
 .../web/client/IQueryClientService.java       | 29 ++++++++
 .../web/client/IQueryClientServiceAsync.java  | 29 ++++++++
 .../application/ClientPluginFactory.java      | 68 +++++++++++++++++++
 .../web/client/application/QueryModule.java   | 66 ++++++++++++++++++
 .../web/client/application/ViewContext.java   | 53 +++++++++++++++
 .../client/web/public/query-dictionary.js     |  6 ++
 .../client/web/server/QueryClientService.java | 40 +++++++++++
 11 files changed, 332 insertions(+)
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ClientPluginFactory.java
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/QueryModule.java
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ViewContext.java
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/public/query-dictionary.js
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/OpenBIS-without-entry-point.gwt.xml b/openbis/source/java/ch/systemsx/cisd/openbis/OpenBIS-without-entry-point.gwt.xml
index 12b6b832151..ed53cc3757b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/OpenBIS-without-entry-point.gwt.xml
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/OpenBIS-without-entry-point.gwt.xml
@@ -38,6 +38,12 @@
     <public path="plugin/generic/client/web/public"/>
     <source path="plugin/generic/client/web/client"/>
     <source path="plugin/generic/shared/basic"/>
+
+    <!-- Query plugin -->
+    <script src="query-dictionary.js"/>
+    <public path="plugin/query/client/web/public"/>
+    <source path="plugin/query/client/web/client"/>
+    <source path="plugin/query/shared/basic"/>
     <!-- Automatically generated part - END -->
 
   <!-- Do not define servlets here, use web.xml -->
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/DefaultClientPluginFactoryProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/DefaultClientPluginFactoryProvider.java
index 9f7a5ac9628..b85bfabd15a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/DefaultClientPluginFactoryProvider.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/DefaultClientPluginFactoryProvider.java
@@ -52,6 +52,7 @@ public class DefaultClientPluginFactoryProvider implements IClientPluginFactoryP
     {
         // Automatically generated part - START
         registerPluginFactory(new ch.systemsx.cisd.openbis.plugin.demo.client.web.client.application.ClientPluginFactory(originalViewContext));
+        registerPluginFactory(new ch.systemsx.cisd.openbis.plugin.query.client.web.client.application.ClientPluginFactory(originalViewContext));
         // Automatically generated part - END
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/IModule.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/IModule.java
index 68968d81bda..b84f99d0d0e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/IModule.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/plugin/IModule.java
@@ -16,6 +16,10 @@
 
 package ch.systemsx.cisd.openbis.generic.client.web.client.application.plugin;
 
+import java.util.List;
+
+import com.extjs.gxt.ui.client.widget.Component;
+import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.Widget;
 
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.TopMenuItem;
@@ -38,4 +42,13 @@ public interface IModule
      * </p>
      */
     Widget getMenu();
+    
+    String getModuleName();
+    
+    String getModuleDescription();
+    
+    /**
+     * Returns a list with at least one menu item. 
+     */
+    List<Component> getMenuItems();
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/DemoModule.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/DemoModule.java
index bccf1b59bc3..d0e180ba003 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/DemoModule.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/DemoModule.java
@@ -16,6 +16,9 @@
 
 package ch.systemsx.cisd.openbis.plugin.demo.client.web.client.application.module;
 
+import java.util.List;
+
+import com.extjs.gxt.ui.client.widget.Component;
 import com.google.gwt.user.client.ui.Widget;
 
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
@@ -48,4 +51,22 @@ public class DemoModule implements IModule
         // Uncomment to see customized top menu .
         // return new CustomizedWidgetDemoModuleMenu(getViewContext());
     }
+
+    public List<Component> getMenuItems()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getModuleDescription()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getModuleName()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java
new file mode 100644
index 00000000000..8e058dcd847
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.client;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.IClientService;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IQueryClientService extends IClientService
+{
+
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java
new file mode 100644
index 00000000000..7b7bcf33c3c
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.client;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.IClientServiceAsync;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IQueryClientServiceAsync extends IClientServiceAsync
+{
+
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ClientPluginFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ClientPluginFactory.java
new file mode 100644
index 00000000000..793cd6fb4a4
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ClientPluginFactory.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.client.application;
+
+import java.util.Collections;
+import java.util.Set;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractClientPluginFactory;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.plugin.IClientPlugin;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.plugin.IModule;
+import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifiable;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ClientPluginFactory extends AbstractClientPluginFactory<ViewContext>
+{
+
+    public ClientPluginFactory(IViewContext<ICommonClientServiceAsync> originalViewContext)
+    {
+        super(originalViewContext);
+    }
+
+    @Override
+    protected ViewContext createViewContext(
+            IViewContext<ICommonClientServiceAsync> originalViewContext)
+    {
+        return new ViewContext(originalViewContext);
+    }
+
+    public <T extends EntityType, I extends IIdentifiable> IClientPlugin<T, I> createClientPlugin(
+            EntityKind entityKind)
+    {
+        throw new UnsupportedOperationException("IClientPlugin for entity kind '" + entityKind
+                + "' not implemented yet.");
+    }
+
+    public Set<String> getEntityTypeCodes(EntityKind entityKind)
+    {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public IModule tryGetModule()
+    {
+        return new QueryModule(getViewContext());
+    }
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/QueryModule.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/QueryModule.java
new file mode 100644
index 00000000000..95503872fa6
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/QueryModule.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.client.application;
+
+import java.util.List;
+
+import com.extjs.gxt.ui.client.widget.Component;
+import com.extjs.gxt.ui.client.widget.button.Button;
+import com.google.gwt.user.client.ui.Widget;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.plugin.IModule;
+import ch.systemsx.cisd.openbis.plugin.query.client.web.client.IQueryClientServiceAsync;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class QueryModule implements IModule
+{
+    private final IViewContext<IQueryClientServiceAsync> viewContext;
+
+    QueryModule(IViewContext<IQueryClientServiceAsync> viewContext)
+    {
+        this.viewContext = viewContext;
+    }
+    
+    public Widget getMenu()
+    {
+        return new Button("hello");
+    }
+
+    public List<Component> getMenuItems()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getModuleDescription()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getModuleName()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ViewContext.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ViewContext.java
new file mode 100644
index 00000000000..4129cd25331
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/ViewContext.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.client.application;
+
+import com.google.gwt.core.client.GWT;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractPluginViewContext;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
+import ch.systemsx.cisd.openbis.plugin.query.client.web.client.IQueryClientService;
+import ch.systemsx.cisd.openbis.plugin.query.client.web.client.IQueryClientServiceAsync;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ViewContext extends AbstractPluginViewContext<IQueryClientServiceAsync>
+{
+    private static final String TECHNOLOGY_NAME = "query";
+
+    public ViewContext(IViewContext<ICommonClientServiceAsync> commonViewContext)
+    {
+        super(commonViewContext);
+    }
+
+    @Override
+    protected String getTechnology()
+    {
+        return TECHNOLOGY_NAME;
+    }
+    
+    @Override
+    protected IQueryClientServiceAsync createClientServiceAsync()
+    {
+        return GWT.create(IQueryClientService.class);
+    }
+
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/public/query-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/public/query-dictionary.js
new file mode 100644
index 00000000000..a702491d85e
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/public/query-dictionary.js
@@ -0,0 +1,6 @@
+// Query dictionary
+var query = {
+
+  // LAST LINE: KEEP IT AT THE END
+  lastline: "" // we need a line without a comma
+};
\ No newline at end of file
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java
new file mode 100644
index 00000000000..b429f8c3b8b
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.query.client.web.server;
+
+import org.springframework.stereotype.Component;
+
+import ch.systemsx.cisd.openbis.generic.client.web.server.AbstractClientService;
+import ch.systemsx.cisd.openbis.generic.shared.IServer;
+import ch.systemsx.cisd.openbis.plugin.query.client.web.client.IQueryClientService;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component(value = "query-service")
+public class QueryClientService extends AbstractClientService implements IQueryClientService
+{
+
+    @Override
+    protected IServer getServer()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
-- 
GitLab