Menu

Add states to change mgmt.

2011-10-11
2015-01-27
  • Brad Van Duker

    Brad Van Duker - 2011-10-11

    I'm trying to modify the change management process but have hit some snags.  For now, I'm just trying to add the state "my_new_state".

    First, I added the string "my_new_state" to the enum listing in the database's change.status field.

    Next, I added the following code to the Change class in the model.itop-change-mgmt.php file:

    MetaModel::Init_DefineState(
                            "my_new_state", 
                            array(
                                "attribute_inherit" => 'new',
                                "attribute_list" => array(),
                            )
                    );
    

    Next, in the same class, I add a definition for an event:

    MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_my_new_event", array()));
    

    For testing, I just want to make sure things work by going from the states new -> my_new_state -> end.  I add the following to the NormalChange class:

    MetaModel::Init_DefineTransition("new", "ev_my_new_event", array("target state"=>"my_new_state", "actions"=>array(), "user_restriction"=>null));
                    MetaModel::Init_DefineTransition("my_new_state", "ev_finish", array("target start"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
    

    Unfortunately, I get the following error when I try to test my new state:

    2011-10-11 21:01:11 | Error | Invalid state '' for class 'NormalChange', expecting a value in {new, validated, rejected, assigned, plannedscheduled, approved, notapproved, implemented, monitored, closed, my_new_state}

    If I'm reading this right, it's trying to pass in an empty string as the 'status' value, which isn't allowed.  What modification am I missing to make this work?

    I've also tried a setup where "my_new_state" tries to mimic the behavior of the "rejected" state, but get the same error.

     
  • Denis

    Denis - 2011-10-11

    Hello,

    Did you apply the changes in the database structure as well ?
    The "state" attribute is defined as an enum in MySQL and therefore its definition must be modified.

    You can either:

    - Run the setup again, by removing the read-only flag on the file config-itop.php and point your browser to http://<your_itop>/setup
    - Or let the "Toolkit" to apply the changes for you https://sourceforge.net/apps/mediawiki/itop/index.php?title=Toolkit_for_modifying_the_data_model

    Hope this helps,

    - Denis

     
  • Brad Van Duker

    Brad Van Duker - 2011-10-11

    First thing I did was change the database structure.  In the change table is a status enum, where I added "my_new_state".

    ENUM('approved','assigned','closed','my_new_state','implemented','monitored','new','notapproved','plannedscheduled','rejected','validated')

     
  • Brad Van Duker

    Brad Van Duker - 2011-10-11

    While we're on the subject, I forgot to mention that I also changed the line about the status field in the metamodel of the Change class.

    MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('approved,assigned,closed,my_new_state,implemented,monitored,new,notapproved,plannedscheduled,rejected,validated'), "sql"=>"status", "default_value"=>"new", "is_null_allowed"=>true, "depends_on"=>array())));
    
     
  • Brad Van Duker

    Brad Van Duker - 2011-10-11

    I figured it out.  There's a typo in the transition definition.  "target start" should be "target_state" and "target state" should be "target_state"

     
  • Sameer

    Sameer - 2015-01-27

    hi i am new to this will you please help on how to add new value to status field in change mgmt process

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.