Esempio n. 1
0
def index(req):
    items = []
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if req.zato.cluster_id and req.method == 'GET':
        def_ids = get_definition_list(req.zato.client, req.zato.cluster,
                                      'jms-wmq')
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        for item in req.zato.client.invoke(
                'zato.outgoing.jms-wmq.get-list',
            {'cluster_id': req.zato.cluster_id}):
            _item = OutgoingWMQ(item.id, item.name, item.is_active,
                                item.delivery_mode, item.priority,
                                item.expiration, item.def_id,
                                delivery_friendly_name[item.delivery_mode],
                                item.def_name)
            items.append(_item)

    return_data = {
        'zato_clusters': req.zato.clusters,
        'cluster_id': req.zato.cluster_id,
        'choose_cluster_form': req.zato.choose_cluster_form,
        'items': items,
        'create_form': create_form,
        'edit_form': edit_form,
    }

    return TemplateResponse(req, 'zato/outgoing/jms_wmq.html', return_data)
Esempio n. 2
0
def index(req):
    items = []
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if req.zato.cluster_id and req.method == 'GET':
        def_ids = get_definition_list(req.zato.client, req.zato.cluster, 'jms-wmq')
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        for item in req.zato.client.invoke('zato.outgoing.jms-wmq.get-list', {'cluster_id': req.zato.cluster_id}):
            _item = OutgoingWMQ(item.id, item.name, item.is_active, item.delivery_mode, 
                item.priority, item.expiration, item.def_id, delivery_friendly_name[item.delivery_mode], 
                item.def_name)
            items.append(_item)

    return_data = {'zato_clusters':req.zato.clusters,
        'cluster_id':req.zato.cluster_id,
        'choose_cluster_form':req.zato.choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        }

    return TemplateResponse(req, 'zato/outgoing/jms_wmq.html', return_data)
Esempio n. 3
0
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by('name').all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get('cluster')
    items = []
    
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if cluster_id and req.method == 'GET':
        
        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
        
        def_ids = _get_def_ids(cluster)
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id
        
        _, zato_message, soap_response  = invoke_admin_service(cluster, 'zato:outgoing.jms_wmq.get-list', zato_message)
        
        if zato_path('data.item_list.item').get_from(zato_message) is not None:
            
            for msg_item in zato_message.data.item_list.item:
                
                id = msg_item.id.text
                name = msg_item.name.text
                is_active = is_boolean(msg_item.is_active.text)
                delivery_mode = int(msg_item.delivery_mode.text)
                priority = msg_item.priority.text
                expiration = msg_item.expiration.text
                delivery_mode_text = delivery_friendly_name[delivery_mode]
                def_name = msg_item.def_name.text
                def_id = msg_item.def_id.text
                
                item =  OutgoingWMQ(id, name, is_active, delivery_mode, priority,
                    expiration, def_id, delivery_mode_text, def_name)
                items.append(item)

    return_data = {'zato_clusters':zato_clusters,
        'cluster_id':cluster_id,
        'choose_cluster_form':choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        }
    
    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, 'Returning render_to_response [{0}]'.format(return_data))

    return render_to_response('zato/outgoing/jms_wmq.html', return_data,
                              context_instance=RequestContext(req))
Esempio n. 4
0
def index(req):
    items = []
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')
    meta = None

    if req.zato.cluster_id and req.method == 'GET':
        def_ids = get_definition_list(req.zato.client, req.zato.cluster,
                                      'jms-wmq')
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        request = {
            'cluster_id': req.zato.cluster_id,
            'paginate': True,
            'cur_page': req.GET.get('cur_page', 1)
        }

        data, meta = parse_response_data(
            req.zato.client.invoke('zato.outgoing.jms-wmq.get-list', request))

        for item in data:
            _item = OutgoingWMQ(item.id, item.name, item.is_active,
                                item.delivery_mode, item.priority,
                                item.expiration, item.def_id,
                                delivery_friendly_name[item.delivery_mode],
                                item.def_name)
            items.append(_item)

    return_data = {
        'zato_clusters': req.zato.clusters,
        'cluster_id': req.zato.cluster_id,
        'search_form': req.zato.search_form,
        'items': items,
        'create_form': create_form,
        'edit_form': edit_form,
        'paginate': True,
        'meta': meta,
        'req': req,
    }

    return TemplateResponse(req, 'zato/outgoing/jms-wmq.html', return_data)
Esempio n. 5
0
def index(req):
    items = []
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if req.zato.cluster_id and req.method == 'GET':
        def_ids = _get_def_ids(req.zato.cluster)
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        zato_message, soap_response  = invoke_admin_service(req.zato.cluster, 'zato:outgoing.jms_wmq.get-list', {'cluster_id': req.zato.cluster_id})
        
        if zato_path('response.item_list.item').get_from(zato_message) is not None:
            for msg_item in zato_message.response.item_list.item:
                id = msg_item.id.text
                name = msg_item.name.text
                is_active = is_boolean(msg_item.is_active.text)
                delivery_mode = int(msg_item.delivery_mode.text)
                priority = msg_item.priority.text
                expiration = msg_item.expiration.text
                delivery_mode_text = delivery_friendly_name[delivery_mode]
                def_name = msg_item.def_name.text
                def_id = msg_item.def_id.text
                
                item = OutgoingWMQ(id, name, is_active, delivery_mode, priority, expiration, def_id, delivery_mode_text, def_name)
                items.append(item)

    return_data = {'zato_clusters':req.zato.clusters,
        'cluster_id':req.zato.cluster_id,
        'choose_cluster_form':req.zato.choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        }

    return TemplateResponse(req, 'zato/outgoing/jms_wmq.html', return_data)