예제 #1
0
    def add_child_fragment_flow(self, ff, flow, direction, Name=None, **kwargs):
        if Name is None:
            Name = flow['Name']
        f = LcFragment.new(Name, flow, direction, parent=ff, **kwargs)
        self.add_entity_and_children(f)

        return f
예제 #2
0
    def _do_load(self, catalog, fragments):
        for f in fragments:
            frag = LcFragment.from_json(catalog, f)
            self.add(frag)

        for f in fragments:
            frag = self[f['entityId']]
            frag.finish_json_load(catalog, f)
예제 #3
0
 def add_child_ff_from_exchange(self, ff, exchange, **kwargs):
     """
     Uses a process intermediate exchange to define a child flow to the process.  If the exchange's termination
     is non-null, then the child exchange will also be terminated.
     Want to use a background flow if one exists already
     :param ff:
     :param exchange:
     :return:
     """
     try:
         bg = next(f for f in self.fragments(background=True) if f.term.terminates(exchange))
         f = LcFragment.new(exchange.flow['Name'], exchange.flow, exchange.direction,
                            parent=ff, exchange_value=exchange.value, **kwargs)
         f.terminate(bg)
     except StopIteration:
         f = LcFragment.from_exchange(ff, exchange)
     self.add_entity_and_children(f)
     return f
예제 #4
0
 def create_fragment(self, flow, direction, Name=None, exchange_value=1.0, **kwargs):
     """
     flow must present in self._entities.  This method is for creating new fragments- for appending
     fragment Flows (i.e. fragments with parent entries), use add_child_fragment_flow
     :param flow:
     :param direction:
     :param Name: the fragment name (defaults to flow name)
     :param exchange_value:
     :return:
     """
     if Name is None:
         Name = flow['Name']
     f = LcFragment.new(Name, flow, direction, exchange_value=exchange_value, **kwargs)
     self.add_entity_and_children(f)
     return f