/procedures/meta/comments

Module to parse a route whose source step is a business step.

 2 module PARSE_BUSINESS_STEP

Method to parse a route whose source step is a business step.

 5   def parse_route_from_business_step( route_id )

Design note: The method used for validating the number of input and output routes for each step type.

If the business step does not have one inbound route ...

 9     if step_inbound_routes( route_source_step_id( route_id ) ).size != 1

... log the step as has having an unexpected number of inbound routes.

 12       logger.error "Business step with name #{route_source_step_name( route_id )} has #{step_inbound_routes( route_source_step_id( route_id ) ).size} inbound routes."

Otherwise, the business step does have one inbound route ...

 15     else

... we get the ID of the inbound route.

 18       inbound_route_id = step_first_inbound_route( route_source_step_id( route_id ) )

... if the inbound route to the source step has a status of 'UNTRAVERSABLE' ...

 21       if route_is_untraversable?( inbound_route_id )

... then “the bridge is closed” and we set the “roads off the bridge” as closed ...

... by setting the status of this route to be 'UNTRAVERSABLE' and the parsed attribute to true.

 25         update_route_hash( route_id, nil, 'UNTRAVERSABLE', true, nil, nil )

... otherwise, the inbound route to the source step not having a status of 'UNTRAVERSABLE' ...

 28       else

... if the source step has been actualised by a business item with a date in the past or a date of today ...

 31         if step_has_been_actualised_has_happened?( route_source_step_id( route_id ) )

... we set the route status to 'TRUE', the actualisation count to the actualisations has happened count of the business step and the parsed attribute to true.

 34           update_route_hash( route_id, nil, 'TRUE', true, route_source_step_actualised_has_happened_count( route_id ), nil )

... otherwise, the source step has not been actualised or has only been actualised by business items with dates in the future ....

 37         else

... and we set the route status to 'NULL', the actualisation count to 0 and the parsed attribute to true.

 40           update_route_hash( route_id, nil, 'NULL', true, 0, nil )
 41         end
 42       end
 43     end
 44   end
 45 end