Unable to get calculated attribute working
I followed the example on the Wiki.
Under <data>, I have:
under <configuration-data xmlns="http://com.ibm.team.workitem/workitemTypes" id="com.ibm.team.workitem.configuration.workItemTypes">, I have:
under <attributeDefinitions>, I have
under the presentations section, I have:
under the enumerations, I have:
I uploaded the ExposureProvider.js sample to the attachments for the project area with the path /workitem/scripts/common/ExposureProvider.js
However, when I create a new Task and select a value for Risk Impact and Risk Probability, the exposure does not get updated. Saving doesn't change that. Am I missing something, or is there a way to debug why this is not working?
Thanks in advance.
Under <data>, I have:
<configuration-data xmlns="http://com.ibm.team.workitem/providers" id="com.ibm.team.workitem.configuration.providers">
<valueProviders>
<valueProvider id="exposure" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider" name="Exposure Provider">
<script class="com.example.common.ExposureProvider"/>
<impactAttribute id="riskImpact"/>
<probabilityAttribute id="riskProbability"/>
</valueProvider>
</valueProviders>
</configuration-data>
under <configuration-data xmlns="http://com.ibm.team.workitem/workitemTypes" id="com.ibm.team.workitem.configuration.workItemTypes">, I have:
<customAttributes category="com.ibm.team.workitem.workItemType">
<customAttribute id="riskProbability" name="Risk Probability" type="risk.probability"/>
<customAttribute id="riskImpact" name="Risk Impact" type="risk.impact"/>
<customAttribute id="riskExposure" name="Risk Exposure" type="long"/>
</customAttributes>
under <attributeDefinitions>, I have
<attributeDefinition id="riskExposure" name="Risk Exposure" readOnly="true" type="long">
<valueProvider providerId="exposure"/>
<dependsOn id="riskImpact"/>
<dependsOn id="riskProbability"/>
</attributeDefinition>
under the presentations section, I have:
<section id="com.ibm.team.workitem.section.details">
<presentation attributeId="riskImpact" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskProbability" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskExposure" kind="com.ibm.team.workitem.kind.long"/>
...
under the enumerations, I have:
<enumeration attributeTypeId="risk.probability">
<literal default="true" id="risk.probability.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal id="risk.probability.literal.000" name="0% - Will Not Occur"/>
<literal id="risk.probability.literal.020" name="20% - Highly Unlikely"/>
<literal id="risk.probability.literal.040" name="40% - Unlikely"/>
<literal id="risk.probability.literal.060" name="60% - Probable"/>
<literal id="risk.probability.literal.080" name="80% - Highly Probable"/>
<literal id="risk.probability.literal.100" name="100% - Will Occur"/>
</enumeration>
<enumeration attributeTypeId="risk.impact">
<literal default="true" icon="processattachment:/enumeration/unassigned.gif" id="risk.impact.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.1" name="Very Low"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.2" name="Low"/>
<literal icon="processattachment:/enumeration/medium.gif" id="risk.impact.literal.3" name="Medium"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.4" name="High"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.5" name="Very High"/>
</enumeration>
I uploaded the ExposureProvider.js sample to the attachments for the project area with the path /workitem/scripts/common/ExposureProvider.js
However, when I create a new Task and select a value for Risk Impact and Risk Probability, the exposure does not get updated. Saving doesn't change that. Am I missing something, or is there a way to debug why this is not working?
Thanks in advance.
6 answers
Some more information. I've found in the jazz.log the error below. Any ideas how to debug this?
2010-08-27 14:16:59,107 ERROR com.ibm.team.workitem.common - Error invoking value provider 'exposure'
org.mozilla.javascript.JavaScriptException: (loader.js#354)
at org.mozilla.javascript.gen.c159._c18(loader.js:353)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1831)
at com.ibm.team.rtc.common.scriptengine.util.JSUtils.dojoRequire(JSUtils.java:123)
...
2010-08-27 14:16:59,107 ERROR com.ibm.team.workitem.common - Error invoking value provider 'exposure'
org.mozilla.javascript.JavaScriptException: (loader.js#354)
at org.mozilla.javascript.gen.c159._c18(loader.js:353)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1831)
at com.ibm.team.rtc.common.scriptengine.util.JSUtils.dojoRequire(JSUtils.java:123)
...
Still more information:
In the server/tomcat/work/Catalina/localhost/jazz/eclipse/workspace/.metadata/.log file there is this error:
It doesn't look like it uploaded the ExposureProvider.js file. The only place this file exists on the drive is in the directory I uploaded from. Any idea where this file should be located in the server and why it doesn't upload?
Thanks.
In the server/tomcat/work/Catalina/localhost/jazz/eclipse/workspace/.metadata/.log file there is this error:
!ENTRY com.ibm.team.rtc.common.scriptengine 4 0 2010-08-27 15:00:20.388
!MESSAGE Failed to execute script
!STACK 0
org.mozilla.javascript.JavaScriptException: Error: Could not load 'com.example.common.ExposureProvider'; last tried '../com/example/common/ExposureProvider.js' (loader.js#354)
at org.mozilla.javascript.gen.c159._c18(loader.js:353)
at org.mozilla.javascript.gen.c159.call(loader.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
It doesn't look like it uploaded the ExposureProvider.js file. The only place this file exists on the drive is in the directory I uploaded from. Any idea where this file should be located in the server and why it doesn't upload?
Thanks.
Solved. I was missing the teamserver.properties update.
Hi, Even i face the same error as shown above. Could you please tell me what changes have you done to the teamserver.properties file in ccm ?
I tried with
Dcom.ibm.team.repotools.rcp.allowInvalidBundles=true
com.ibm.team.workitem.process.scripts.enabled=true
Still it doesn't seem to recognize the custom advisor.
Solved. I was missing the teamserver.properties update.
Hi, Even i face the same error as shown above. Could you please tell me what changes have you done to the teamserver.properties file in ccm ?
I tried with
Dcom.ibm.team.repotools.rcp.allowInvalidBundles=true
com.ibm.team.workitem.process.scripts.enabled=true
Still it doesn't seem to recognize the custom advisor.
Hi, Pavithra.
Could you please start a new thread with details about your issue? Adam's issue seemed to only be missing the property to enable scripts to work. If updating that didn't fix your issue, it may be something else (and we'll need more details to be able to help).