Name
global.ChangeRequestStateModel_emergency
Description
This script include represents the state model for emergency changes. The script include ChangeRequestStateHandler controls the transitioning between states using this model to determine what transitions are allowed. The script include ChangeRequestStateModelSNC_emergency , which this one extends, contains the implementation for all the moving and canMove functions. Model structure using the first property draft draft - current state the change request is in nextState - the state the change request can move to without specifying a state authorize - a state the change request can move to when in draft if this.toAuthorize_canMove() returns true - when the change request moves to authorize, this.toAuthorize_moving() is called scheduled - works in the exact same way that authorize does canceled - works in the exact same way that authorize does ChangeRequestStateHandler keeps a mapping of these friendly state names with their respective numeric value STATE_NAMES { -5 draft , -4 assess , -3 authorize , -2 scheduled , -1 implement , 0 review , 3 closed , 4 canceled }
Script
var ChangeRequestStateModel_emergency = Class.create();
ChangeRequestStateModel_emergency.prototype = Object.extendsObject(ChangeRequestStateModelSNC_emergency, {
draft: {
nextState: [ "authorize" ],
authorize: {
moving: function() {
return this.toAuthorize_moving();
},
canMove: function() {
return this.toAuthorize_canMove();
}
},
scheduled: {
moving: function() {
return this.toScheduled_moving();
},
canMove: function() {
return this.toScheduled_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
authorize: {
nextState: [ "scheduled" ],
draft: {
moving: function() {
return this.toDraft_moving();
},
canMove: function() {
return this.toDraft_canMove();
}
},
scheduled: {
moving: function() {
return this.toScheduled_moving();
},
canMove: function() {
return this.toScheduled_canMove();
}
},
review: {
moving: function() {
return this.toReview_moving();
},
canMove: function() {
return this.toReview_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
scheduled: {
nextState: [ "implement" ],
implement: {
moving: function() {
return this.toImplement_moving();
},
canMove: function() {
return this.toImplement_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
implement: {
nextState: [ "review" ],
review: {
moving: function() {
return this.toReview_moving();
},
canMove: function() {
return this.toReview_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
review: {
nextState: [ "closed" ],
closed: {
moving: function() {
return this.toClosed_moving();
},
canMove: function() {
return this.toClosed_canMove();
}
}
},
closed: {},
canceled: {},
type: "ChangeRequestStateModel_emergency"
});
Sys ID
462be7f1cb200200d71cb9c0c24c9cf0