AttrHistoricalSingle.java revision b2efaf7ba0228d844773bb6c350806015069ea59
/*
* 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 legal-notices/CDDLv1_0.txt
* 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 legal-notices/CDDLv1_0.txt.
* 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-2015 ForgeRock AS
*/
/**
* This class 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
{
/** Last time when the attribute was deleted. */
private CSN deleteTime;
/** Last time when a value was added. */
/** Last added value. */
private ByteString value;
/**
* Last operation applied. This is only used for multiple mods on the same
* single valued attribute in the same modification.
*/
private HistAttrModificationKey lastMod;
public CSN getDeleteTime()
{
return this.deleteTime;
}
{
{
}
return Collections.emptySet();
}
{
{
case DELETE:
this.deleteTime = csn;
break;
case ADD:
break;
case REPLACE:
{
// REPLACE with null value is actually a DELETE
this.deleteTime = csn;
}
else
{
this.deleteTime = csn;
}
break;
case INCREMENT:
/* FIXME : we should update CSN */
break;
}
}
{
boolean conflict = false;
{
case DELETE:
{
{
{
deleteTime = csn;
}
{
conflict = true;
}
{
conflict = true;
}
else
{
}
}
else
{
conflict = true;
}
}
{
{
{
deleteTime = csn;
}
}
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 CSN = addTime = deleteTime
{
// No conflict, record the new value.
}
else
{
conflict = true;
}
}
}
break;
case REPLACE:
{
conflict = true;
}
else
{
{
deleteTime = csn;
}
else
{
deleteTime = csn;
}
}
break;
case INCREMENT:
/* FIXME : we should update CSN */
break;
}
return conflict;
}
{
{
}
return null;
}
{
switch (histKey)
{
case ADD:
break;
case DEL:
this.deleteTime = csn;
{
}
break;
case REPL:
{
}
break;
case DELATTR:
this.deleteTime = csn;
break;
}
}
{
if (deleteTime != null)
{
}
{
{
}
}
{
}
}
}