AttrHistoricalSingle.java revision 8d62e48d3856b6018f8dc8452ac2714116c448c1
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2011 ForgeRock AS
*/
/**
* This classes is used to store historical information for single valued
* attributes.
* One object of this type is created for each attribute that was changed in
* the entry.
* It allows to record the last time a given value was added,
* and the last time the whole attribute was deleted.
*/
public class AttrHistoricalSingle extends AttrHistorical
{
// deleted
// last operation applied. This is only used for multiple mods on the same
// single valued attribute in the same modification.
/**
* {@inheritDoc}
*/
public ChangeNumber getDeleteTime()
{
return this.deleteTime;
}
/**
* {@inheritDoc}
*/
{
{
return new ArrayList<AttrValueHistorical>();
}
else
{
new ArrayList<AttrValueHistorical>();
return values;
}
}
/**
* {@inheritDoc}
*/
{
{
}
switch (mod.getModificationType())
{
case DELETE:
this.deleteTime = changeNumber;
break;
case ADD:
this.addTime = changeNumber;
break;
case REPLACE:
{
// REPLACE with null value is actually a DELETE
this.deleteTime = changeNumber;
}
else
{
}
break;
case INCREMENT:
/* FIXME : we should update ChangeNumber */
break;
}
}
/**
* {@inheritDoc}
*/
{
boolean conflict = false;
{
}
switch (mod.getModificationType())
{
case DELETE:
{
{
{
}
{
conflict = true;
}
{
conflict = true;
}
else
{
}
}
else
{
conflict = true;
}
}
{
{
{
}
}
else
{
conflict = true;
}
}
else
{
conflict = true;
}
break;
case ADD:
{
conflict = true;
}
else
{
{
// no conflict : don't do anything beside setting the addTime
}
else
{
// Case where changeNumber = addTime = deleteTime
{
// No conflict, record the new value.
}
else
{
conflict = true;
}
}
}
break;
case REPLACE:
{
conflict = true;
}
else
{
{
}
else
{
}
}
break;
case INCREMENT:
/* FIXME : we should update ChangeNumber */
break;
}
return conflict;
}
/**
* {@inheritDoc}
*/
{
switch (histKey)
{
case ADD:
break;
case DEL:
this.deleteTime = cn;
break;
case REPL:
break;
case DELATTR:
this.deleteTime = cn;
break;
}
}
}