Class: Queries::ProtocolRelationship::Filter
- Inherits:
-
Query::Filter
- Object
- Query
- Query::Filter
- Queries::ProtocolRelationship::Filter
- Includes:
- Concerns::Polymorphic
- Defined in:
- lib/queries/protocol_relationship/filter.rb
Constant Summary collapse
- PARAMS =
[ *::ProtocolRelationship..map(&:to_sym), :protocol_id, :protocol_relationship_id, :protocol_relationship_object_id, :protocol_relationship_object_type, protocol_relationship_id: [], protocol_relationship_object_id: [], protocol_id: [] ].freeze
Constants inherited from Query::Filter
Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES
Instance Attribute Summary collapse
-
#protocol_id ⇒ Object
Array.
-
#protocol_relationship_id ⇒ Object
Array.
-
#protocol_relationship_object_id ⇒ Object
Array.
-
#protocol_relationship_object_type ⇒ Object
String, nil.
Attributes inherited from Query::Filter
#api, #asserted_distribution_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_query, #data_attribute_query, #descriptor_query, #document_query, #dwc_occurrence_query, #extract_query, #field_occurrence_query, #image_query, #loan_query, #object_global_id, #observation_query, #order_by, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #recent_target, #taxon_name_query, #venn, #venn_mode
Attributes inherited from Query
Instance Method Summary collapse
- #and_clauses ⇒ Object
-
#initialize(query_params) ⇒ Filter
constructor
TODO: See ::Queries::Annotator params - move to permitted section in controller likely.
- #protocol_id_facet ⇒ Object
- #protocol_relationship_object_id_facet ⇒ Object
- #protocol_relationship_object_type_facet ⇒ Object
Methods inherited from Query::Filter
#all, #all_and_clauses, #all_merge_clauses, #annotator_and_clauses, #annotator_merge_clauses, annotator_params, api_except_params, api_excluded_params, #apply_venn, #attribute_exact_facet, base_filter, base_query_name, base_query_to_h, #deep_permit, included_annotator_facets, instantiated_base_filter, inverted_subqueries, #merge_clauses, #model_id_facet, #object_global_id_facet, #only_project?, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #query_name, #set_nested_queries, #shared_and_clauses, #subquery_vector, #target_and_clauses, #venn_query
Methods inherited from Query
#alphabetic_strings, #alphanumeric_strings, base_name, #base_name, #base_query, #build_terms, #cached_facet, #end_wildcard, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #no_terms?, referenced_klass, #referenced_klass, #referenced_klass_except, #referenced_klass_intersection, #referenced_klass_union, #start_and_end_wildcard, #start_wildcard, #table, #wildcard_pieces
Constructor Details
#initialize(query_params) ⇒ Filter
TODO: See ::Queries::Annotator params - move to permitted section in controller likely.
37 38 39 40 41 42 43 44 |
# File 'lib/queries/protocol_relationship/filter.rb', line 37 def initialize(query_params) super @protocol_relationship_object_id = params[:protocol_relationship_object_id] @protocol_relationship_object_type = params[:protocol_relationship_object_type] @protocol_id = params[:protocol_id] @protocol_relationhip_id = params[:protocol_relationship_id] set_polymorphic_params(params) end |
Instance Attribute Details
#protocol_id ⇒ Object
Returns Array.
26 27 28 |
# File 'lib/queries/protocol_relationship/filter.rb', line 26 def protocol_id @protocol_id end |
#protocol_relationship_id ⇒ Object
Returns Array.
22 23 24 |
# File 'lib/queries/protocol_relationship/filter.rb', line 22 def protocol_relationship_id @protocol_relationship_id end |
#protocol_relationship_object_id ⇒ Object
Returns Array.
30 31 32 |
# File 'lib/queries/protocol_relationship/filter.rb', line 30 def protocol_relationship_object_id @protocol_relationship_object_id end |
#protocol_relationship_object_type ⇒ Object
Returns String, nil.
33 34 35 |
# File 'lib/queries/protocol_relationship/filter.rb', line 33 def protocol_relationship_object_type @protocol_relationship_object_type end |
Instance Method Details
#and_clauses ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/queries/protocol_relationship/filter.rb', line 77 def and_clauses [ protocol_id_facet, protocol_relationship_object_id_facet, protocol_relationship_object_type_facet, ] end |
#protocol_id_facet ⇒ Object
62 63 64 65 |
# File 'lib/queries/protocol_relationship/filter.rb', line 62 def protocol_id_facet return nil if protocol_id.empty? table[:protocol_id].in(protocol_id) end |
#protocol_relationship_object_id_facet ⇒ Object
67 68 69 70 |
# File 'lib/queries/protocol_relationship/filter.rb', line 67 def protocol_relationship_object_id_facet return nil if protocol_relationship_object_id.empty? table[:protocol_relationship_object_id].in(protocol_relationship_object_id) end |
#protocol_relationship_object_type_facet ⇒ Object
72 73 74 75 |
# File 'lib/queries/protocol_relationship/filter.rb', line 72 def protocol_relationship_object_type_facet return nil if protocol_relationship_object_type.empty? table[:protocol_relationship_object_type].in(protocol_relationship_object_type) end |