Return a workflow object from id.
163172
def get(cls, id_):
        """"""
        with db.session.no_autoflush:
            query = cls.dbmodel.query.filter_by(id=id_)
            try:
                model = query.one()
            except NoResultFound:
                raise WorkflowsMissingObject("No object for for id {0}".format(
                    id_
                ))
            return cls(model)
409490
def workflow_close(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)
1300430
def get(self, id):
        """"""
        params = {'q': 'id:%s' % str(id), 'wt': 'python'}
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data['response']['numFound'] > 0:
            return data['response']['docs'][0]
        return None
399950
def from_json(cls, text):
        """"""

        d = json.loads(text)

        meta = d.get('meta', {})
        workflow = cls(name=meta.get('name'), description=meta.get('description'))

        for workflow_input in d.get('inputs', []):
            parameter_cls = Parameter.by_id(workflow_input['type'])

            args = [workflow_input['name']]
            kwargs = {'required': True}
            if workflow_input.get('args'):
                args = workflow_input['args'][0] + args
                kwargs.update(workflow_input['args'][1])
                args, kwargs = parameter_cls.deserialize_args(args, kwargs)

            workflow.inputs.append(parameter_cls(*args, **kwargs))

        for node in d.get('workflow', []):
            node_inputs = {}
            for k, v in six.iteritems(node.get('inputs', {})):
                node_inputs[k] = (v['source'], v.get('input') or v.get('node'))

            workflow.add_node(node['id'], Task.by_name(node['task'])(), node_inputs)

        for output in d.get('outputs', []):
            node = output['node']
            node_parameters = ParameterCollection(workflow.nodes_by_id[node[0]].task.outputs)

            # Add parameter to workflow output
            output_param = copy.copy(node_parameters.by_name[node[1]])
            output_param.name = output['name']
            workflow.outputs.append(output_param)

            workflow.map_output(node[0], node[1], output['name'])

        return workflow
265391
def get(self, request, *args, **kwargs):
        """"""
        try:
            context = self.get_context_data(**kwargs)
        except exceptions.NotAvailable:
            exceptions.handle(request)
        self.set_workflow_step_errors(context)
        return self.render_to_response(context)
642896
def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
595223
def get(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'get', url_params={'id': id})
768502
def get_wegobject_by_id(self, id):
        '''
        
        '''
        def creator():
            res = crab_gateway_request(
                self.client, 'GetWegobjectByIdentificatorWegobject', id
            )
            if res == None:
                raise GatewayResourceNotFoundException()
            return Wegobject(
                res.IdentificatorWegobject,
                res.AardWegobject,
                (res.CenterX, res.CenterY),
                (res.MinimumX, res.MinimumY, res.MaximumX, res.MaximumY),
                Metadata(
                    res.BeginDatum,
                    res.BeginTijd,
                    self.get_bewerking(res.BeginBewerking),
                    self.get_organisatie(res.BeginOrganisatie)
                )
            )
        if self.caches['short'].is_configured:
            key = 'GetWegobjectByIdentificatorWegobject#%s' % (id)
            wegobject = self.caches['short'].get_or_create(key, creator)
        else:
            wegobject = creator()
        wegobject.set_gateway(self)
        return wegobject
690581
@RequestMapping(method = RequestMethod.GET, value = "/workflowInstance/{woinRefNum}",
            produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE})
    public ResponseEntity<WorkflowInstanceRestModel> find( @PathVariable long woinRefNum ){
        WorkflowInstanceState woin = facade.findWorkflowInstance( woinRefNum, null );
        if( woin == null ){
            return new ResponseEntity<>( HttpStatus.NOT_FOUND );
        }
        else{
            return new ResponseEntity<>( createInstanceModel( woin ), HttpStatus.OK );
        }
    }
505240
def from_id(cls, id):
        """"""
        from furious.context import Context

        # TODO: Handle exceptions and retries here.
        entity = cls.get_by_id(id)
        if not entity:
            raise FuriousContextNotFoundError(
                "Context entity not found for: {}".format(id))

        return Context.from_dict(entity.context)
721005
def _extract_id_from_batch_response(r, name='id'):
        """"""
        names = name + 's'
        if names in r:
            # soon-to-be deprecated batch reponse
            if 'errors' in r and r['errors']:
                raise GeneralException(r['errors'][0]['desc'])
            id = r[names][0]
        else:
            # new-style simplified api response
            id = r[name]
        return int(id)
504084
def get_coordinator():
    """"""
    workflow_queue = Queue.Queue()
    complete_queue = Queue.Queue()
    coordinator = WorkflowThread(workflow_queue, complete_queue)
    coordinator.register(WorkflowItem, workflow_queue)
    return coordinator
1352901
def by_id(self, id):
        """"""
        path = partial(_path, self.adapter)
        path = path(id)
        return self._get(path)
518677
def load_or_create_workflow(self):
        
        self.workflow_spec = self.get_worfklow_spec()
        return self._load_workflow() or self.create_workflow()
433565
def _request(self, method, identifier, key=None, value=None):
        """"""
        params = {'id': identifier}
        if key is not None and value is not None:
            params[key] = value
        result = yield from self._transact(method, params)
        return result.get(key)
395317
def workflow_states_column(self, obj):
        
        workflow_states = models.WorkflowState.objects.filter(
            content_type=self._get_obj_ct(obj),
            object_id=obj.pk,
        )
        return ', '.join([unicode(wfs) for wfs in workflow_states])
236844
def retrieve_by_id(self, id_):
        """"""
        items_with_id = [item for item in self if item.id == int(id_)]
        if len(items_with_id) == 1:
            return items_with_id[0].retrieve()