*/
modsIterator.remove();
return false;
}
AttributeBuilder builder = new AttributeBuilder(m.getAttribute());
for (AttributeValue addVal : m.getAttribute())
{
ArrayList<AttrValueHistorical> valuesInfo = getValuesHistorical();
AttrValueHistorical valInfo =
new AttrValueHistorical(addVal, changeNumber, null);
int index = valuesInfo.indexOf(valInfo);
if (index == -1)
{
/* this values does not exist yet
* add it in the historical information
* let the operation process normally
*/
valuesInfo.add(valInfo);
}
else
{
AttrValueHistorical oldValueInfo = valuesInfo.get(index);
if (oldValueInfo.isUpdate())
{
/* if the value is already present
* check if the updateTime must be updated
* in all cases suppress this value from the value list
* as it is already present in the entry
*/
if (changeNumber.newer(oldValueInfo.getValueUpdateTime()))
{
valuesInfo.remove(index);
valuesInfo.add(valInfo);
}
builder.remove(addVal);
}
else
{
/* this value is marked as a deleted value
* check if this mod is more recent the this delete
*/
if (changeNumber.newerOrEquals(oldValueInfo.getValueDeleteTime()))
{
/* this add is more recent,
* remove the old delete historical information
* and add our more recent one
* let the operation process
*/
valuesInfo.remove(index);
valuesInfo.add(valInfo);
}
else
{
/* the delete that is present in the historical information
* is more recent so it must win,
* remove this value from the list of values to add
* don't update the historical information
*/
builder.remove(addVal);
}
}
}
}
Attribute attr = builder.toAttribute();
m.setAttribute(attr);
if (attr.isEmpty())
{
modsIterator.remove();