RTC javascript dojo
Hi,
I have a RTC javascript code that set Timestamp Custome attributes. What is the dojo.require("com.ibm.team.workitem.shared.common.BigDecimal"); istruction that I have on the script (other people wrote the script and I'm analyzing the script.
thanks in advance for help !
here an extract of the code :
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2011. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
dojo.provide("com.ibm.example.workitems.providers.setDate");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.shared.common.BigDecimal");
(function() {
var doDebug = false;
var scriptname = "setDate";
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.ibm.example.workitems.providers.setDate", null, {
getValue: function(attributeId, workItem, configuration) {
var wiType = workItem.getValue(WorkItemAttributes.TYPE);
if ((wiType=="defect")||(wiType=="enhancement"))
{
debug("This is a defect...");
debug("Processing attributes for automatic values changes...");
var currentState = workItem.getValue(WorkItemAttributes.STATE);
var currentAttributeValue = workItem.getValue(attributeId);
var currentDate = new Date();
if (attributeId == "com.ibm.team.custom.acg.L3closingdateD")
{
// Processing L3_ClosingDate
debug("Processing L3_ClosingDate...");
var L3_ClosingDate=dojo.date.stamp.fromISOString(workItem.getValue('com.ibm.team.custom.acg.L3closingdateD'));
var L3_SpecialistLabel=workItem.getLabel("l3");
var resolution=workItem.getValue(WorkItemAttributes.RESOLUTION);
// if ((state= Fixed) && (L3Specialist!=Unassigned) && (L3_Close_date==null)
// then L3_Close_date=date
if ((currentState == "acg.ticketWorkflow.state.s10") && ((L3_SpecialistLabel!="") && (L3_SpecialistLabel!="Unassigned")) && (L3_ClosingDate==null))
{
debug("State=Fixed, L3Specialist=Assigned, L3_ClosingDate=Unassigned ---> Setting L3_ClosingDate to current date");
return dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
}
.............
.........................................
.....
Many thanks!
I have a RTC javascript code that set Timestamp Custome attributes. What is the dojo.require("com.ibm.team.workitem.shared.common.BigDecimal"); istruction that I have on the script (other people wrote the script and I'm analyzing the script.
thanks in advance for help !
here an extract of the code :
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2011. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
dojo.provide("com.ibm.example.workitems.providers.setDate");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.shared.common.BigDecimal");
(function() {
var doDebug = false;
var scriptname = "setDate";
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.ibm.example.workitems.providers.setDate", null, {
getValue: function(attributeId, workItem, configuration) {
var wiType = workItem.getValue(WorkItemAttributes.TYPE);
if ((wiType=="defect")||(wiType=="enhancement"))
{
debug("This is a defect...");
debug("Processing attributes for automatic values changes...");
var currentState = workItem.getValue(WorkItemAttributes.STATE);
var currentAttributeValue = workItem.getValue(attributeId);
var currentDate = new Date();
if (attributeId == "com.ibm.team.custom.acg.L3closingdateD")
{
// Processing L3_ClosingDate
debug("Processing L3_ClosingDate...");
var L3_ClosingDate=dojo.date.stamp.fromISOString(workItem.getValue('com.ibm.team.custom.acg.L3closingdateD'));
var L3_SpecialistLabel=workItem.getLabel("l3");
var resolution=workItem.getValue(WorkItemAttributes.RESOLUTION);
// if ((state= Fixed) && (L3Specialist!=Unassigned) && (L3_Close_date==null)
// then L3_Close_date=date
if ((currentState == "acg.ticketWorkflow.state.s10") && ((L3_SpecialistLabel!="") && (L3_SpecialistLabel!="Unassigned")) && (L3_ClosingDate==null))
{
debug("State=Fixed, L3Specialist=Assigned, L3_ClosingDate=Unassigned ---> Setting L3_ClosingDate to current date");
return dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
}
.............
.........................................
.....
Many thanks!
Accepted answer
"dojo.require" means loading modules before using them. It's similar to importing packages in Java.
http://dojotoolkit.org/reference-guide/1.7/dojo/require.html
The line
http://dojotoolkit.org/reference-guide/1.7/dojo/require.html
The line
dojo.require("com.ibm.team.workitem.shared.common.BigDecimal");means the code loads the named module, but I cannot see it being used in the code that you posted.