public abstract class FndAbstractArray extends FndCompoundAttribute implements FndRecordArraySerialization, java.lang.Cloneable
See method sort(FndSortField...)
that sorts records in an array according
to a specified sequence of attributes and/or references.
FndArray
,
Serialized FormFndCompoundAttribute.Iterator
meta, rec, value
Constructor and Description |
---|
FndAbstractArray()
Create a new instance
|
FndAbstractArray(FndAttributeMeta meta)
Create a new instance
|
FndAbstractArray(FndAttributeMeta meta,
FndCompoundReference parentKeyInParent)
Create a new instance
|
FndAbstractArray(java.lang.String name)
Create a new instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(FndAbstractArray array)
Deprecated.
This method will be made protected in a future release.
|
void |
assign(FndAbstractArray array)
Deprecated.
This method will be made protected in a future release.
|
protected void |
assign(FndAbstractArray from,
boolean cloning)
Assigns the given array replacing the existing array, if any.
|
protected void |
assign(FndAttribute from)
Assigns the given array replacing the existing array, if any.
|
void |
clear()
Clears the contents of this attribute.
|
java.lang.Object |
clone()
Copy the array.
|
protected void |
copy(FndAttribute target,
boolean cloning)
Copy the array.
|
boolean |
customQuery()
Check if the aggregate use framework or custom query functionality.
|
protected void |
formatAttributeToXml(FndXmlSerializer s,
FndAttribute customAttr,
FndAttributeXmlFormatter customFormatter)
Formats this object into the XML stream.
|
void |
formatRecordArray(FndTokenWriter stream)
Formats the array into an Fnd Buffer
|
protected void |
formatValue(FndTokenWriter stream,
boolean releaseMemory)
Formats value of the array to an Fnd Buffer.
|
protected void |
formatValueToXml(FndXmlSerializer s)
Formats this attribute's value to the xml stream.
|
protected java.util.List<FndAbstractRecord> |
getInternalRecords()
Returns the records of the array as a List.
|
int |
getLength()
Returns the size of the array (number of elements).
|
FndAbstractRecord |
getTemplateRecord()
Returns the array type
|
int |
hashCode()
Return a hash code value for this array
|
protected void |
internalAdd(FndAbstractArray arr)
Adds elements of another array to this array.
|
protected boolean |
internalAdd(FndAbstractRecord rec)
Adds an element to the array.
|
protected boolean |
internalAdd(FndAbstractRecord rec,
boolean setDirty)
Adds an element to the array.
|
protected void |
internalAdd(int i,
FndAbstractRecord rec) |
protected boolean |
internalContains(FndAbstractRecord rec) |
protected boolean |
internalEquals(FndAbstractRecord rec)
Deprecated.
|
protected FndAbstractRecord |
internalFirstElement() |
protected FndAbstractRecord |
internalGet(int i)
Returns the untyped object at a specific index.
|
protected int |
internalIndexOf(FndAbstractRecord rec) |
protected FndAbstractRecord |
internalLastElement() |
protected int |
internalLastIndexOf(FndAbstractRecord rec) |
protected FndAbstractRecord |
internalRemove(int i)
Removes and returns an object from the array.
|
protected FndAbstractRecord |
internalSet(int i,
FndAbstractRecord rec) |
boolean |
isNull()
Check if the array is null
|
boolean |
isVector()
Check if this is an array attribute
|
protected void |
load(java.util.List<FndAbstractRecord> records)
Sets the value of the array
|
protected void |
markStateRecursively(FndRecordState state)
Set record state on all records (recursively) in the array.
|
protected abstract FndAttribute |
newAttribute(FndAttributeMeta meta)
Create a new attribute of the same type.
|
FndAbstractRecord |
newRecord()
Creates a new record of the correct type for the array.
|
protected FndAbstractRecord |
newRecord(FndTokenReader stream) |
protected void |
parseBuffer(FndTokenReader stream)
Creates the array by parsing an Fnd Buffer
|
void |
parseRecordArray(FndTokenReader stream)
Creates the array by parsing an Fnd Buffer
|
void |
reset()
Empties the array and sets it to non-existent.
|
int |
serializedSize()
Approximates the size of the serialized form of this array.
|
void |
setNonExistent()
Clears the array and sets it to non-existent (as opposed to having an existing array having a null value)
|
void |
setNull()
Clears the array
|
void |
setState(FndRecordState state)
Set record state on all records (recursively) in the array.
|
void |
setTemplateRecord(FndAbstractRecord record)
Sets the datatype of the array
|
int |
size()
Returns the size of the array (number of elements)
|
void |
sort(java.util.Comparator<FndAbstractRecord> comparator)
Sorts the array according to the order induced by the specified comparator.
|
void |
sort(FndSortField... fields)
Sorts the array according to the specified sequence of sort fields.
|
void |
sort(java.lang.String orderBy)
Sorts the array according to the specified order by clause.
|
void |
sortOnAttribute(FndAttribute attr)
Sorts the array on a specific attribute.
|
void |
sortOnAttribute(FndAttribute attr,
boolean reverse)
Sorts the array on a specific attribute.
|
void |
sortOnAttribute(java.lang.String str)
Sorts the array on a specific attribute.
|
void |
sortOnAttribute(java.lang.String str,
boolean reverse)
Sorts the array on a specific attribute.
|
void |
sortOnState()
Sorts the array on record state.
|
FndArray |
transformToRecordArray()
Transform this array to an array of dynamic FndRecords.
|
cascadeDelete, connectElement, connectElementToParent, containsDependentDetails, createCondition, format, getCompoundMeta, getParentKeyInParent, hasPersistentParts, isCompound, setParentKeyInElement, setParentKeyInParent
addInvalidValueInfo, checkFormat, checkFormat, checkNotModified, checkNotModified, checkNotModified, checkNotModified, checkNotModified, checkNotModified, checkRange, checkRange, checkRange, checkRange, checkRange, checkRange, checkUpperCase, checkUpperCase, checkValuePresent, checkValuePresent, checkValuePresent, checkValuePresent, checkValuePresent, checkValuePresent, cloneValue, compareTo, createBetweenCondition, createEqualCondition, createGreaterThanCondition, createGreaterThanOrEqualCondition, createLessThanCondition, createLessThanOrEqualCondition, createNotEqualCondition, descending, exclude, exist, getColumns, getInnerTypes, getInvalidValueInfo, getMeta, getName, getParentRecord, getResultCategory, getSortDirection, getSqlType, getState, getType, hasValue, include, include, internalGetValue, internalSetValue, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, invalidate, isDirty, isExcluded, isKey, isLong, isMandatory, isPartOfPrimaryKey, isQuery, isSet, isUpdateAllowed, parse, parseDatabaseString, parseString, parseXmlString, set, setDirty, setDirty, setExistent, setInvalidValueInfo, setMandatory, setName, setParentRecord, setQuery, setSqlValue, setState, setType, setUpdateAllowed, sortFieldIterator, toDatabaseString, toFndSqlValue, toString, unset, validate, validate
public FndAbstractArray()
public FndAbstractArray(java.lang.String name)
name
- attribute namepublic FndAbstractArray(FndAttributeMeta meta)
meta
- attribute meta datapublic FndAbstractArray(FndAttributeMeta meta, FndCompoundReference parentKeyInParent)
meta
- attribute meta dataparentKeyInParent
- key in parent recordpublic final void setTemplateRecord(FndAbstractRecord record)
record
- Determines the type of records that will be stored in the arraypublic final FndAbstractRecord getTemplateRecord()
public final void setNull()
setNull
in class FndAttribute
public final void setNonExistent()
setNonExistent
in class FndAttribute
FndAttribute.exist()
,
FndAbstractRecord.setNonExistent()
public final boolean isNull()
isNull
in class FndAttribute
public final boolean isVector()
isVector
in class FndAttribute
public final void clear()
clear
in class FndAttribute
protected final boolean internalAdd(FndAbstractRecord rec)
rec
- Object to be addedprotected final boolean internalAdd(FndAbstractRecord rec, boolean setDirty)
rec
- Object to be addedsetDirty
- true if the array should be marked as dirty, false otherwiseprotected final void internalAdd(int i, FndAbstractRecord rec)
protected final void internalAdd(FndAbstractArray arr)
arr
- array the elements of which should be added to this arrayprotected final boolean internalContains(FndAbstractRecord rec)
protected final boolean internalEquals(FndAbstractRecord rec)
public final int hashCode()
hashCode
in class java.lang.Object
protected final FndAbstractRecord internalFirstElement()
protected final FndAbstractRecord internalGet(int i)
i
- indexIfsRuntimeException
- if the index is out of range (index < 0 || index >= size())protected final int internalIndexOf(FndAbstractRecord rec)
protected final FndAbstractRecord internalLastElement()
protected final int internalLastIndexOf(FndAbstractRecord rec)
protected final FndAbstractRecord internalRemove(int i)
i
- Array indexprotected final FndAbstractRecord internalSet(int i, FndAbstractRecord rec)
public final void reset()
protected final java.util.List<FndAbstractRecord> getInternalRecords()
protected final void load(java.util.List<FndAbstractRecord> records)
records
- A List of records that the array will contain after the operationpublic final int size()
public final int getLength()
getLength
in class FndAttribute
protected final void formatValue(FndTokenWriter stream, boolean releaseMemory) throws ParseException
formatValue
in class FndAttribute
stream
- Stream to which to write the resulting bufferreleaseMemory
- true if after formatting the attribute value should be cleared releasing the memory, false otherwiseParseException
- Thrown if the data contained in the array cannot be serialized to an Fnd Bufferpublic final int serializedSize()
public final void sort(java.lang.String orderBy)
In the following example it is assumed that arr is an array of PersonInfo instances, each having a non-empty aggregate ISOCountry.
arr.sort("ISO_COUNTRY/DESCRIPTION, CREATION_DATE DESC");See method
sort(FndSortField...)
that supports better compile-time checking.orderBy
- String containing a list of attribute paths as created by
FndSort.formatOrderByClause
.public final void sort(FndSortField... fields) throws SystemException
In the following example it is assumed that arr is an array of PersonInfo instances, each having a non-empty aggregate ISOCountry. Note that the variable person which refers to the first element of the array is used just to define the ordering of records, it could be any other instance of PersonInfo.
if(arr.size() > 0) { PersonInfo person = arr.get(0); arr.sort(person.iSOCountry().description, person.creationDate.descending()); }
fields
- instances of FndAttribute and/or FndCompoundReference that define
the order of recordsSystemException
- if the specified attributes/references are not contained in
this array's element record type or in one of its aggregatessort(String)
,
sortOnAttribute(String)
,
sortOnAttribute(FndAttribute)
public final void sortOnAttribute(FndAttribute attr)
attr
- The attribute on which to sort the arraysortOnAttribute(FndAttribute, boolean)
,
sortOnAttribute(String)
,
sort(FndSortField...)
public final void sortOnAttribute(java.lang.String str)
str
- The name of the attribute on which to do the sortingsortOnAttribute(String, boolean)
,
sortOnAttribute(FndAttribute)
,
sort(FndSortField...)
public final void sortOnAttribute(FndAttribute attr, boolean reverse)
attr
- The attribute on which to sort the arrayreverse
- True if the sorting should be done in the reverse ordersort(FndSortField...)
public final void sortOnAttribute(java.lang.String str, boolean reverse)
str
- The name of the attribute on which to do the sortingreverse
- True if the sorting should be done in the reverse ordersort(FndSortField...)
public final void sort(java.util.Comparator<FndAbstractRecord> comparator)
comparator
- the comparator to determine the order of the arraypublic final void sortOnState()
protected FndAbstractRecord newRecord(FndTokenReader stream) throws ParseException
ParseException
public FndAbstractRecord newRecord()
protected final void parseBuffer(FndTokenReader stream) throws ParseException
parseBuffer
in class FndAttribute
stream
- Stream from which to read the buffer to be parsedParseException
- Errors in parsing the bufferspublic final void parseRecordArray(FndTokenReader stream) throws ParseException
parseRecordArray
in interface FndRecordArraySerialization
stream
- Stream from which to read the buffer to be parsedParseException
- Errors in parsing the bufferspublic final void formatRecordArray(FndTokenWriter stream) throws ParseException
formatRecordArray
in interface FndRecordArraySerialization
stream
- Stream to which to output the resulting bufferParseException
- Thrown if the buffer could not be createdprotected final void formatAttributeToXml(FndXmlSerializer s, FndAttribute customAttr, FndAttributeXmlFormatter customFormatter) throws ParseException
formatAttributeToXml
in class FndAttribute
s
- XML serializer to which to append the attribute contentscustomAttr
- top level attribute (tested with "==" operator) which will be formatted by the custom formattercustomFormatter
- formatter that will format the custom attribute valueParseException
protected final void formatValueToXml(FndXmlSerializer s)
formatValueToXml
in class FndAttribute
s
- XML serializer to which to add the valuepublic final void assign(FndAbstractArray array)
array
- Array that will replace the existing valuesprotected final void assign(FndAbstractArray from, boolean cloning) throws SystemException
from
- Array that will replace the existing valuescloning
- Enable/disable cloning of source arraySystemException
protected final void assign(FndAttribute from) throws SystemException
assign
in class FndAttribute
from
- Attribute to copy value from.SystemException
public final boolean addAll(FndAbstractArray array)
array
- Array that will be addedpublic final void setState(FndRecordState state)
state
- record stateprotected final void markStateRecursively(FndRecordState state)
state
- record stateprotected final void copy(FndAttribute target, boolean cloning) throws java.lang.CloneNotSupportedException, SystemException
copy
in class FndAttribute
target
- Array to copy to (must be an instance of FndAbstractArray).cloning
- true if records should be clonedjava.lang.CloneNotSupportedException
SystemException
public final java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class FndAttribute
java.lang.CloneNotSupportedException
- if cloning is not implementedprotected abstract FndAttribute newAttribute(FndAttributeMeta meta)
newAttribute
in class FndAttribute
meta
- Meta-datapublic boolean customQuery()
public FndArray transformToRecordArray() throws SystemException
SystemException