CMDBuild Forum

Problema con metodo callfunction

Salve a tutti. Ho creato la seguente function sul database:

 

CREATE OR REPLACE FUNCTION myFunction(fieldname text, tablename text, fieldvalue int)

  RETURNS text AS

$BODY$

DECLARE

Out text;

BEGIN

EXECUTE 'SELECT "' || fieldname || '" FROM "'|| tablename || '" WHERE "Id" = ' || fieldvalue || ' LIMIT 1' INTO Out;

RETURN Out;

END;

$BODY$

  LANGUAGE plpgsql VOLATILE

  COST 100;

ALTER FUNCTION myFunction(text, text, int)

  OWNER TO myadmin;

GRANT EXECUTE ON FUNCTION myFunction(text, text, int) TO public;

 

Nel mio workflow utilizzo la seguente sintassi per invocarla, come da manuale:

 

spResultSet = cmdb.callFunction("myFunction")

.with("fieldname", "Email")

.with("tablename", "User")

.with("fieldvalue", "3")

.execute();

username = spResultSet.get("Email");

 

Ed ottengo la seguente eccezione:

 

Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute

 

Stessa cosa se provassi ad eseguire una function gia' esistente:

spResultSet = cmdb.callFunction("myFunction").execute().get("_cm_class_list");

 

Potreste aiutarmi?

Grazie.

Confermo lo stesso errore (CMDBuild 2.1 con Shark 4).
E' un bug conosciuto oppure c'e' qualche libreria da aggiungere?
Io sono alle prime armi ed ho creato un workflow di esempio seguendo il manuale.
Ho inserito in un task java questo codice:
 
spResultSet = cmdb.callFunction("_cm_zero_rownum_sequence").execute();
 
ed ottengo anche io la stessa eccezione:
 
"Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute"
 
Previously Francesca wrote:

Salve a tutti. Ho creato la seguente function sul database:

 

CREATE OR REPLACE FUNCTION myFunction(fieldname text, tablename text, fieldvalue int)

  RETURNS text AS

$BODY$

DECLARE

Out text;

BEGIN

EXECUTE 'SELECT "' || fieldname || '" FROM "'|| tablename || '" WHERE "Id" = ' || fieldvalue || ' LIMIT 1' INTO Out;

RETURN Out;

END;

$BODY$

  LANGUAGE plpgsql VOLATILE

  COST 100;

ALTER FUNCTION myFunction(text, text, int)

  OWNER TO myadmin;

GRANT EXECUTE ON FUNCTION myFunction(text, text, int) TO public;

 

Nel mio workflow utilizzo la seguente sintassi per invocarla, come da manuale:

 

spResultSet = cmdb.callFunction("myFunction")

.with("fieldname", "Email")

.with("tablename", "User")

.with("fieldvalue", "3")

.execute();

username = spResultSet.get("Email");

 

Ed ottengo la seguente eccezione:

 

Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute

 

Stessa cosa se provassi ad eseguire una function gia' esistente:

spResultSet = cmdb.callFunction("myFunction").execute().get("_cm_class_list");

 

Potreste aiutarmi?

Grazie.

 

Scusate, potreste cortesemente farmi sapere qualcosa?
Utilizziamo CMDBuild in azienda e siamo bloccati con le implementazioni.
Grazie.
 
Previously Elisa wrote:
Confermo lo stesso errore (CMDBuild 2.1 con Shark 4).
E' un bug conosciuto oppure c'e' qualche libreria da aggiungere?
Io sono alle prime armi ed ho creato un workflow di esempio seguendo il manuale.
Ho inserito in un task java questo codice:
 
spResultSet = cmdb.callFunction("_cm_zero_rownum_sequence").execute();
 
ed ottengo anche io la stessa eccezione:
 
"Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute"
 
Previously Francesca wrote:

Salve a tutti. Ho creato la seguente function sul database:

 

CREATE OR REPLACE FUNCTION myFunction(fieldname text, tablename text, fieldvalue int)

  RETURNS text AS

$BODY$

DECLARE

Out text;

BEGIN

EXECUTE 'SELECT "' || fieldname || '" FROM "'|| tablename || '" WHERE "Id" = ' || fieldvalue || ' LIMIT 1' INTO Out;

RETURN Out;

END;

$BODY$

  LANGUAGE plpgsql VOLATILE

  COST 100;

ALTER FUNCTION myFunction(text, text, int)

  OWNER TO myadmin;

GRANT EXECUTE ON FUNCTION myFunction(text, text, int) TO public;

 

Nel mio workflow utilizzo la seguente sintassi per invocarla, come da manuale:

 

spResultSet = cmdb.callFunction("myFunction")

.with("fieldname", "Email")

.with("tablename", "User")

.with("fieldvalue", "3")

.execute();

username = spResultSet.get("Email");

 

Ed ottengo la seguente eccezione:

 

Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute

 

Stessa cosa se provassi ad eseguire una function gia' esistente:

spResultSet = cmdb.callFunction("myFunction").execute().get("_cm_class_list");

 

Potreste aiutarmi?

Grazie.

 

 

Grazie per la risposta, ho risolto senza il vostro aiuto.
 
 
Previously Francesca wrote:
Scusate, potreste cortesemente farmi sapere qualcosa?
Utilizziamo CMDBuild in azienda e siamo bloccati con le implementazioni.
Grazie.
 
Previously Elisa wrote:
Confermo lo stesso errore (CMDBuild 2.1 con Shark 4).
E' un bug conosciuto oppure c'e' qualche libreria da aggiungere?
Io sono alle prime armi ed ho creato un workflow di esempio seguendo il manuale.
Ho inserito in un task java questo codice:
 
spResultSet = cmdb.callFunction("_cm_zero_rownum_sequence").execute();
 
ed ottengo anche io la stessa eccezione:
 
"Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute"
 
Previously Francesca wrote:

Salve a tutti. Ho creato la seguente function sul database:

 

CREATE OR REPLACE FUNCTION myFunction(fieldname text, tablename text, fieldvalue int)

  RETURNS text AS

$BODY$

DECLARE

Out text;

BEGIN

EXECUTE 'SELECT "' || fieldname || '" FROM "'|| tablename || '" WHERE "Id" = ' || fieldvalue || ' LIMIT 1' INTO Out;

RETURN Out;

END;

$BODY$

  LANGUAGE plpgsql VOLATILE

  COST 100;

ALTER FUNCTION myFunction(text, text, int)

  OWNER TO myadmin;

GRANT EXECUTE ON FUNCTION myFunction(text, text, int) TO public;

 

Nel mio workflow utilizzo la seguente sintassi per invocarla, come da manuale:

 

spResultSet = cmdb.callFunction("myFunction")

.with("fieldname", "Email")

.with("tablename", "User")

.with("fieldvalue", "3")

.execute();

username = spResultSet.get("Email");

 

Ed ottengo la seguente eccezione:

 

Error: org.cmdbuild.workflow.CMWorkflowException: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException: Sourced file: eval stream : Method Invocation execute

 

Stessa cosa se provassi ad eseguire una function gia' esistente:

spResultSet = cmdb.callFunction("myFunction").execute().get("_cm_class_list");

 

Potreste aiutarmi?

Grazie.