Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Script based value set

I'm trying to limit the values presented in an enumeration drop-down box depending on the category selected in the filed against attribute. Here is the java script source code that I've been testing:

dojo.provide("com.ibm.issr.iet.providers.CategoryProductValueSet");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("com.ibm.issr.iet.providers.CategoryProductValueSet", null, {

getValueSet: function(attributeId, workItem, configuration) {

var category= workItem.getValue(WorkItemAttributes.FILED_AGAINST);
var products= [];

if (category == "Master Area/Cat1") {
console.log("category value set: category 1");
products.push("product.literal.l2");
products.push("product.literal.l4");
}
else if (category == "Master Area/Cat2") {
products.push("product.literal.l4");
products.push("product.literal.l6");
}
else if (category == "Master Area/Cat3") {
products.push("product.literal.l6");
products.push("product.literal.l8");
}
else if (category == "Master Area/Cat4") {
products.push("product.literal.l4");
products.push("product.literal.l6");
products.push("product.literal.l8");
}
console.log("category value set: executing");
return products;
}
});
})();

It seems that the script is not called when testing from the Eclipse UI. In the web UI, I get the following exception in the ccm.log. Has anyone successfully used script based value sets?


2011-09-01 16:42:02,828 ERROR com.ibm.team.workitem.common - Error invoking value set provider 'com.ibm.team.workitem.valueproviders.VALUE_SET_PROVIDER._vTnEQNQbEeC1b-cWX25QJA'
org.mozilla.javascript.JavaScriptException: ({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"}#414)
at org.mozilla.javascript.gen.c2._c18({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"}:413)
at org.mozilla.javascript.gen.c2.call({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"})
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.mozilla.javascript.gen.c2.call({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"resources\\_base\\_loader", "name":"loader.js"})
at com.ibm.team.rtc.common.scriptengine.environment.dojo.DojoFeature$3.call(DojoFeature.java:179)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1862)
at com.ibm.team.rtc.common.scriptengine.environment.ScriptingHelperImplementation$4.run(ScriptingHelperImplementation.java:141)
at com.ibm.team.rtc.common.scriptengine.environment.ScriptingHelperImplementation$4.run(ScriptingHelperImplementation.java:1)
at com.ibm.team.rtc.common.scriptengine.environment.AbstractScriptEnvironment.execute(AbstractScriptEnvironment.java:74)
at com.ibm.team.rtc.common.scriptengine.environment.ScriptingHelperImplementation.dojoRequire(ScriptingHelperImplementation.java:138)
at com.ibm.team.rtc.common.scriptengine.environment.ScriptingHelperImplementation.getConstructor(ScriptingHelperImplementation.java:151)
at com.ibm.team.rtc.common.scriptengine.ScriptUtilities$1.run(ScriptUtilities.java:30)
at com.ibm.team.rtc.common.scriptengine.environment.AbstractScriptEnvironment.execute(AbstractScriptEnvironment.java:74)
at com.ibm.team.rtc.common.scriptengine.ScriptUtilities.newInstance(ScriptUtilities.java:27)
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.getProvider(ScriptAttributeValueProvider.java:100)
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.getValueSet(ScriptAttributeValueProvider.java:70)
at com.ibm.team.workitem.common.internal.attributeValueProviders.AttributeValueProviderRegistry$SafeValueSetProvider.getValueSet(AttributeValueProviderRegistry.java:63)
at com.ibm.team.workitem.common.internal.model.impl.AttributeImpl.getValueSet(AttributeImpl.java:909)
at com.ibm.team.workitem.service.internal.rest.WorkItemRestService.getValues(WorkItemRestService.java:1414)
at com.ibm.team.workitem.service.internal.rest.WorkItemRestService.getAllValues(WorkItemRestService.java:1318)
at com.ibm.team.workitem.service.internal.rest.WorkItemRestService.getWorkItemEditableProperties(WorkItemRestService.java:1263)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy845.getWorkItemEditableProperties(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.doModelledRestService(AbstractTeamServerServlet.java:504)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest2(AbstractTeamServerServlet.java:1867)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest(AbstractTeamServerServlet.java:1723)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.service(AbstractTeamServerServlet.java:1632)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:120)
at com.ibm.team.repository.server.servletbridge.JazzServlet.service(JazzServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:811)

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936

Question asked: Sep 13 '11, 4:32 p.m.

Question was seen: 4,953 times

Last updated: Sep 13 '11, 4:32 p.m.

Confirmation Cancel Confirm