Name

global.ChangeRequestStateModel_normal

Description

This script include represents the state model for normal changes. The script include ChangeRequestStateHandler controls the transitioning between states using this model to determine what transitions are allowed. The script include ChangeRequestStateModelSNC_normal , 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 assess - a state the change request can move to when in draft if this.toAssess.canMove() returns true - when the change request moves to assess, this.toAssess.moving() is called canceled - works in the exact same way that assess 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_normal = Class.create();
ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelSNC_normal, {
  draft: {
      nextState: [ "assess" ],

      assess: {
          moving: function() {
              return this.toAssess_moving();
          },

          canMove: function() {
              return this.toAssess_canMove();
          }
      },

      canceled: {
          moving: function() {
              return this.toCanceled_moving();
          },

          canMove: function() {
              return this.toCanceled_canMove();
          }
      }
  },

  assess: {
      nextState: [ "authorize" ],

      draft: {
          moving: function() {
              return this.toDraft_moving();
          },

          canMove: function() {
              return this.toDraft_canMove();
          }
      },

      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();
          }
      },

      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_normal"
});

Sys ID

ce12be37cb100200d71cb9c0c24c9c2a

Offical Documentation

Official Docs: