T
- The type of the results accessible in getData()
I
- The type of the identifierspublic abstract class DataSubset<T,I>
extends java.lang.Object
getData()
). If the results are
part of larger set, getTotalCount()
will be larger than the number
of available results. The boundaries of the view, with respect to the larger
set, can be retrieved from getStartIndex()
and
getBatchSize()
. The results are identified by
getIdentifiers()
, which should be either null or of the same size as
getData()
. The identifiers are unique only when the underlying
data source guarantees uniqueness.
To use this class in both expression functions and smart services, it's
necessary to create a type that extends DataSubsetXmlSeeAlso
annotation to specify the list of types (classes) that the
result page may hold at runtime. It's not necessary to specify Java primitive
wrappers or their array types nor it's necessary to list classes that can be
statically reached from another type already included. The subclass must
define both an XmlType
and XmlRootElement
annotations.
When subclasses are used as a parameter or return type in expression
functions or smart services, it's recommended the Type
annotation
value matches the one defined by QNAME
, not the one
defined by the subclass, this is important if the subclass does not define
extra fields since using will make the subclass appear as a
generic DataSubset type to both expression functions and smart
services, maximizing interoperability.
Any subclass of this should add the following Jaxb annotations:
@XmlElement(type=Object.class, nillable=true, namespace="")
to getData()
and getIdentifiers()
along with an @XmlSeeAlso({T.class,I.class})
where
T and I are the type parameters to this class.
@XmlRootElement(namespace=Type.APPIAN_NAMESPACE, name=DataSubset.XML_ROOT_ELEMENT)
annotation
to the class @XmlType(namespace=[Your Namespace], propOrder = {"startIndex", "batchSize", "sort", "totalCount", "data", "identifiers"})
annotation to the class
{@code
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BATCH_SIZE_FIELD_NAME |
static java.lang.String |
IDENTIFIERS_FIELD_NAME |
static java.lang.String |
LOCAL_PART |
static javax.xml.namespace.QName |
QNAME |
static java.lang.String |
RESULTS_FIELD_NAME |
static java.lang.String |
SORT_FIELD_NAME |
static java.lang.String |
START_INDEX_FIELD_NAME |
static java.lang.String |
TOTAL_COUNT_FIELD_NAME |
protected static java.lang.String |
XML_ROOT_ELEMENT
This is both the XML type name and the UUID of the system record created
from this Java class
|
Modifier | Constructor and Description |
---|---|
protected |
DataSubset() |
|
DataSubset(int startIndex,
int batchSize,
java.util.List<SortInfo> sort,
int totalCount,
java.util.List<T> results,
java.util.List<I> identifiers)
Creates a view that holds a range of data.
|
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize()
Returns the number of requested elements.
|
abstract java.util.List<T> |
getData()
Returns the paged results.
|
abstract java.util.List<I> |
getIdentifiers()
Returns the identifiers of the data in
getData() . |
java.util.List<SortInfo> |
getSort()
Returns the sort expressions that have been applied to the data in
getData() . |
int |
getStartIndex()
Returns the start index of this paged result.
|
int |
getTotalCount()
Returns the total number of results available in the data source.
|
static com.appian.core.base.ToStringFunction<? extends DataSubset> |
multilineToString(int indent) |
protected com.appian.core.base.MultilineToStringHelper |
multilineToStringHelper(int indent) |
protected abstract void |
setData(java.util.List<T> data)
Sets the results
|
protected abstract void |
setIdentifiers(java.util.List<I> identifiers)
Sets the the identifiers of the data in
getData() . |
java.lang.String |
toString() |
public static final java.lang.String START_INDEX_FIELD_NAME
public static final java.lang.String BATCH_SIZE_FIELD_NAME
public static final java.lang.String SORT_FIELD_NAME
public static final java.lang.String TOTAL_COUNT_FIELD_NAME
public static final java.lang.String RESULTS_FIELD_NAME
public static final java.lang.String IDENTIFIERS_FIELD_NAME
protected static final java.lang.String XML_ROOT_ELEMENT
public static final java.lang.String LOCAL_PART
public static final javax.xml.namespace.QName QNAME
protected DataSubset()
public DataSubset(int startIndex, int batchSize, java.util.List<SortInfo> sort, int totalCount, java.util.List<T> results, java.util.List<I> identifiers)
results
- the view of the data.identifiers
- underlying data source identifiers. Unique only when the data
source guarantees uniquenessstartIndex
- the beginning of the viewbatchSize
- the "requested" number of results. The actual number of results
may be less if the end of the underlying data is reached. A
negative batchSize indicates that the maximum number of returned
results was not limited.totalCount
- total number of results available in the data sourcesort
- public int getStartIndex()
public int getBatchSize()
getData()
.
A negative batchSize indicates that the maximum number of returned
results should not be limited.public int getTotalCount()
public abstract java.util.List<T> getData()
public abstract java.util.List<I> getIdentifiers()
getData()
. These are
only unique if the underlying data source guarantees uniqueness.protected abstract void setData(java.util.List<T> data)
data
- List of resultsprotected abstract void setIdentifiers(java.util.List<I> identifiers)
getData()
.identifiers
- List of identifierspublic java.util.List<SortInfo> getSort()
getData()
.public java.lang.String toString()
toString
in class java.lang.Object
protected com.appian.core.base.MultilineToStringHelper multilineToStringHelper(int indent)
public static com.appian.core.base.ToStringFunction<? extends DataSubset> multilineToString(int indent)
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.