TemplateEntry.java revision a395dd575518d9e5280fc5d5d5ef47c61b174647
/*
* 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 2006-2008 Sun Microsystems, Inc.
*/
/**
* This class defines an entry that is generated using a MakeLDIF branch or
* template.
*/
public class TemplateEntry
{
// The branch used to generate this entry (if it is associated with a branch).
// The DN for this template entry, if it is known.
// The DN of the parent entry for this template entry, if it is available.
// The set of attributes associated with this template entry, mapped from the
// lowercase name of the attribute to the list of generated values.
// The template used to generate this entry (if it is associated with a
// template).
/**
* Creates a new template entry that will be associated with the provided
* branch.
*
* @param branch The branch to use when creating this template entry.
*/
{
}
/**
* Creates a new template entry that will be associated with the provided
* template.
*
* @param template The template used to generate this entry.
* @param parentDN The DN of the parent entry for this template entry.
*/
{
}
/**
* Retrieves the branch used to generate this entry.
*
* @return The branch used to generate this entry, or <CODE>null</CODE> if it
* is associated with a template instead of a branch.
*/
{
return branch;
}
/**
* Retrieves the template used to generate this entry.
*
* @return The template used to generate this entry, or <CODE>null</CODE> if
* it is associated with a branch instead of a template.
*/
public Template getTemplate()
{
return template;
}
/**
* Retrieves the DN of the parent entry for this template entry.
*
* @return The DN of the parent entry for this template entry, or
* <CODE>null</CODE> if there is no parent DN.
*/
public DN getParentDN()
{
return parentDN;
}
/**
* Retrieves the DN for this template entry, if it is known.
*
* @return The DN for this template entry if it is known, or
* <CODE>null</CODE> if it cannot yet be determined.
*/
{
{
{
TemplateValue v = getValue(t);
if (v == null)
{
return null;
}
}
else
{
{
AttributeType t = rdnAttrs[i];
TemplateValue v = getValue(t);
if (v == null)
{
return null;
}
names[i] = t.getPrimaryName();
}
}
}
return dn;
}
/**
* Indicates whether this entry contains one or more values for the specified
* attribute type.
*
* @param attributeType The attribute type for which to make the
* determination.
*
* @return <CODE>true</CODE> if this entry contains one or more values for
* the specified attribute type, or <CODE>false</CODE> if not.
*/
{
}
/**
* Retrieves the value for the specified attribute, if defined. If the
* specified attribute has multiple values, then the first will be returned.
*
* @param attributeType The attribute type for which to retrieve the value.
*
* @return The value for the specified attribute, or <CODE>null</CODE> if
* there are no values for that attribute type.
*/
{
{
return null;
}
else
{
}
}
/**
* Retrieves the set of values for the specified attribute, if defined.
*
* @param attributeType The attribute type for which to retrieve the set of
* values.
*
* @return The set of values for the specified attribute, or
* <CODE>null</CODE> if there are no values for that attribute type.
*/
{
return valueList;
}
/**
* Adds the provided template value to this entry.
*
* @param value The value to add to this entry.
*/
{
{
}
else
{
}
}
/**
* Retrieves this template entry as an <CODE>Entry</CODE> object.
*
* @return The <CODE>Entry</CODE> object for this template entry.
*/
{
// Process all of the attributes for this entry.
{
if (t.isObjectClassType())
{
for (TemplateValue v : valueList)
{
}
}
else if (t.isOperational())
{
new LinkedHashSet<AttributeValue>();
for (TemplateValue v : valueList)
{
}
}
else
{
new LinkedHashSet<AttributeValue>();
for (TemplateValue v : valueList)
{
}
}
}
}
}