boolean isItemVisible(ItemWrapper item) {
    ItemDefinition def = item.getItemDefinition();
    if (def.isIgnored() || def.isOperational()) {
      return false;
    }

    if (def instanceof PrismPropertyDefinition && skipProperty((PrismPropertyDefinition) def)) {
      return false;
    }

    // we decide not according to status of this container, but according to
    // the status of the whole object
    if (objectWrapper.getStatus() == ContainerStatus.ADDING) {
      return def.canAdd();
    }

    // otherwise, object.getStatus() is MODIFYING

    if (def.canModify()) {
      return showEmpty(item);
    } else {
      if (def.canRead()) {
        return showEmpty(item);
      }
      return false;
    }
  }
  private boolean hasEmptyPlaceholder(ItemWrapper property) {
    for (ValueWrapper value : property.getValues()) {
      value.normalize(property.getItemDefinition().getPrismContext());
      if (ValueStatus.ADDED.equals(value.getStatus()) && !value.hasValueChanged()) {
        return true;
      }
    }

    return false;
  }
 private int countNonDeletedValues(ItemWrapper property) {
   int count = 0;
   for (ValueWrapper value : property.getValues()) {
     value.normalize(property.getItemDefinition().getPrismContext());
     if (ValueStatus.DELETED.equals(value.getStatus())) {
       continue;
     }
     count++;
   }
   return count;
 }
  private List<ValueWrapper> getUsableValues(ItemWrapper property) {
    List<ValueWrapper> values = new ArrayList<>();
    for (ValueWrapper value : property.getValues()) {
      value.normalize(property.getItemDefinition().getPrismContext());
      if (ValueStatus.DELETED.equals(value.getStatus())) {
        continue;
      }
      values.add(value);
    }

    return values;
  }
  private int countUsableValues(ItemWrapper property) {
    int count = 0;
    for (ValueWrapper value : property.getValues()) {
      value.normalize(property.getItemDefinition().getPrismContext());

      if (ValueStatus.DELETED.equals(value.getStatus())) {
        continue;
      }

      if (ValueStatus.ADDED.equals(value.getStatus()) && !value.hasValueChanged()) {
        continue;
      }

      count++;
    }
    return count;
  }