Ejemplo n.º 1
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:channel.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)
                queue = msg_item.queue.text
                def_name = msg_item.def_name.text
                def_id = msg_item.def_id.text
                service_name = msg_item.service_name.text
                
                item =  ChannelWMQ(id, name, is_active, queue, def_id, def_name, service_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/channel/jms_wmq.html', return_data,
                              context_instance=RequestContext(req))
Ejemplo n.º 2
0
 def handle(self):
     create_form = CreateForm()
     edit_form = EditForm(prefix='edit')
     
     if self.req.zato.cluster_id:
         def_ids = get_definition_list(self.req.zato.client, self.req.zato.cluster, 'jms-wmq')
         create_form.set_def_id(def_ids)
         edit_form.set_def_id(def_ids)
     
     return {
         'create_form': create_form,
         'edit_form': edit_form,
     }
Ejemplo n.º 3
0
    def handle(self):
        create_form = CreateForm(req=self.req)
        edit_form = EditForm(prefix='edit', req=self.req)

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

        return {
            'create_form': create_form,
            'edit_form': edit_form,
        }
Ejemplo n.º 4
0
 def handle(self):
     create_form = CreateForm()
     edit_form = EditForm(prefix='edit')
     
     if self.req.zato.cluster_id:
         def_ids = _get_def_ids(self.req.zato.cluster)
         create_form.set_def_id(def_ids)
         edit_form.set_def_id(def_ids)
     
     return {
         'create_form': create_form,
         'edit_form': edit_form,
     }