def isBusinessLinkPartiallyCompleted(self, explanation, business_link): """Returns True if given Business Link document is partially completed in the context of provided explanation. explanation -- an Order, Order Line, Delivery or Delivery Line or Applied Rule which implicitely defines a simulation subtree business_link -- a Business Link document """ # Return False if Business Link is not partially completed if not business_link.isPartiallyCompleted(explanation): return False predecessor_state = business_link.getPredecessor() if not predecessor_state: # This is a root business link, no predecessor # so no need to do any recursion return True if self.isTradeStatePartiallyCompleted(explanation, predecessor_state): # If predecessor state is globally partially completed for the # given explanation, return True # Please note that this is a specific case for a Business Process # built using asUnionBusinessProcess. In such business process # a business link may be partially completed even if its predecessor # state is not return True # Build the closure business process which only includes those business # links wich are directly related to the current business link but DO NOT # narrow down the explanation else we might narrow down so much that # it becomes an empty set closure_process = _getBusinessLinkClosure(self, explanation, business_link) return closure_process.isTradeStatePartiallyCompleted( explanation, predecessor_state)
def isBusinessLinkPartiallyCompleted(self, explanation, business_link): """Returns True if given Business Link document is partially completed in the context of provided explanation. explanation -- an Order, Order Line, Delivery or Delivery Line or Applied Rule which implicitely defines a simulation subtree business_link -- a Business Link document """ # Return False if Business Link is not partially completed if not business_link.isPartiallyCompleted(explanation): return False predecessor_state = business_link.getPredecessor() if not predecessor_state: # This is a root business link, no predecessor # so no need to do any recursion return True if self.isTradeStatePartiallyCompleted(explanation, predecessor_state): # If predecessor state is globally partially completed for the # given explanation, return True # Please note that this is a specific case for a Business Process # built using asUnionBusinessProcess. In such business process # a business link may be partially completed even if its predecessor # state is not return True # Build the closure business process which only includes those business # links wich are directly related to the current business link but DO NOT # narrow down the explanation else we might narrow down so much that # it becomes an empty set closure_process = _getBusinessLinkClosure(explanation, business_link) return closure_process.isTradeStatePartiallyCompleted(explanation, predecessor_state)
def isBusinessLinkPartiallyBuildable(self, explanation, business_link): """Returns True if any of the related Simulation Movement is buildable and if the predecessor trade state is partially completed. explanation -- an Order, Order Line, Delivery or Delivery Line or Applied Rule which implicitely defines a simulation subtree business_link -- a Business Link document """ # If everything is delivered, no need to build if business_link.isDelivered(explanation): return False # We must take the closure cause only way to combine business process closure_process = _getBusinessLinkClosure(self, explanation, business_link) predecessor = business_link.getPredecessor() return closure_process.isTradeStatePartiallyCompleted(predecessor)