try
{
result = findItemQPathByIdentifierCQ(caid);
if (!result.next())
{
throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
}
String cid = result.getString(COLUMN_ID);
QPathEntry qpe1 =
new QPathEntry(InternalQName.parse(result.getString(COLUMN_NAME)), result.getInt(COLUMN_INDEX), cid);
boolean isChild = caid.equals(cid);
caid = result.getString(COLUMN_PARENTID);
if (cid.equals(caid))
{
throw new InvalidItemStateException("An item with id='" + getIdentifier(caid) + "' is its own parent");
}
if (result.next())
{
QPathEntry qpe2 =