List<ColumnReference> insertElementList = ((Insert)command).getColumns();
List<Expression> insertValueList = ((ExpressionValueSource)((Insert)command).getValueSource()).getValues();
// create a new attribute list with case ignored in attribute
// names
Attributes insertAttrs = new BasicAttributes(true);
Attribute insertAttr; // what we will use to populate the attribute list
ColumnReference insertElement;
String nameInsertElement;
Object insertValue;
String distinguishedName = null;
// The IInsert interface uses separate List objects for
// the element names and values to be inserted, limiting
// the potential for code reuse in reading them (since all
// other interfaces use ICriteria-based mechanisms for such
// input).
for (int i=0; i < insertElementList.size(); i++) {
insertElement = insertElementList.get(i);
// call utility class to get NameInSource/Name of element
nameInsertElement = getNameFromElement(insertElement);
// special handling for DN attribute - use it to set
// distinguishedName value.
if (nameInsertElement.toUpperCase().equals("DN")) { //$NON-NLS-1$
insertValue = ((Literal)insertValueList.get(i)).getValue();
if (insertValue == null) {
final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.columnSourceNameDNNullError"); //$NON-NLS-1$
throw new TranslatorException(msg);
}
if (!(insertValue instanceof java.lang.String)) {
final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.columnSourceNameDNTypeError"); //$NON-NLS-1$
throw new TranslatorException(msg);
}
distinguishedName = (String)insertValue;
}
// for other attributes specified in the insert command,
// create a new
else {
insertAttr = new BasicAttribute(nameInsertElement);
insertValue = ((Literal)insertValueList.get(i)).getValue();
insertAttr.add(insertValue);
insertAttrs.put(insertAttr);
}
}
// if the DN is not specified, we don't know enough to attempt
// the LDAP add operation, so throw an exception
if (distinguishedName == null) {