use of org.datanucleus.flush.ListAddAtOperation in project datanucleus-core by datanucleus.
the class ArrayList method addAll.
/**
* Method to add a Collection to a position in the ArrayList.
* @param index Position to insert the collection.
* @param elements The collection
* @return Whether it was added ok.
*/
public boolean addAll(int index, Collection elements) {
boolean success = delegate.addAll(index, elements);
if (ownerOP != null && ownerOP.getExecutionContext().getManageRelations()) {
// Relationship management
Iterator iter = elements.iterator();
RelationshipManager relMgr = ownerOP.getExecutionContext().getRelationshipManager(ownerOP);
while (iter.hasNext()) {
relMgr.relationAdd(ownerMmd.getAbsoluteFieldNumber(), iter.next());
}
}
if (success) {
if (SCOUtils.useQueuedUpdate(ownerOP)) {
int pos = index;
for (Object element : elements) {
ownerOP.getExecutionContext().addOperationToQueue(new ListAddAtOperation(ownerOP, ownerMmd.getAbsoluteFieldNumber(), pos++, element));
}
}
makeDirty();
if (ownerOP != null && !ownerOP.getExecutionContext().getTransaction().isActive()) {
ownerOP.getExecutionContext().processNontransactionalUpdate();
}
}
return success;
}
Aggregations