@Override
 public String debugDump(int indent) {
   StringBuilder sb = new StringBuilder();
   DebugUtil.indentDebugDump(sb, indent);
   sb.append("ContainerWrapper: ").append(PrettyPrinter.prettyPrint(getName())).append("\n");
   DebugUtil.debugDumpWithLabel(sb, "displayName", displayName, indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb, "status", status == null ? null : status.toString(), indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(sb, "main", main, indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(sb, "readonly", readonly, indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb, "showInheritedObjectAttributes", showInheritedObjectAttributes, indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(sb, "path", path == null ? null : path.toString(), indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb,
       "containerDefinition",
       containerDefinition == null ? null : containerDefinition.toString(),
       indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb, "container", container == null ? null : container.toString(), indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpLabel(sb, "properties", indent + 1);
   sb.append("\n");
   DebugUtil.debugDump(sb, properties, indent + 2, false);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(sb, "result", result, indent + 1);
   return sb.toString();
 }
 private String formatAssignmentBrief(AssignmentType assignment) {
   StringBuilder sb = new StringBuilder();
   if (assignment.getTarget() != null) {
     sb.append(assignment.getTarget().getName());
   } else {
     sb.append(assignment.getTargetRef().getOid());
   }
   if (assignment.getActivation() != null
       && (assignment.getActivation().getValidFrom() != null
           || assignment.getActivation().getValidTo() != null)) {
     sb.append(" ");
     sb.append("(");
     sb.append(formatTimeIntervalBrief(assignment));
     sb.append(")");
   }
   if (assignment.getActivation() != null) {
     switch (assignment.getActivation().getAdministrativeStatus()) {
       case ARCHIVED:
         sb.append(", archived");
         break; // TODO i18n
       case ENABLED:
         sb.append(", enabled");
         break;
       case DISABLED:
         sb.append(", disabled");
         break;
     }
   }
   return sb.toString();
 }
 @Override
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder.append("ContainerWrapper(");
   builder.append(getDisplayNameFromItem(container));
   builder.append(" (");
   builder.append(status);
   builder.append(") ");
   builder.append(getItems() == null ? null : getItems().size());
   builder.append(" items)");
   return builder.toString();
 }
示例#4
0
  // TODO - try to get rid of <br> attributes when creating new lines in association attributes
  // pop-up
  private String createAssociationTooltipText(PrismProperty property) {
    StringBuilder sb = new StringBuilder();
    sb.append(getString("prismValuePanel.message.association.attributes")).append("<br>");

    if (property.getParent() != null && property.getParent().getParent() != null) {
      PrismObject<ShadowType> shadowPrism =
          (PrismObject<ShadowType>) property.getParent().getParent();

      Collection<ResourceAttribute<?>> attributes = ShadowUtil.getAttributes(shadowPrism);
      if (attributes == null || attributes.isEmpty()) {
        return sb.toString();
      }

      // TODO - this is a dirty fix for situation, when attribute value is too long and it is a
      // string without white chars,
      // thus it will not break in tooltip. break-all is also not good, since it can brake in the
      // middle of words. What we
      // are doing here is replacing every, with ,&#8203;, &#8203; (the same with @) is a zero-width
      // space, so the attribute value
      // will break after comma. This dirty fix will be removed when association editor is
      // completed.
      for (ResourceAttribute<?> attr : attributes) {
        for (Object realValue : attr.getRealValues()) {
          sb.append(getAttributeName(attr));
          sb.append(":");
          if (realValue != null) {
            sb.append(
                realValue
                    .toString()
                    .replace(",", ",&#8203;")
                    .replace("@", "@&#8203;")
                    .replace("_", "@&#8203;"));
          }
          sb.append("<br>");
        }
      }
    }

    return sb.toString();
  }
 @Override
 public String debugDump(int indent) {
   StringBuilder sb = new StringBuilder();
   if (actualValue != null) {
     debugDumpValue(indent, sb, actualValue);
   } else if (valueForStorageWhenNotEncoded != null) {
     debugDumpValue(indent, sb, valueForStorageWhenNotEncoded);
   } else if (valueForStorageWhenEncoded != null) {
     DebugUtil.debugDumpWithLabel(sb, "encoded value", valueForStorageWhenEncoded, indent);
   } else {
     DebugUtil.debugDumpWithLabel(sb, "value", "null", indent);
   }
   return sb.toString();
 }
 public static String formatTimeIntervalBrief(AssignmentType assignment) {
   StringBuilder sb = new StringBuilder();
   if (assignment != null
       && assignment.getActivation() != null
       && (assignment.getActivation().getValidFrom() != null
           || assignment.getActivation().getValidTo() != null)) {
     if (assignment.getActivation().getValidFrom() != null
         && assignment.getActivation().getValidTo() != null) {
       sb.append(formatTime(assignment.getActivation().getValidFrom()));
       sb.append("-");
       sb.append(formatTime(assignment.getActivation().getValidTo()));
     } else if (assignment.getActivation().getValidFrom() != null) {
       sb.append("from ");
       sb.append(formatTime(assignment.getActivation().getValidFrom()));
     } else {
       sb.append("to ");
       sb.append(formatTime(assignment.getActivation().getValidTo()));
     }
   }
   return sb.toString();
 }