Search in sources :

Example 6 with AddComment

use of org.wso2.carbon.humantask.core.engine.commands.AddComment in project jaggery by wso2.

the class RegistryHostObject method jsFunction_addComment.

public static void jsFunction_addComment(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws ScriptException {
    String functionName = "addComment";
    int argsCount = args.length;
    if (argsCount != 2) {
        HostObjectUtil.invalidNumberOfArgs(hostObjectName, functionName, argsCount, false);
    }
    if (!(args[0] instanceof String)) {
        HostObjectUtil.invalidArgsError(hostObjectName, functionName, "1", "string", args[0], false);
    }
    if (!(args[1] instanceof String)) {
        HostObjectUtil.invalidArgsError(hostObjectName, functionName, "2", "string", args[1], false);
    }
    RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
    try {
        registryHostObject.registry.addComment((String) args[0], new org.wso2.carbon.registry.core.Comment((String) args[1]));
    } catch (RegistryException e) {
        throw new ScriptException(e);
    }
}
Also used : org.wso2.carbon.registry.core(org.wso2.carbon.registry.core) ScriptException(org.jaggeryjs.scriptengine.exceptions.ScriptException) RegistryException(org.wso2.carbon.registry.api.RegistryException)

Aggregations

APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)3 SQLException (java.sql.SQLException)2 BeforeTest (org.testng.annotations.BeforeTest)2 Test (org.testng.annotations.Test)2 APIStore (org.wso2.carbon.apimgt.core.api.APIStore)2 ApiDAO (org.wso2.carbon.apimgt.core.dao.ApiDAO)2 API (org.wso2.carbon.apimgt.core.models.API)2 Comment (org.wso2.carbon.apimgt.core.models.Comment)2 CompositeAPI (org.wso2.carbon.apimgt.core.models.CompositeAPI)2 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 URI (org.apache.axis2.databinding.types.URI)1 ScriptException (org.jaggeryjs.scriptengine.exceptions.ScriptException)1 APICommentException (org.wso2.carbon.apimgt.core.exception.APICommentException)1 CommentDAO (org.wso2.carbon.humantask.core.dao.CommentDAO)1 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)1 AddComment (org.wso2.carbon.humantask.core.engine.commands.AddComment)1 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)1 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)1 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)1