Exemplo n.º 1
0
    def _deserialize_step(self, s, chain):
        matches = s.get('match', {})
        before = Process.query.filter_by(identifier=s.get('before')).one()
        after = Process.query.filter_by(identifier=s.get('after')).one()

        step = get_or_create(session, Step, before=before, after=after, chain=chain)[0]

        step.matches = self._deserialize_step_matches(step, matches, before, after)

        return step
Exemplo n.º 2
0
 def _deserialize_parameter(model, process, parameter):
     format_name = parameter.get('format')
     data_type = parameter.get('dataType')
     return get_or_create(
         session,
         model,
         identifier=parameter.get('identifier'),
         title=parameter.get('title'),
         abstract=parameter.get('abstract'),
         process=process,
         format=Format.query.filter_by(
             name=format_name).one() if format_name else None,
         data_type=DataType.query.filter_by(
             name=data_type).one() if data_type else None)[0]
Exemplo n.º 3
0
    def deserialize(self, data, instance):
        instance.identifier = data.get('identifier', instance.identifier)
        instance.title = data.get('title', instance.title)
        instance.abstract = data.get('abstract', instance.abstract)
        instance.version = data.get('version', instance.version)

        steps = data.get('steps', [])
        metadata = data.get('metadata', [])
        publish = data.get('publish', [])

        instance.meta_data = [get_or_create(session, Metadata, value=m)[0] for m in metadata]

        instance.steps = self._deserialize_steps(instance, steps)

        instance.publishables = [
            self._deserialize_publishable(p, o) for p, outputs in publish.iteritems() for o in outputs
        ]

        return instance
Exemplo n.º 4
0
    def deserialize(self, data, instance):
        instance.id = None
        instance.identifier = data.get('identifier', instance.identifier)
        instance.title = data.get('title', instance.title)
        instance.abstract = data.get('abstract', instance.abstract)
        instance.version = data.get('version', instance.version)

        inputs = data.get('inputs', [])
        outputs = data.get('outputs', [])
        metadata = data.get('metadata', [])

        instance.inputs = [
            self._deserialize_parameter(Input, instance, p) for p in inputs
        ]
        instance.outputs = [
            self._deserialize_parameter(Output, instance, p) for p in outputs
        ]
        instance.meta_data = [
            get_or_create(session, Metadata, value=m)[0] for m in metadata
        ]

        return instance
Exemplo n.º 5
0
 def _deserialize_step_match(self, output, input, before, after, step):
     output = Output.query.filter_by(process=before, identifier=output).one()
     input = Input.query.filter_by(process=after, identifier=input).one()
     return get_or_create(session, StepMatch, input=input, output=output, step=step)[0]