use of com.unboundid.ldap.sdk.unboundidds.controls.AssuredReplicationServerResultCode in project ldapsdk by pingidentity.
the class ResultUtils method addAssuredReplicationResponseControl.
/**
* Adds a multi-line string representation of the provided control, which is
* expected to be an assured replication response control, to the given list.
*
* @param lines The list to which the lines should be added.
* @param c The control to be formatted.
* @param prefix The prefix to use for each line.
* @param maxWidth The maximum length of each line in characters, including
* the comment prefix and indent.
*/
private static void addAssuredReplicationResponseControl(@NotNull final List<String> lines, @NotNull final Control c, @NotNull final String prefix, final int maxWidth) {
final AssuredReplicationResponseControl decoded;
try {
decoded = new AssuredReplicationResponseControl(c.getOID(), c.isCritical(), c.getValue());
} catch (final Exception e) {
Debug.debugException(e);
addGenericResponseControl(lines, c, prefix, maxWidth);
return;
}
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_HEADER.get(), prefix, maxWidth);
final String indentPrefix = prefix + " ";
wrap(lines, INFO_RESULT_UTILS_RESPONSE_CONTROL_OID.get(c.getOID()), indentPrefix, maxWidth);
final String csn = decoded.getCSN();
if (csn != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_CSN.get(csn), indentPrefix, maxWidth);
}
final AssuredReplicationLocalLevel localLevel = decoded.getLocalLevel();
if (localLevel != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_LOCAL_LEVEL.get(localLevel.name()), indentPrefix, maxWidth);
}
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_LOCAL_SATISFIED.get(decoded.localAssuranceSatisfied()), indentPrefix, maxWidth);
final String localMessage = decoded.getLocalAssuranceMessage();
if (localMessage != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_LOCAL_MESSAGE.get(localMessage), indentPrefix, maxWidth);
}
final AssuredReplicationRemoteLevel remoteLevel = decoded.getRemoteLevel();
if (remoteLevel != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_REMOTE_LEVEL.get(remoteLevel.name()), indentPrefix, maxWidth);
}
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_REMOTE_SATISFIED.get(decoded.remoteAssuranceSatisfied()), indentPrefix, maxWidth);
final String remoteMessage = decoded.getRemoteAssuranceMessage();
if (remoteMessage != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_REMOTE_MESSAGE.get(remoteMessage), indentPrefix, maxWidth);
}
final List<AssuredReplicationServerResult> serverResults = decoded.getServerResults();
if (serverResults != null) {
for (final AssuredReplicationServerResult r : serverResults) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_SERVER_RESULT_HEADER.get(), indentPrefix, maxWidth);
final AssuredReplicationServerResultCode rc = r.getResultCode();
if (rc != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_SERVER_RESULT_CODE.get(rc.name()), indentPrefix + " ", maxWidth);
}
final Short replicationServerID = r.getReplicationServerID();
if (replicationServerID != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_SERVER_RESULT_REPL_SERVER_ID.get(replicationServerID), indentPrefix + " ", maxWidth);
}
final Short replicaID = r.getReplicaID();
if (replicaID != null) {
wrap(lines, INFO_RESULT_UTILS_ASSURED_REPL_SERVER_RESULT_REPL_ID.get(replicaID), indentPrefix + " ", maxWidth);
}
}
}
}
Aggregations