Error-
NoClassDefFoundError: "com.google.common.collect.Sets"
Solution-
Add guava-11.0.2.jar to WEB-INF/lib and add it to the build path.
public class TreeMap extends Visualization<TreeMap.Options>
{
public static class Options extends AbstractDrawOptions {
public static Options create() {
return JavaScriptObject.createObject().cast();
}
protected Options() { }
}
public static final String PACKAGE = "treemap";
public TreeMap() {
super();
}
public TreeMap(AbstractDataTable data, Options options) {
super(data, options);
}
@Override
protected native JavaScriptObject createJso(Element parent) /*-{
return new $wnd.google.visualization.TreeMap(parent);
}-*/;
public final void addOnMouseOverHandler(OnMouseOverHandler handler) {
Handler.addHandler(this, "onmouseover", handler);
}
public final void addOnMouseOutHandler(OnMouseOutHandler handler) {
Handler.addHandler(this, "onmouseout", handler);
}
}
A basic script to loop over an array in psql-
CREATE OR REPLACE FUNCTION func1(n character varying, v character varying)
RETURNS integer AS
$BODY$
DECLARE
return_code integer;
BEGIN
RAISE NOTICE '(%,%)', n, v;
return_code := 1;
RETURN return_code;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN -1;
END;
$BODY$
LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION func2()
RETURNS integer AS
$BODY$
DECLARE
return_code integer;
pairs varchar[][] := array[['key2','val2'],
['key1','val2']];
BEGIN
FOR i IN array_lower(pairs, 1) .. array_upper(pairs, 1)
LOOP
--RAISE NOTICE '%,%',pairs[i][1]::varchar, pairs[i][2]::varchar;
PERFORM func1(pairs[i][1]::varchar, pairs[i][2]::varchar);
END LOOP;
return 1;
END;
$BODY$
LANGUAGE plpgsql;
SELECT * from func2();