Ejemplo n.º 1
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of pipeline instances for the queried pipeline.
     A document-level link relation, query list and a collection+json template are
     also added to the response.
     """
     queryset = self.get_pipeline_instances_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     # append query list
     query_list = [
         reverse('pipelineinstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'pipeline':
         reverse('pipeline-detail',
                 request=request,
                 kwargs={"pk": pipeline.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {
         'previous_plugin_inst_id': "",
         'title': "",
         'description': ""
     }
     param_names = pipeline.get_pipings_parameters_names()
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Ejemplo n.º 2
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(PACSFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('pacsfile-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {
         'path': "",
         'PatientID': "",
         'PatientName': "",
         'PatientBirthDate': "",
         'PatientAge': "",
         'PatientSex': "",
         'Modality': "",
         'StudyInstanceUID': "",
         'StudyDescription': "",
         'SeriesInstanceUID': "",
         'SeriesDescription': "",
         'pacs_name': ""
     }
     return services.append_collection_template(response, template_data)
Ejemplo n.º 3
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations.
     """
     response = super(FeedList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('feed-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     user = self.request.user
     links = {
         'plugins':
         reverse('plugin-list', request=request),
         'plugin_instances':
         reverse('allplugininstance-list', request=request),
         'pipelines':
         reverse('pipeline-list', request=request),
         'pipeline_instances':
         reverse('allpipelineinstance-list', request=request),
         'tags':
         reverse('tag-list', request=request),
         'uploadedfiles':
         reverse('uploadedfile-list', request=request),
         'user':
         reverse('user-detail', request=request, kwargs={"pk": user.id})
     }
     return services.append_collection_links(response, links)
Ejemplo n.º 4
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin.
     A collection+json template is also added to the response.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     # append query list
     query_list = [
         reverse('plugininstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'plugin':
         reverse('plugin-detail', request=request, kwargs={"pk": plugin.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     param_names = plugin.get_plugin_parameter_names()
     template_data = {'previous_id': ""}
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Ejemplo n.º 5
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json write template and document-level link relation are also
     added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     # append query list
     query_list = [
         reverse('comment-list-query-search',
                 request=request,
                 kwargs={"pk": feed.id})
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 6
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations, query list and a
     collection+json template to the response.
     """
     response = super(PluginList, self).list(request, *args, **kwargs)
     # append document-level link relations
     links = {
         'plugin_stars': reverse('pluginmetastar-list', request=request),
         'pipelines': reverse('pipeline-list', request=request)
     }
     user = self.request.user
     if user.is_authenticated:
         links['user'] = reverse('user-detail',
                                 request=request,
                                 kwargs={"pk": user.id})
     response = services.append_collection_links(response, links)
     # append query list
     query_list = [reverse('plugin-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {
         'name': '',
         'dock_image': '',
         'public_repo': '',
         'descriptor_file': ''
     }
     return services.append_collection_template(response, template_data)
Ejemplo n.º 7
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a query list to the
     response.
     """
     response = super(PluginMetaList, self).list(request, *args, **kwargs)
     # append document-level link relations
     links = {
         'plugin_stars': reverse('pluginmetastar-list', request=request),
         'plugins': reverse('plugin-list', request=request),
         'pipelines': reverse('pipeline-list', request=request)
     }
     user = self.request.user
     if user.is_authenticated:
         links.update({
             'user':
             reverse('user-detail', request=request, kwargs={"pk":
                                                             user.id}),
             'favorite_plugin_metas':
             reverse('user-favoritepluginmeta-list',
                     request=request,
                     kwargs={"pk": user.id}),
             'owned_plugin_metas':
             reverse('user-ownedpluginmeta-list',
                     request=request,
                     kwargs={"pk": user.id})
         })
     response = services.append_collection_links(response, links)
     # append query list
     query_list = [reverse('pluginmeta-list-query-search', request=request)]
     return services.append_collection_querylist(response, query_list)
Ejemplo n.º 8
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to add a query list to the response.
     """
     response = super(AllPluginInstanceFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('allplugininstancefile-list-query-search', request=request)]
     return services.append_collection_querylist(response, query_list)
Ejemplo n.º 9
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to add a query list and document-level link relation to the response.
     """
     response = super(AllPipelineInstanceList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('allpipelineinstance-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'pipelines': reverse('pipeline-list', request=request)}
     return services.append_collection_links(response, links)
Ejemplo n.º 10
0
 def test_append_collection_querylist(self):
     """
     Test whether services.append_collection_querylist() appends a collection+json
     queries template list to it response argument
     """
     response = self.response
     request = response.renderer_context['request']
     query_urls = [self.endpoint]
     response = services.append_collection_querylist(response, query_urls)
     self.assertEqual(response.data['queries'],
                      [{'href': query_urls[0], 'rel': 'search',
                        "data": [{"name": "name", "value": ""}]}])
Ejemplo n.º 11
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(PluginList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('plugin-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'feeds': reverse('feed-list', request=request)}
     return services.append_collection_links(response, links)
Ejemplo n.º 12
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(PluginList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('plugin-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'feeds': reverse('feed-list', request=request)}
     return services.append_collection_links(response, links)
Ejemplo n.º 13
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template.
     """
     response = super(TagList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('tag-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'feeds': reverse('feed-list', request=request)}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {"name": "", "color": ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 14
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin.
     A collection+json template is also added to the response.
     """
     response = super(UploadedFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [
         reverse('uploadedfile-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {'upload_path': "", 'fname': ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 15
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(ServiceFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [
         reverse('servicefile-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {'path': "", 'service_name': ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 16
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a query list to the
     response.
     """
     response = super(ComputeResourceList,
                      self).list(request, *args, **kwargs)
     # append query list
     query_list = [
         reverse('computeresource-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'feeds': reverse('feed-list', request=request)}
     return services.append_collection_links(response, links)
Ejemplo n.º 17
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations.
     """
     response = super(FeedList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('feed-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'plugins': reverse('plugin-list', request=request),
         'tags': reverse('full-tag-list', request=request),
         'sandboxedfiles': reverse('userfile-list', request=request)
     }
     return services.append_collection_links(response, links)
Ejemplo n.º 18
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations.
     """
     response = super(PluginList, self).list(request, *args, **kwargs)
     user = self.request.user
     # append document-level link relations
     if user.is_authenticated:
         links = {'user_plugins': reverse('user-plugin-list', request=request),
                  'user': reverse('user-detail', request=request,
                                  kwargs={"pk": user.id})}
         response = services.append_collection_links(response, links)
     # append query list
     query_list = [reverse('plugin-list-query-search', request=request)]
     return services.append_collection_querylist(response, query_list)
Ejemplo n.º 19
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to add document-level link relations, query list and a collection+json
     template to the response.
     """
     response = super(PipelineList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('pipeline-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'plugins': reverse('plugin-list', request=request)}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'name': "", 'authors': "", 'category': "", 'description': "",
                      'plugin_id_tree': "", 'plugin_inst_id': ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 20
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to add document-level link relations, query list and a collection+json
     template to the response.
     """
     response = super(PipelineList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('pipeline-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'plugins': reverse('plugin-list', request=request)}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'name': "", 'authors': "", 'category': "", 'description': "",
                      'locked': "", 'plugin_tree': "", 'plugin_inst_id': ""}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 21
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations.
     """
     response = super(FeedList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('feed-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     user = self.request.user
     links = {'plugins': reverse('plugin-list', request=request),
              'pipelines': reverse('pipeline-list', request=request),
              'tags': reverse('tag-list', request=request),
              'uploadedfiles': reverse('uploadedfile-list', request=request),
              'user': reverse('user-detail', request=request, kwargs={"pk": user.id})}
     return services.append_collection_links(response, links)
Ejemplo n.º 22
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a document-level link relation, a query list and a
     collection+json template to the response.
     """
     response = super(RecipeList, self).list(request, *args, **kwargs)
     # append document-level link relations
     user = self.request.user
     if user.is_authenticated:
         links = {
             'user':
             reverse('user-detail', request=request, kwargs={"pk": user.id})
         }
         response = services.append_collection_links(response, links)
     # append query list
     query_list = [reverse('recipe-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {'name': ''}
     return services.append_collection_template(response, template_data)
Ejemplo n.º 23
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of pipeline instances for the queried pipeline.
     A document-level link relation, query list and a collection+json template are
     also added to the response.
     """
     queryset = self.get_pipeline_instances_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     # append query list
     query_list = [reverse('pipelineinstance-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'pipeline': reverse('pipeline-detail', request=request,
                                kwargs={"pk": pipeline.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'previous_plugin_inst_id': "", 'title': "", 'description': ""}
     param_names = pipeline.get_pipings_parameters_names()
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)