Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial check in

  • Loading branch information...
commit 9c9c1e6cc13a7fe44ad18fb2d83730e5e412ceb2 1 parent b6d9825
gofranshukair gofranshukair authored
Showing with 1,716 additions and 0 deletions.
  1. +7 −0 .classpath
  2. +29 −0 .project
  3. +17 −0 module/MOD-INF/.svn/all-wcprops
  4. +6 −0 module/MOD-INF/.svn/dir-prop-base
  5. +99 −0 module/MOD-INF/.svn/entries
  6. +5 −0 module/MOD-INF/.svn/prop-base/controller.js.svn-base
  7. +83 −0 module/MOD-INF/.svn/text-base/controller.js.svn-base
  8. +4 −0 module/MOD-INF/.svn/text-base/module.properties.svn-base
  9. +5 −0 module/MOD-INF/classes/.svn/all-wcprops
  10. +31 −0 module/MOD-INF/classes/.svn/entries
  11. +5 −0 module/MOD-INF/classes/com/.svn/all-wcprops
  12. +31 −0 module/MOD-INF/classes/com/.svn/entries
  13. +5 −0 module/MOD-INF/classes/com/google/.svn/all-wcprops
  14. +31 −0 module/MOD-INF/classes/com/google/.svn/entries
  15. +5 −0 module/MOD-INF/classes/com/google/refine/.svn/all-wcprops
  16. +31 −0 module/MOD-INF/classes/com/google/refine/.svn/entries
  17. +11 −0 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/all-wcprops
  18. +62 −0 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/entries
  19. +8 −0 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/text-base/SampleUtil.java.svn-base
  20. BIN  module/MOD-INF/classes/com/google/refine/granatumExtension/SampleUtil.class
  21. BIN  module/MOD-INF/classes/com/google/refine/granatumExtension/commands/JsonProjectCommand.class
  22. BIN  ...le/MOD-INF/classes/com/google/refine/granatumExtension/commands/column/AddColumnByFetchingURLsCommand.class
  23. +93 −0 module/MOD-INF/controller.js
  24. +5 −0 module/MOD-INF/lib/.svn/all-wcprops
  25. +28 −0 module/MOD-INF/lib/.svn/entries
  26. +4 −0 module/MOD-INF/module.properties
  27. +23 −0 module/index.vt
  28. +14 −0 module/macros.vm
  29. +11 −0 module/scripts/.svn/all-wcprops
  30. +62 −0 module/scripts/.svn/entries
  31. +5 −0 module/scripts/.svn/prop-base/project-injection.js.svn-base
  32. +36 −0 module/scripts/.svn/text-base/project-injection.js.svn-base
  33. +63 −0 module/scripts/granatum-operations-form.html
  34. +219 −0 module/scripts/granatum-operations.js
  35. +96 −0 module/scripts/index/granatum-data-insertion.js
  36. +54 −0 module/scripts/index/granatum-insertion-form.html
  37. +15 −0 module/scripts/menu-bar-extensions.js
  38. +11 −0 module/styles/.svn/all-wcprops
  39. +62 −0 module/styles/.svn/entries
  40. +38 −0 module/styles/.svn/text-base/project-injection.less.svn-base
  41. +38 −0 module/styles/project-injection.less
  42. +5 −0 src/com/.svn/all-wcprops
  43. +31 −0 src/com/.svn/entries
  44. +5 −0 src/com/google/.svn/all-wcprops
  45. +31 −0 src/com/google/.svn/entries
  46. +5 −0 src/com/google/refine/.svn/all-wcprops
  47. +31 −0 src/com/google/refine/.svn/entries
  48. +11 −0 src/com/google/refine/granatumExtension/.svn/all-wcprops
  49. +62 −0 src/com/google/refine/granatumExtension/.svn/entries
  50. +8 −0 src/com/google/refine/granatumExtension/.svn/text-base/SampleUtil.java.svn-base
  51. +8 −0 src/com/google/refine/granatumExtension/SampleUtil.java
  52. +131 −0 src/com/google/refine/granatumExtension/commands/JsonProjectCommand.java
  53. +36 −0 src/com/google/refine/granatumExtension/commands/column/AddColumnByFetchingURLsCommand.java
7 .classpath
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="src" path="/grefine"/>
+ <classpathentry kind="output" path="module/MOD-INF/classes"/>
+</classpath>
29 .project
View
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>grefine-granatum-extension</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
17 module/MOD-INF/.svn/all-wcprops
View
@@ -0,0 +1,17 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/2185/trunk/extensions/sample/module/MOD-INF
+END
+module.properties
+K 25
+svn:wc:ra_dav:version-url
+V 75
+/svn/!svn/ver/1544/trunk/extensions/sample/module/MOD-INF/module.properties
+END
+controller.js
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/!svn/ver/2185/trunk/extensions/sample/module/MOD-INF/controller.js
+END
6 module/MOD-INF/.svn/dir-prop-base
View
@@ -0,0 +1,6 @@
+K 10
+svn:ignore
+V 8
+classes
+
+END
99 module/MOD-INF/.svn/entries
View
@@ -0,0 +1,99 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/module/MOD-INF
+https://google-refine.googlecode.com/svn
+
+
+
+2011-08-04T20:37:14.133198Z
+2185
+dfhuynh@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+module.properties
+file
+
+
+
+
+2011-09-18T16:47:25.607051Z
+d2e9fbccff0e63efef3f5ed86e60d5cd
+2010-10-14T21:12:44.034431Z
+1544
+tfmorris
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+105
+
+lib
+dir
+
+controller.js
+file
+
+
+
+
+2011-09-18T16:47:25.607051Z
+4ba6f37820ffd6c5b8f5f7343a5e96b0
+2011-08-04T20:37:14.133198Z
+2185
+dfhuynh@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2901
+
5 module/MOD-INF/.svn/prop-base/controller.js.svn-base
View
@@ -0,0 +1,5 @@
+K 12
+svn:mimetype
+V 15
+text/javascript
+END
83 module/MOD-INF/.svn/text-base/controller.js.svn-base
View
@@ -0,0 +1,83 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+var html = "text/html";
+var encoding = "UTF-8";
+var ClientSideResourceManager = Packages.com.google.refine.ClientSideResourceManager;
+
+/*
+ * Function invoked to initialize the extension.
+ */
+function init() {
+ // Packages.java.lang.System.err.println("Initializing sample extension");
+ // Packages.java.lang.System.err.println(module.getMountPoint());
+
+ // Script files to inject into /project page
+ ClientSideResourceManager.addPaths(
+ "project/scripts",
+ module,
+ [
+ "scripts/project-injection.js"
+ ]
+ );
+
+ // Style files to inject into /project page
+ ClientSideResourceManager.addPaths(
+ "project/styles",
+ module,
+ [
+ "styles/project-injection.less"
+ ]
+ );
+}
+
+/*
+ * Function invoked to handle each request in a custom way.
+ */
+function process(path, request, response) {
+ // Analyze path and handle this request yourself.
+
+ if (path == "/" || path == "") {
+ var context = {};
+ // here's how to pass things into the .vt templates
+ context.someList = ["Superior","Michigan","Huron","Erie","Ontario"];
+ context.someString = "foo";
+ context.someInt = Packages.com.google.refine.sampleExtension.SampleUtil.stringArrayLength(context.someList);
+
+ send(request, response, "index.vt", context);
+ }
+}
+
+function send(request, response, template, context) {
+ butterfly.sendTextFromTemplate(request, response, context, template, encoding, html);
+}
4 module/MOD-INF/.svn/text-base/module.properties.svn-base
View
@@ -0,0 +1,4 @@
+name = sample
+description = Google Refine Sample Extension
+templating.macros = macros.vm
+requires = core
5 module/MOD-INF/classes/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 46
+/svn/!svn/ver/1542/trunk/extensions/sample/src
+END
31 module/MOD-INF/classes/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T18:49:08.474605Z
+1291
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+com
+dir
+
5 module/MOD-INF/classes/com/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com
+END
31 module/MOD-INF/classes/com/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T18:49:08.474605Z
+1291
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+google
+dir
+
5 module/MOD-INF/classes/com/google/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google
+END
31 module/MOD-INF/classes/com/google/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T18:49:08.474605Z
+1291
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+refine
+dir
+
5 module/MOD-INF/classes/com/google/refine/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine
+END
31 module/MOD-INF/classes/com/google/refine/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google/refine
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+sampleExtension
+dir
+
11 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/all-wcprops
View
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine/sampleExtension
+END
+SampleUtil.java
+K 25
+svn:wc:ra_dav:version-url
+V 96
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine/sampleExtension/SampleUtil.java
+END
62 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/entries
View
@@ -0,0 +1,62 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google/refine/sampleExtension
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+SampleUtil.java
+file
+
+
+
+
+2011-09-18T16:47:25.623059Z
+cb779426749ea1cdedbe8e373978534e
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+158
+
8 module/MOD-INF/classes/com/google/refine/granatumExtension/.svn/text-base/SampleUtil.java.svn-base
View
@@ -0,0 +1,8 @@
+package com.google.refine.sampleExtension;
+
+
+public class SampleUtil {
+ static public int stringArrayLength(String[] a) {
+ return a.length;
+ }
+}
BIN  module/MOD-INF/classes/com/google/refine/granatumExtension/SampleUtil.class
View
Binary file not shown
BIN  module/MOD-INF/classes/com/google/refine/granatumExtension/commands/JsonProjectCommand.class
View
Binary file not shown
BIN  ...MOD-INF/classes/com/google/refine/granatumExtension/commands/column/AddColumnByFetchingURLsCommand.class
View
Binary file not shown
93 module/MOD-INF/controller.js
View
@@ -0,0 +1,93 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+var html = "text/html";
+var encoding = "UTF-8";
+var ClientSideResourceManager = Packages.com.google.refine.ClientSideResourceManager;
+
+/*
+ * Function invoked to initialize the extension.
+ */
+function init() {
+ // Packages.java.lang.System.err.println("Initializing granatum extension");
+ // Packages.java.lang.System.err.println(module.getMountPoint());
+ var RefineServlet = Packages.com.google.refine.RefineServlet;
+ // Script files to inject into /project page
+
+ ClientSideResourceManager.addPaths(
+ "project/scripts",
+ module,
+ [
+ "scripts/menu-bar-extensions.js",
+ "scripts/granatum-operations.js"
+ ]
+ );
+ ClientSideResourceManager.addPaths(
+ "index/scripts",
+ module,
+ [
+ "scripts/index/granatum-data-insertion.js"
+ ]
+ );
+ // Style files to inject into /project page
+ ClientSideResourceManager.addPaths(
+ "project/styles",
+ module,
+ [
+ "styles/project-injection.less"
+ ]
+ );
+ RefineServlet.registerCommand(module, "project-json", new Packages.com.google.refine.granatumExtension.commands.JsonProjectCommand());
+ RefineServlet.registerCommand(module, "add-column-by-fetching-urls-ex", new Packages.com.google.refine.granatumExtension.commands.column.AddColumnByFetchingURLsCommand());
+}
+
+/*
+ * Function invoked to handle each request in a custom way.
+ */
+function process(path, request, response) {
+ // Analyze path and handle this request yourself.
+
+ if (path == "/" || path == "") {
+ var context = {};
+ // here's how to pass things into the .vt templates
+ context.someList = ["Superior","Michigan","Huron","Erie","Ontario"];
+ context.someString = "foo";
+ context.someInt = Packages.com.google.refine.granatumExtension.SampleUtil.stringArrayLength(context.someList);
+
+ send(request, response, "index.vt", context);
+ }
+}
+
+function send(request, response, template, context) {
+ butterfly.sendTextFromTemplate(request, response, context, template, encoding, html);
+}
5 module/MOD-INF/lib/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/!svn/ver/1542/trunk/extensions/sample/module/MOD-INF/lib
+END
28 module/MOD-INF/lib/.svn/entries
View
@@ -0,0 +1,28 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/module/MOD-INF/lib
+https://google-refine.googlecode.com/svn
+
+
+
+2010-06-21T05:58:44.136171Z
+1013
+iainsproat
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
4 module/MOD-INF/module.properties
View
@@ -0,0 +1,4 @@
+name = granatum
+description = Google Refine Granatum Extension
+templating.macros = macros.vm
+requires = core
23 module/index.vt
View
@@ -0,0 +1,23 @@
+#*
+ * Access this page at the URL /extension/expirements/
+ *#
+<html>
+ <head>
+ <title>expirements Extension</title>
+ </head>
+ <body>
+ <h1>expirements Extension</h1>
+
+ <p>If an extension needs its own page, then this is such an example.
+ However, mostly, extensions only need to inject their own scripts
+ and styles into the /project page.
+ </p>
+
+ <p>Here is someString: $someString, and someInt: $someInt</p>
+
+ <p>Here is a expirements list using a veloci-macro:</p>
+
+ #set( $greatlakes = ["Superior","Michigan","Huron","Erie","Ontario"] )
+ #makeAList( $greatlakes )
+ </body>
+</html>
14 module/macros.vm
View
@@ -0,0 +1,14 @@
+#*
+ This file contains common velocity macros used in all .vt files.
+ For Velocity documentation, see:
+
+ http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html
+*#
+
+#macro( makeAList $list )
+ <ul>
+ #foreach($item in $list)
+ <li>$item</li>
+ #end
+ </ul>
+#end
11 module/scripts/.svn/all-wcprops
View
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/1612/trunk/extensions/sample/module/scripts
+END
+project-injection.js
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/!svn/ver/1612/trunk/extensions/sample/module/scripts/project-injection.js
+END
62 module/scripts/.svn/entries
View
@@ -0,0 +1,62 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/module/scripts
+https://google-refine.googlecode.com/svn
+
+
+
+2010-10-20T18:11:15.775574Z
+1612
+dfhuynh@google.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+project-injection.js
+file
+
+
+
+
+2011-09-18T16:47:25.599069Z
+655384f1a538cb7dad01cf424ff1daee
+2010-10-20T18:11:15.775574Z
+1612
+dfhuynh@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1575
+
5 module/scripts/.svn/prop-base/project-injection.js.svn-base
View
@@ -0,0 +1,5 @@
+K 12
+svn:mimetype
+V 15
+text/javascript
+END
36 module/scripts/.svn/text-base/project-injection.js.svn-base
View
@@ -0,0 +1,36 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// This file is added to the /project page
+
+var SampleExtension = {};
63 module/scripts/granatum-operations-form.html
View
@@ -0,0 +1,63 @@
+<div class="grid-layout layout-normal">
+<p>
+choose the operations you want to run
+</p>
+<table>
+<tr>
+<td>
+<input type="checkbox" name="uuid" id="uuid" value="uuid"/> uuid
+</td>
+<td>
+<input type="checkbox" name="uuidparseJson" id="uuidparseJson" value="uuidparseJson"/> uuidparseJson
+</td>
+</tr>
+<tr>
+<td>
+<input type="checkbox" name="CSID" id="CSID" value="CSID"/>CSID
+</td>
+<td>
+<input type="checkbox" name="CSIDtransform" id="CSIDtransform" value="CSIDtransform"/>CSIDtransform
+</td>
+</tr>
+
+<tr>
+<td>
+<input type="checkbox" name="chemSpiderURL" id="chemSpiderURL" value="chemSpiderURL"/> chemSpiderURL
+</td>
+<td>
+<input type="checkbox" name="chemSpiderURI" id="chemSpiderURI" value="chemSpiderURI"/>chemSpiderURI
+</td>
+</tr>
+<tr>
+<td>
+<input type="checkbox" name="getCompoundInfo" id="getCompoundInfo" value="getCompoundInfo"/>getCompoundInfo
+</td>
+<td>
+<input type="checkbox" name="SMILES" id="SMILES" value="SMILES"/>SMILES
+</td>
+</tr>
+
+<tr>
+<td>
+<input type="checkbox" name="CSID2ExtRef" id="CSID2ExtRef" value="CSID2ExtRef"/>CSID2ExtRef
+</td>
+<td>
+<input type="checkbox" name="chebiURI" id="chebiURI" value="chebiURI"/>chebiURI
+</td>
+</tr>
+<tr>
+<td>
+<input type="checkbox" name="chebiURI1" id="chebiURI1" value="chebiURI1"/>chebiURI1
+</td>
+<td>
+<input type="checkbox" name="derefChebiURI" id="derefChebiURI" value="derefChebiURI"/>derefChebiURI
+</td>
+</tr>
+<tr>
+<td>
+<input type="checkbox" name="molecularMass" id="molecularMass" value="molecularMass"/>molecularMass
+</td>
+
+</tr>
+</table>
+</div>
219 module/scripts/granatum-operations.js
View
@@ -0,0 +1,219 @@
+
+function GranatumOperationsDialog() {
+
+ this._nodeUIs = [];
+ this._createDialog();
+
+};
+
+GranatumOperationsDialog.prototype._createDialog = function() {
+ var self = this;
+ var frame = DialogSystem.createDialog();
+
+ frame.width("1000px");
+
+ var header = $('<div></div>').addClass("dialog-header").text(
+ "Granatum Operations").appendTo(frame);
+ var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
+ var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
+ this._constructFooter(footer);
+ this._constructBody(body);
+ this._level = DialogSystem.showDialog(frame);
+
+};
+
+GranatumOperationsDialog.prototype._constructFooter = function(footer) {
+ var self = this;
+
+ $('<button></button>').addClass('button')
+ .html("&nbsp;&nbsp;OK&nbsp;&nbsp;").click(function() {
+
+ $("input:checked").each(function() {
+ var selected = $(this);
+ alert(selected.val());
+ self._runOperation(selected.val());
+
+ });
+ DialogSystem.dismissUntil(self._level - 1);
+ /**/
+
+ }).appendTo(footer);
+
+ $('<button></button>').addClass('button').text("Cancel").click(function() {
+ DialogSystem.dismissUntil(self._level - 1);
+ }).appendTo(footer);
+
+};
+GranatumOperationsDialog.prototype._constructBody = function(body) {
+
+ var self = this;
+ body
+ .html(DOM.loadHTML("granatum",
+ "scripts/granatum-operations-form.html"));
+ this._elmts = DOM.bind(body);
+};
+
+GranatumOperationsDialog.prototype._runOperation = function(oprID) {
+ switch (oprID) {
+ case "uuid":
+ //Create column uuid at index 1 by fetching URLs based on column Compound using expression grel:\"http://vmdhcls04.deri.ie/uuid.php\
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "Compound",
+ urlExpression : "grel:'http:\/\/vmdhcls04.deri.ie\/uuid.php'",
+ newColumnName : "uuid",
+ columnInsertIndex : 1,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, {everythingChanged: true }, {
+
+ onDone : function() {
+ Refine.postCoreProcess("text-transform", {
+ columnName : "uuid",
+ expression : "grel:value.parseJson()",
+ repeat : false,
+ repeatCount : 10,
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+
+ }
+ }
+
+ );
+
+
+ break;
+
+ case "CSID":
+ //Create column CSID at index 1 by fetching URLs based on column Compound using expression grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=SimpleSearch&label=\"+escape(value, \"url\")+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "Compound",
+ urlExpression : "grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=SimpleSearch&label=\"+escape(value, \"url\")+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"",
+ newColumnName : "CSID",
+ columnInsertIndex : 1,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {
+
+ onDone : function() {
+ //Text transform on cells in column CSID using expression grel:value.parseJson()[1][\"0\"]
+ Refine.postCoreProcess("text-transform", {
+ columnName : "CSID",
+ expression : "grel:value.parseJson()[1][\"0\"]",
+ repeat : false,
+ repeatCount : 10,
+ onError : "set-to-blank"
+ }, {}, {everythingChanged: true}, {});
+
+ }
+ }
+
+ );
+ break;
+ case "chemSpiderURL":
+ //Create column chemSpiderURL at index 2 based on column CSID using expression grel:if(value!='', 'http://www.chemspider.com/Chemical-Structure.'+value+'.html', '')
+ Refine.postCoreProcess("add-column", {
+ baseColumnName : "CSID",
+ expression : "grel:if(value!='', 'http://www.chemspider.com/Chemical-Structure.'+value+'.html', '')",
+ newColumnName : "chemSpiderURL",
+ columnInsertIndex : 2,
+ onError : "set-to-blank"
+ }, {}, {everythingChanged: true}, {});
+ break;
+ case "chemSpiderURI":
+ //Create column chemSpiderURI at index 2 based on column CSID using expression grel:\"http://www.chemspider.com/Chemical-Structure.\"+value+\".rdf\"
+ Refine.postCoreProcess("add-column", {
+ baseColumnName : "CSID",
+ expression : "grel:\"http://www.chemspider.com/Chemical-Structure.\"+value+\".rdf\"",
+ newColumnName : "chemSpiderURI",
+ columnInsertIndex : 2,
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+ break;
+ case "getCompoundInfo":
+ //Create column getCompoundInfo at index 2 by fetching URLs based on column CSID using expression grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=GetCompoundInfo&csid=\"+value+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "CSID",
+ urlExpression : "grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=GetCompoundInfo&csid=\"+value+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"",
+ newColumnName : "getCompoundInfo",
+ columnInsertIndex : 2,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+ break;
+ case "SMILES":
+
+ Refine.postCoreProcess("add-column", {
+ baseColumnName : "getCompoundInfo",
+ expression : "grel:value.parseJson()[1][\"SMILES\"][\"0\"]",
+ newColumnName : "SMILES",
+ columnInsertIndex : 2,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+ break;
+ case "CSID2ExtRef":
+ //Create column CSID2ExtRef at index 2 by fetching URLs based on column CSID using expression grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=CSID2ExtRefs&csid=\"+value+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "CSID2ExtRef",
+ urlExpression : "grel:\"http://hcls.deri.org/c2sma/chemSpiderProxy.php?service=CSID2ExtRefs&csid=\"+value+\"&token=2913cb9b-a281-4752-b582-5fe15a663884\"",
+ newColumnName : "CSID",
+ columnInsertIndex : 1,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {
+ onDone : function() {
+ //Create column chebiURI at index 3 based on column CSID2ExtRef using expression grel:value.parseJson()[1][\"chebiURI\"][0]
+ Refine.postCoreProcess("add-column", {
+ baseColumnName : "CSID2ExtRef",
+ expression : "grel:value.parseJson()[1][\"chebiURI\"][0]",
+ newColumnName : "chebiURI",
+ columnInsertIndex : 3,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+ Refine.postCoreProcess("add-column", {
+ baseColumnName : "CSID2ExtRef",
+ expression : "grel:value.parseJson()[1][\"chebiURI\"][1]",
+ newColumnName : "chebiURI1",
+ columnInsertIndex : 3,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, {everythingChanged: true}, {
+
+ onDone:function(){
+ //Create column derefChebiURI at index 4 by fetching URLs based on column chebiURI1 using expression grel:\"http://chem.deri.ie/c2sma/rdf2json.php?&uri=\"+escape(value, \"url\")
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "chebiURI1",
+ urlExpression : "grel:\"http://chem.deri.ie/c2sma/rdf2json.php?&uri=\"+escape(value, \"url\")",
+ newColumnName : "derefChebiURI",
+ columnInsertIndex : 4,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, {everythingChanged: true}, {
+
+ onDone:function(){
+ //Create column molecularMass at index 5 based on column derefChebiURI using expression grel:value.parseJson()[\"bio2rdf_resource:mass\"][0]"
+ Refine.postCoreProcess("add-column-by-fetching-urls", {
+ baseColumnName : "derefChebiURI",
+ urlExpression : "grel:value.parseJson()[\"bio2rdf_resource:mass\"][0]",
+ newColumnName : "molecularMass",
+ columnInsertIndex : 5,
+ delay : "50000",
+ onError : "set-to-blank"
+ }, {}, { everythingChanged: true}, {});
+ }
+ });
+ }
+ });
+ }
+ });
+ break;
+
+
+ }
+
+
+
+};
+/*
+ */
96 module/scripts/index/granatum-data-insertion.js
View
@@ -0,0 +1,96 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// This file is added to the /project page
+
+var granatumExtension = {};
+
+
+
+function GranatumImportingSourceUI(controller) {
+ this._controller = controller;
+ this._controller._format = "text/line-based/*sv";
+ }
+ Refine.DefaultImportingController.sources.push({
+ "label": "Granatum",
+ "id": "granatum",
+ "uiClass": GranatumImportingSourceUI
+ });
+
+ GranatumImportingSourceUI.prototype.attachUI = function(bodyDiv) {
+ var self = this;
+
+ bodyDiv.html(DOM.loadHTML("granatum", "scripts/index/granatum-insertion-form.html"));
+
+ this._elmts = DOM.bind(bodyDiv);
+ this._elmts.nextButton.click(function(evt) {
+ // collect the data from the inputs and format them in CSV format .
+ //headers
+ var datastr="Compound;NAD(P)H:quinone reductase (QR) induction CD [µM]a;NAD(P)H:quinone reductase (QR) induction IC50 [µM];Cyp1A inhibition IC50 [µM]";
+ var num = $('.clonedRecord').length;
+ //combine records is one string
+ for (var i=0;i<num;i++){
+ var compoundname =$('input[name="compoundname"]')[i].value;
+ var nadcd =$('input[name="nadcd"]')[i].value;
+ var nadic =$('input[name="nadic"]')[i].value;
+ var cyp1aic =$('input[name="cyp1aic"]')[i].value;
+ datastr+="\n"+compoundname+";"+nadcd+";"+nadic+";"+cyp1aic;
+ }
+
+ self._elmts.textInput[0].value= datastr;
+ self._controller.startImportJob(self._elmts.form, "Uploading pasted data ...");
+
+ });
+ this._elmts.btnAdd.click(function(evt) {
+
+
+ var num = $('.clonedRecord').length; // how many "duplicatable" input fields we currently have
+ var newNum = new Number(num + 1); // the numeric ID of the new input field being added
+ alert(num);
+ var recordsDiv=$('#recordsDiv');
+ // create the new element via clone(), and manipulate it's ID using newNum value
+ var newClonedRecord = $('#clonedRecord'+num).clone().attr("id","clonedRecord"+newNum).addClass("clonedRecord");
+ // manipulate the name/id values of the input inside the new element
+ newClonedRecord.children().each(function(){
+ var kid = $(this);
+ kid.attr('id', kid.attr('id').replace(/\d+/g, '') + newNum);
+ kid.val('');
+ });
+ newClonedRecord.appendTo(recordsDiv);
+
+ });
+ };
+
+ GranatumImportingSourceUI.prototype.focus = function() {
+ this._elmts.textInput.focus();
+ };
54 module/scripts/index/granatum-insertion-form.html
View
@@ -0,0 +1,54 @@
+
+<div class="grid-layout layout-normal">
+<table>
+ <tr>
+
+ <td>Compound</td>
+ <td>NAD(P)H:quinone reductase (QR) induction CD [µM]a</td>
+ <td>NAD(P)H:quinone reductase (QR) induction IC50 [µM]</td>
+ <td>Cyp1A inhibition IC50 [µM]</td>
+ <td>Operations</td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <form id="myForm" bind="myForm" action="">
+ <div id="recordsDiv" name="recordsDiv" bind="recordsDiv">
+ <div id="clonedRecord1" name="clonedRecord" class="clonedRecord">
+
+ <input type="text" name="compoundname" id="compoundname1" />
+ <input type="text" name="nadcd" id="nadcd1" />
+ <input type="text" name="nadic" id="nadic1" />
+ <input type="text" name="cyp1aic" id="cyp1aic1" />
+ Operations
+ </div>
+
+ </div>
+ </form>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <div><input type="button" id="btnAdd" bind="btnAdd" value="add" /></div>
+ </td>
+ </tr>
+</table>
+</div>
+
+<form bind="form" action="">
+<div class="grid-layout layout-normal">
+<table>
+ <tr>
+ <td><input type="hidden" bind="textInput" name="clipboard"
+ id="default-importing-clipboard-textarea" /> <input type="hidden"
+ name="format" value="text/line-based/*sv"></td>
+ </tr>
+ <tr>
+ <td>
+ <button bind="nextButton" class="button button-primary" type="button">Next
+ &raquo;</button>
+ </td>
+ </tr>
+</table>
+</div>
+</form>
15 module/scripts/menu-bar-extensions.js
View
@@ -0,0 +1,15 @@
+ExtensionBar.MenuItems.push(
+ {
+ "id" : "expriements",
+ "label":"Expirement",
+ "submenu" : [
+ {
+ "id": "try1",
+ label: "Granatum Operations",
+ click: function() { new GranatumOperationsDialog(); }
+ }
+ ]
+ }
+);
+
+
11 module/styles/.svn/all-wcprops
View
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/1612/trunk/extensions/sample/module/styles
+END
+project-injection.less
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/!svn/ver/1612/trunk/extensions/sample/module/styles/project-injection.less
+END
62 module/styles/.svn/entries
View
@@ -0,0 +1,62 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/module/styles
+https://google-refine.googlecode.com/svn
+
+
+
+2010-10-20T18:11:15.775574Z
+1612
+dfhuynh@google.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+project-injection.less
+file
+
+
+
+
+2011-09-18T16:47:25.595075Z
+dedcdd1b492c02886b3544da6c1b8ddc
+2010-10-20T18:11:15.775574Z
+1612
+dfhuynh@google.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1583
+
38 module/styles/.svn/text-base/project-injection.less.svn-base
View
@@ -0,0 +1,38 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// LESS styles
+// For documentation, see http://lesscss.org/
+
+@color: blue;
+
38 module/styles/project-injection.less
View
@@ -0,0 +1,38 @@
+/*
+
+Copyright 2010, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// LESS styles
+// For documentation, see http://lesscss.org/
+
+@color: blue;
+
5 src/com/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com
+END
31 src/com/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T18:49:08.474605Z
+1291
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+google
+dir
+
5 src/com/google/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google
+END
31 src/com/google/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T18:49:08.474605Z
+1291
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+refine
+dir
+
5 src/com/google/refine/.svn/all-wcprops
View
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine
+END
31 src/com/google/refine/.svn/entries
View
@@ -0,0 +1,31 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google/refine
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+sampleExtension
+dir
+
11 src/com/google/refine/granatumExtension/.svn/all-wcprops
View
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine/sampleExtension
+END
+SampleUtil.java
+K 25
+svn:wc:ra_dav:version-url
+V 96
+/svn/!svn/ver/1542/trunk/extensions/sample/src/com/google/refine/sampleExtension/SampleUtil.java
+END
62 src/com/google/refine/granatumExtension/.svn/entries
View
@@ -0,0 +1,62 @@
+10
+
+dir
+2244
+https://google-refine.googlecode.com/svn/trunk/extensions/sample/src/com/google/refine/sampleExtension
+https://google-refine.googlecode.com/svn
+
+
+
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7d457c2a-affb-35e4-300a-418c747d4874
+
+SampleUtil.java
+file
+
+
+
+
+2011-09-18T16:47:25.623059Z
+cb779426749ea1cdedbe8e373978534e
+2010-09-22T17:04:10.640552Z
+1288
+dfhuynh@gmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+158
+
8 src/com/google/refine/granatumExtension/.svn/text-base/SampleUtil.java.svn-base
View
@@ -0,0 +1,8 @@
+package com.google.refine.sampleExtension;
+
+
+public class SampleUtil {
+ static public int stringArrayLength(String[] a) {
+ return a.length;
+ }
+}
8 src/com/google/refine/granatumExtension/SampleUtil.java
View
@@ -0,0 +1,8 @@
+package com.google.refine.granatumExtension;
+
+
+public class SampleUtil {
+ static public int stringArrayLength(String[] a) {
+ return a.length;
+ }
+}
131 src/com/google/refine/granatumExtension/commands/JsonProjectCommand.java
View
@@ -0,0 +1,131 @@
+package com.google.refine.granatumExtension.commands;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.refine.ProjectManager;
+import com.google.refine.ProjectMetadata;
+import com.google.refine.commands.Command;
+import com.google.refine.commands.HttpUtilities;
+import com.google.refine.importing.ImportingJob;
+import com.google.refine.importing.ImportingManager;
+import com.google.refine.importing.ImportingUtilities;
+import com.google.refine.importing.ImportingManager.Format;
+import com.google.refine.model.Project;
+import com.google.refine.util.JSONUtilities;
+import com.google.refine.util.ParsingUtilities;
+
+public class JsonProjectCommand extends Command{
+ final static Logger logger = LoggerFactory.getLogger("project-json_command");
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+
+ ProjectManager.singleton.setBusy(true);
+ try {
+
+ long projectID = Project.generateID();
+ logger.info("Importing existing project using new ID {}", projectID);
+
+ //ProjectManager.singleton.loadProjectMetadata(projectID);
+
+ //ProjectMetadata pm = ProjectManager.singleton.getProjectMetadata(projectID);
+ //pm.setName("test"+projectID);
+
+ Properties parameters = ParsingUtilities.parseUrlParameters(request);
+
+ ImportingJob job = ImportingManager.createJob();
+ JSONObject config = job.getOrCreateDefaultConfig();
+ ImportingUtilities.loadDataAndPrepareJob(
+ request, response, parameters, job, config);
+
+ logger.info("config......", config);
+
+ String format = "text/json";
+
+ JSONObject optionObj = null;
+ String optionsString = request.getParameter("options");
+ if (optionsString != null && !optionsString.isEmpty()) {
+ optionObj = ParsingUtilities.evaluateJsonStringToObject(optionsString);
+ } else {
+ Format formatRecord = ImportingManager.formatToRecord.get(format);
+ optionObj = formatRecord.parser.createParserUIInitializationData(
+ job, ImportingUtilities.getSelectedFileRecords(job), format);
+ }
+ adjustLegacyOptions(format, parameters, optionObj);
+
+ //String projectName = parameters.getProperty("project-name");
+ //if (projectName != null && !projectName.isEmpty()) {
+ // JSONUtilities.safePut(optionObj, "projectName", projectName);
+ JSONUtilities.safePut(optionObj, "projectName", "test"+projectID);
+ //}
+
+ List<Exception> exceptions = new LinkedList<Exception>();
+
+ long projectId = ImportingUtilities.createProject(job, "text/json", optionObj, exceptions, true);
+
+ HttpUtilities.redirect(response, "/project?project=" + projectId);
+ } catch (Exception e) {
+ respondWithErrorPage(request, response, "Failed to import file", e);
+ } finally {
+ ProjectManager.singleton.setBusy(false);
+ }
+
+ }
+
+ static private void adjustLegacyOptions(String format, Properties parameters, JSONObject optionObj) {
+ if (",".equals(parameters.getProperty("separator"))) {
+ JSONUtilities.safePut(optionObj, "separator", ",");
+ } else if ("\\t".equals(parameters.getProperty("separator"))) {
+ JSONUtilities.safePut(optionObj, "separator", "\t");
+ }
+
+ adjustLegacyIntegerOption(format, parameters, optionObj, "ignore", "ignoreLines");
+ adjustLegacyIntegerOption(format, parameters, optionObj, "header-lines", "headerLines");
+ adjustLegacyIntegerOption(format, parameters, optionObj, "skip", "skipDataLines");
+ adjustLegacyIntegerOption(format, parameters, optionObj, "limit", "limit");
+
+ adjustLegacyBooleanOption(format, parameters, optionObj, "guess-value-type", "guessCellValueTypes", false);
+ adjustLegacyBooleanOption(format, parameters, optionObj, "ignore-quotes", "processQuotes", true);
+ }
+
+ static private void adjustLegacyIntegerOption(
+ String format, Properties parameters, JSONObject optionObj, String legacyName, String newName) {
+
+ String s = parameters.getProperty(legacyName);
+ if (s != null && !s.isEmpty()) {
+ try {
+ JSONUtilities.safePut(optionObj, newName, Integer.parseInt(s));
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+ }
+
+ static private void adjustLegacyBooleanOption(
+ String format,
+ Properties parameters,
+ JSONObject optionObj,
+ String legacyName,
+ String newName,
+ boolean invert) {
+
+ String s = parameters.getProperty(legacyName);
+ if (s != null && !s.isEmpty()) {
+ JSONUtilities.safePut(optionObj, newName, Boolean.parseBoolean(s));
+ }
+ }
+}
36 src/com/google/refine/granatumExtension/commands/column/AddColumnByFetchingURLsCommand.java
View
@@ -0,0 +1,36 @@
+package com.google.refine.granatumExtension.commands.column;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.json.JSONObject;
+
+import com.google.refine.commands.EngineDependentCommand;
+import com.google.refine.model.AbstractOperation;
+import com.google.refine.model.Project;
+import com.google.refine.operations.cell.TextTransformOperation;
+import com.google.refine.operations.column.ColumnAdditionByFetchingURLsOperation;
+
+public class AddColumnByFetchingURLsCommand extends EngineDependentCommand {
+ @Override
+ protected AbstractOperation createOperation(Project project,
+ HttpServletRequest request, JSONObject engineConfig) throws Exception {
+
+ String baseColumnName = "Compound";//request.getParameter("baseColumnName");
+ String urlExpression = "grel:\"http://vmdhcls04.deri.ie/uuid.php\"";//request.getParameter("urlExpression");
+ String newColumnName = "uuid";//request.getParameter("newColumnName");
+ int columnInsertIndex = 1;//Integer.parseInt(request.getParameter("columnInsertIndex"));
+ int delay = 5000;//Integer.parseInt(request.getParameter("delay"));
+ String onError = "set-to-blank";//request.getParameter("onError");
+
+ return new ColumnAdditionByFetchingURLsOperation(
+ engineConfig,
+ baseColumnName,
+ urlExpression,
+ TextTransformOperation.stringToOnError(onError),
+ newColumnName,
+ columnInsertIndex,
+ delay
+ );
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.