Exemplo n.º 1
0
 @Override
 public ItemDefinition getItemDefinition() {
   ItemDefinition propDef = null;
   if (container.getItemDefinition() != null) {
     propDef =
         container.getItemDefinition().findItemDefinition(property.getDefinition().getName());
   }
   if (propDef == null) {
     propDef = property.getDefinition();
   }
   return propDef;
 }
Exemplo n.º 2
0
 @Override
 public String debugDump(int indent) {
   StringBuilder sb = new StringBuilder();
   DebugUtil.indentDebugDump(sb, indent);
   sb.append(getDebugName());
   sb.append(": ").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, "readonly", readonly, indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb,
       "itemDefinition",
       itemDefinition == null ? null : itemDefinition.toString(),
       indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpWithLabel(
       sb, "property", property == null ? null : property.toString(), indent + 1);
   sb.append("\n");
   DebugUtil.debugDumpLabel(sb, "values", indent + 1);
   sb.append("\n");
   DebugUtil.debugDump(sb, values, indent + 2, false);
   return sb.toString();
 }
Exemplo n.º 3
0
  public boolean isVisible() {
    if (property.getDefinition().isOperational()) {
      return false;
    }

    return container.isItemVisible(this);
  }
Exemplo n.º 4
0
 public void revive(PrismContext prismContext) throws SchemaException {
   if (property != null) {
     property.revive(prismContext);
   }
   if (itemDefinition != null) {
     itemDefinition.revive(prismContext);
   }
 }
Exemplo n.º 5
0
  private List<ValueWrapper> createValues() {
    List<ValueWrapper> values = new ArrayList<ValueWrapper>();

    for (PrismValue prismValue : (List<PrismValue>) property.getValues()) {
      values.add(new ValueWrapper(this, prismValue, ValueStatus.NOT_CHANGED));
    }

    int minOccurs = property.getDefinition().getMinOccurs();
    while (values.size() < minOccurs) {
      values.add(createAddedValue());
    }

    if (values.isEmpty()) {
      values.add(createAddedValue());
    }

    return values;
  }
Exemplo n.º 6
0
  private boolean isThisPropertyActivationEnabled() {
    if (!new ItemPath(UserType.F_ACTIVATION).equivalent(container.getPath())) {
      return false;
    }

    if (!ActivationType.F_ADMINISTRATIVE_STATUS.equals(property.getElementName())) {
      return false;
    }

    if (ContainerStatus.MODIFYING.equals(container.getObject().getStatus())) {
      // when modifying then we don't want to create "true" value for c:activation/c:enabled, only
      // during add
      return false;
    }

    return true;
  }
Exemplo n.º 7
0
  public PropertyWrapper(
      ContainerWrapper container, I property, boolean readonly, ValueStatus status) {
    Validate.notNull(property, "Property must not be null.");
    Validate.notNull(status, "Property status must not be null.");

    this.container = container;
    this.property = property;
    this.status = status;
    this.readonly = readonly;
    this.itemDefinition = getItemDefinition();

    ItemPath passwordPath =
        new ItemPath(SchemaConstantsGenerated.C_CREDENTIALS, CredentialsType.F_PASSWORD);
    if (passwordPath.equivalent(container.getPath())
        && PasswordType.F_VALUE.equals(property.getElementName())) {
      displayName = "prismPropertyPanel.name.credentials.password";
    }

    values = createValues();
  }
Exemplo n.º 8
0
  public ValueWrapper createAddedValue() {
    ItemDefinition definition = property.getDefinition();

    ValueWrapper wrapper;
    if (SchemaConstants.T_POLY_STRING_TYPE.equals(definition.getTypeName())) {
      wrapper =
          new ValueWrapper(
              this,
              new PrismPropertyValue(new PolyString("")),
              new PrismPropertyValue(new PolyString("")),
              ValueStatus.ADDED);
    } else if (isUser() && isThisPropertyActivationEnabled()) {
      wrapper =
          new ValueWrapper(
              this, new PrismPropertyValue(null), new PrismPropertyValue(null), ValueStatus.ADDED);
    } else {
      wrapper = new ValueWrapper(this, new PrismPropertyValue(null), ValueStatus.ADDED);
    }

    return wrapper;
  }
Exemplo n.º 9
0
 public ItemDefinition getDefinition() {
   return property.getDefinition();
 }