Class DataSubset<T,I>
java.lang.Object
com.appiancorp.suiteapi.common.paging.DataSubset<T,I>
- Type Parameters:
T
- The type of the results accessible ingetData()
I
- The type of the identifiers
- Direct Known Subclasses:
ListViewDataSubset
,TypedValueDataSubset
This class is available as a preview of functionality that will be added to
the supported public API in a future release. While it is in the preview
phase, it is subject to change or removal without deprecation or notice.
Although notice of change is not guaranteed, we will try to let developers
know of major changes through announcements in release notes.
A view that holds a range of data ( and use the
Add
Add
Add
For Example:
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
@XmlRootElement(namespace=Type.APPIAN_NAMESPACE, name=DataSubset.XML_ROOT_ELEMENT)
@XmlType(namespace=[Your Namespace], propOrder = {"startIndex", "batchSize", "sort", "totalCount", "data", "identifiers"})
@XmlSeeAlso({Person.class,String.class})
public static class PersonDataSubset extends DataSubset<Person,String> {
private List<Person> data;
private List<String> identifiers;
public PersonDataSubset() {}
@Override
@XmlElement(type=Object.class, nillable=true, namespace="")
public List<Person> getData() {
return data;
}
@Override
@XmlElement(type=Object.class, nillable=true, namespace="")
public List<String> getIdentifiers() {
return identifiers;
}
@Override
protected void setData(List<Person> data) {
this.data = data;
}
@Override
protected void setIdentifiers(List<String> identifiers) {
this.identifiers = identifiers;
}
}
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final QName
static final String
static final String
static final String
static final String
protected static final String
This is both the XML type name and the UUID of the system record created from this Java class -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of requested elements.getData()
Returns the paged results.Returns the identifiers of the data ingetData()
.getSort()
Returns the sort expressions that have been applied to the data ingetData()
.int
Returns the start index of this paged result.int
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
Sets the resultsprotected abstract void
setIdentifiers
(List<I> identifiers) Sets the the identifiers of the data ingetData()
.toString()
-
Field Details
-
START_INDEX_FIELD_NAME
- See Also:
-
BATCH_SIZE_FIELD_NAME
- See Also:
-
SORT_FIELD_NAME
- See Also:
-
TOTAL_COUNT_FIELD_NAME
- See Also:
-
RESULTS_FIELD_NAME
- See Also:
-
IDENTIFIERS_FIELD_NAME
- See Also:
-
XML_ROOT_ELEMENT
This is both the XML type name and the UUID of the system record created from this Java class- See Also:
-
LOCAL_PART
- See Also:
-
QNAME
-
-
Constructor Details
-
DataSubset
protected DataSubset() -
DataSubset
public DataSubset(int startIndex, int batchSize, List<SortInfo> sort, int totalCount, List<T> results, List<I> identifiers) Creates a view that holds a range of data. identifiers must be either null or the same size as results.- Parameters:
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
-
-
-
Method Details
-
getStartIndex
public int getStartIndex()Returns the start index of this paged result. -
getBatchSize
public int getBatchSize()Returns the number of requested elements. The actual number of results in this paged result can be retrieved fromgetData()
. A negative batchSize indicates that the maximum number of returned results should not be limited. -
getTotalCount
public int getTotalCount()Returns the total number of results available in the data source. -
getData
Returns the paged results. -
getIdentifiers
Returns the identifiers of the data ingetData()
. These are only unique if the underlying data source guarantees uniqueness. -
setData
Sets the results- Parameters:
data
- List of results
-
setIdentifiers
Sets the the identifiers of the data ingetData()
.- Parameters:
identifiers
- List of identifiers
-
getSort
Returns the sort expressions that have been applied to the data ingetData()
. -
toString
-
multilineToStringHelper
protected com.appian.core.base.MultilineToStringHelper multilineToStringHelper(int indent) -
multilineToString
public static com.appian.core.base.ToStringFunction<? extends DataSubset> multilineToString(int indent)
-