LDAPAttributeSet oAttrs;
PreparedStatement oStmt;
ResultSet oRSet;
ResultSetMetaData oMDat;
String sDN, sDomainNm, sWorkAreaNm;
LDAPSearchResults searchResults = null;
if (DebugFile.trace) {
DebugFile.writeln("Begin LDAPNovell.loadDomain([Connection]" + String.valueOf(iDomainId) + ",...)");
DebugFile.incIdent();
}
if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(SELECT nm_domain FROM k_domains WHERE id_domain=" + String.valueOf(iDomainId) + ")");
oStmt = oJdbc.prepareStatement("SELECT nm_domain FROM k_domains WHERE id_domain=?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
oStmt.setInt(1, iDomainId);
oRSet = oStmt.executeQuery();
oRSet.next();
sDomainNm = oRSet.getString(1);
oRSet.close();
oStmt.close();
// *************
// Create Domain
sDN = "dc=" + sDomainNm + "," + getPartitionName();
try {
searchResults = oConn.search(getPartitionName(), LDAPConnection.SCOPE_ONE,"(dc=" + sDomainNm + ")", new String[] {"dn"}, true);
}
catch (com.novell.ldap.LDAPException e) {
throw new com.knowgate.ldap.LDAPException(e.getMessage(), e);
}
if (!searchResults.hasMore())
addHive(sDN, sDomainNm);
// ****************
// Create Workareas
if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(SELECT nm_workarea FROM k_workareas WHERE id_domain=" + String.valueOf(iDomainId) + ")");
oStmt = oJdbc.prepareStatement("SELECT nm_workarea FROM k_workareas WHERE id_domain=?",ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
oStmt.setInt(1, iDomainId);
oRSet = oStmt.executeQuery();
while (oRSet.next()) {
sWorkAreaNm = oRSet.getString(1);
sDN = "dc=" + sWorkAreaNm + ",dc=" + sDomainNm + "," + getPartitionName();
try {
searchResults = oConn.search("dc=" + sDomainNm + "," + getPartitionName(), LDAPConnection.SCOPE_ONE,"(dc=" + sWorkAreaNm + ")", new String[] {"dn"}, true);
}
catch (com.novell.ldap.LDAPException e) {
throw new com.knowgate.ldap.LDAPException(e.getMessage(), e);
}
if (!searchResults.hasMore()) {
// Primero crear la rama de la WorkArea
addHive (sDN, sWorkAreaNm);
// Despues se crean los subcontenedores necesarios
addHive ("dc=users," + sDN, "users");