NdbResultSet rs,
DN dn,
long eid) throws NdbApiException
{
NdbOperation op = null;
NdbIndexScanOperation indexScanOp = null;
boolean extensibleObject = false;
String ocsString = rs.getString(BackendImpl.DN2ID_OC);
String[] ocsStringArray = ocsString.split(" ");
String xocsString = rs.getString(BackendImpl.DN2ID_XOC);
String[] xocsStringArray = xocsString.split(" ");
if (xocsString.length() > 0) {
extensibleObject = true;
}
LinkedHashMap<ObjectClass, String> xObjectClasses =
new LinkedHashMap<ObjectClass, String>();
List<NdbResultSet> ocRsList = new ArrayList<NdbResultSet>();
Map<String, Map<String, NdbBlob>> blobMap =
new HashMap<String, Map<String, NdbBlob>>();
LinkedHashMap<ObjectClass, String> objectClasses =
new LinkedHashMap<ObjectClass, String>(ocsStringArray.length);
NdbTransaction ndbDATxn = null;
NdbIndexScanOperation tagScanOp = null;
for (String ocName : ocsStringArray) {
ObjectClass oc =
DirectoryServer.getObjectClass(ocName, true);
objectClasses.put(oc, ocName);
if (oc.getObjectClassType() == ObjectClassType.ABSTRACT) {
continue;
}
if (ndbDATxn == null) {
ndbDATxn = txn.getNdbDATransaction(ocName, eid);
}
indexScanOp =
ndbDATxn.getSelectIndexScanOperation(
PRIMARY_INDEX_NAME, ocName,
NdbOperation.LockMode.LM_CommittedRead);
indexScanOp.setBoundLong(BackendImpl.EID,
NdbIndexScanOperation.BoundType.BoundEQ, eid);
indexScanOp.getValue(BackendImpl.MID);
for (AttributeType reqAttr : oc.getRequiredAttributes()) {
String attrName = reqAttr.getNameOrOID();
if (BackendImpl.blobAttributes.contains(attrName)) {
NdbBlob blob = indexScanOp.getBlobHandle(attrName);
Map<String, NdbBlob> attr2Blob = blobMap.get(ocName);
if (attr2Blob == null) {
attr2Blob = new HashMap<String, NdbBlob>();
}
attr2Blob.put(attrName, blob);
blobMap.put(ocName, attr2Blob);
} else {
indexScanOp.getValue(attrName);
}
}
for (AttributeType optAttr : oc.getOptionalAttributes()) {
String attrName = optAttr.getNameOrOID();
if (BackendImpl.blobAttributes.contains(attrName)) {
NdbBlob blob = indexScanOp.getBlobHandle(attrName);
Map<String, NdbBlob> attr2Blob = blobMap.get(ocName);
if (attr2Blob == null) {
attr2Blob = new HashMap<String, NdbBlob>();
}
attr2Blob.put(attrName, blob);
blobMap.put(ocName, attr2Blob);
} else {
indexScanOp.getValue(attrName);
}
}
ocRsList.add(indexScanOp.resultData());
}
// Extensible object.
if (extensibleObject) {
for (String xocName : xocsStringArray) {
ObjectClass xoc =
DirectoryServer.getObjectClass(xocName, true);
objectClasses.put(xoc, xocName);
xObjectClasses.put(xoc, xocName);
if (xoc.getObjectClassType() == ObjectClassType.ABSTRACT) {
continue;
}
if (ndbDATxn == null) {
ndbDATxn = txn.getNdbDATransaction(xocName, eid);
}
indexScanOp =
ndbDATxn.getSelectIndexScanOperation(
PRIMARY_INDEX_NAME, xocName,
NdbOperation.LockMode.LM_CommittedRead);
indexScanOp.setBoundLong(BackendImpl.EID,
NdbIndexScanOperation.BoundType.BoundEQ, eid);
indexScanOp.getValue(BackendImpl.MID);
for (AttributeType reqAttr : xoc.getRequiredAttributes()) {
String attrName = reqAttr.getNameOrOID();
if (BackendImpl.blobAttributes.contains(attrName)) {
NdbBlob blob = indexScanOp.getBlobHandle(attrName);
Map<String, NdbBlob> attr2Blob = blobMap.get(xocName);
if (attr2Blob == null) {
attr2Blob = new HashMap<String, NdbBlob>();
}
attr2Blob.put(attrName, blob);
blobMap.put(xocName, attr2Blob);
} else {
indexScanOp.getValue(attrName);
}
}
for (AttributeType optAttr : xoc.getOptionalAttributes()) {
String attrName = optAttr.getNameOrOID();
if (BackendImpl.blobAttributes.contains(attrName)) {
NdbBlob blob = indexScanOp.getBlobHandle(attrName);
Map<String, NdbBlob> attr2Blob = blobMap.get(xocName);
if (attr2Blob == null) {
attr2Blob = new HashMap<String, NdbBlob>();
}
attr2Blob.put(attrName, blob);
blobMap.put(xocName, attr2Blob);
} else {
indexScanOp.getValue(attrName);
}
}
ocRsList.add(indexScanOp.resultData());
}
}
// Operational attributes.
op = ndbDATxn.getSelectOperation(BackendImpl.OPATTRS_TABLE,
NdbOperation.LockMode.LM_CommittedRead);
op.equalLong(BackendImpl.EID, eid);
for (String attrName : BackendImpl.operationalAttributes) {
op.getValue(attrName);
}
ocRsList.add(op.resultData());
// Attribute options.
tagScanOp = ndbDATxn.getSelectIndexScanOperation(
PRIMARY_INDEX_NAME,
BackendImpl.TAGS_TABLE,
NdbOperation.LockMode.LM_CommittedRead);
tagScanOp.setBoundLong(BackendImpl.EID,
NdbIndexScanOperation.BoundType.BoundEQ, eid);
tagScanOp.getValue(BackendImpl.TAG_ATTR);
tagScanOp.getValue(BackendImpl.MID);
tagScanOp.getValue(BackendImpl.TAG_TAGS);
NdbResultSet tagRs = tagScanOp.resultData();
ndbDATxn.execute(ExecType.NoCommit, AbortOption.AO_IgnoreError, true);
return decodeNDBEntry(dn, ocRsList, tagRs, objectClasses,
xObjectClasses, blobMap, extensibleObject);