Class QueryField
- java.lang.Object
-
- com.biomatters.geneious.publicapi.databaseservice.QueryField
-
- All Implemented Interfaces:
XMLSerializable
public class QueryField extends java.lang.Object implements XMLSerializable
Basic block for building advanced search queries. Each database servicedefines
a set of query fields. Each field is composed of oneDocumentField
which specifies properties such as name, description and type, and a set of conditions that may apply to the field. For example, a service may provide searching on dates by combining a date field with the conditions DATE_AFTER, DATE_BEFORE and so on. For example,AdvancedSearchQueryTerm.Condition[] conditions = new AdvancedSearchQueryTerm.Condition[]{ AdvancedSearchQueryTerm.Condition.IN_RANGE, AdvancedSearchQueryTerm.Condition.DATE_AFTER_OR_ON, AdvancedSearchQueryTerm.Condition.DATE_BEFORE_OR_ON }; DocumentField field = createDateField("creation date", "search by dates", "datecode"); return new QueryField(field, conditions);
The code above directs geneious to display a "creation date" search field in the advanced search panel for that service, and in that field Geneious allows the user to specifies either one or two dates with the appropriate conditions. Upon clicking on search, the field and values are used to construct aquery search term
, which becomes part of the search querypassed to the service
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType
-
-
Field Summary
Fields Modifier and Type Field Description Condition[]
conditions
Possible conditions on field.DocumentField
field
Field to search on.-
Fields inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
ROOT_ELEMENT_NAME
-
-
Constructor Summary
Constructors Constructor Description QueryField()
Empty constructor used only during XML serialisation.QueryField(DocumentField field, Condition[] conditions)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
void
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned byXMLSerializable.toXML()
.int
hashCode()
org.jdom.Element
toXML()
Convert object to a JDOM element.
-
-
-
Field Detail
-
field
public DocumentField field
Field to search on.
-
conditions
public Condition[] conditions
Possible conditions on field. (In an actual query, just one is specified)
-
-
Constructor Detail
-
QueryField
public QueryField(DocumentField field, Condition[] conditions)
Constructor.- Parameters:
field
- the field to search onconditions
- an conditions attached to the field
-
QueryField
public QueryField()
Empty constructor used only during XML serialisation.
-
-
Method Detail
-
toXML
public org.jdom.Element toXML()
Description copied from interface:XMLSerializable
Convert object to a JDOM element. The representation should be complete so thatXMLSerializable.fromXML(org.jdom.Element)
can completely restore the object's representation. It is recommended that the returned element useXMLSerializable.ROOT_ELEMENT_NAME
as its name, in which case it must not define an attribute called "type". In this case, fromXML, will be called with an element whose name may differ from the element return from this function. This recommendation allows a more compact representation of the XML can be stored. This method generally should not be called directly. Instead, you should usually callXMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally. PluginDocument implementations of this method may choose to throw anXMLSerializationException
, enclosed in aRuntimeException
.- Specified by:
toXML
in interfaceXMLSerializable
- Returns:
- object encoded as a JDOM element
-
fromXML
public void fromXML(org.jdom.Element element) throws XMLSerializationException
Description copied from interface:XMLSerializable
Restore the object from the JDOM Element returned byXMLSerializable.toXML()
. This method generally should not be called directly. Instead, you should usually callXMLSerializer.classFromXML(org.jdom.Element)
orXMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally. It is optional to implement this method. Instead of implementing an empty constructor and implementing this method properly, the implementation may instead throw an UnsupportedOperationException and implement a constructor that takes a singleElement
as a parameter. This allows for cleaner code such as support for final fields in the XMLSerializable class. The element parameter should not be modified since it may be reused. If you need a modified version of it, take a copy withElement.clone()
.- Specified by:
fromXML
in interfaceXMLSerializable
- Parameters:
element
- representation from a previous call toXMLSerializable.toXML()
- Throws:
XMLSerializationException
- if the Element can't be converted into this type of object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-