private List<PrismContainer> getChildrenContainers(PrismObject parent) {
    List<PrismContainer> containers = new ArrayList<>();
    if (ObjectType.class.isAssignableFrom(parent.getCompileTimeClass())) {
      containers.add(parent.findContainer(ObjectType.F_TRIGGER));
    }

    if (LookupTableType.class.isAssignableFrom(parent.getCompileTimeClass())) {
      containers.add(parent.findContainer(LookupTableType.F_ROW));
    }

    if (FocusType.class.isAssignableFrom(parent.getCompileTimeClass())) {
      containers.add(parent.findContainer(FocusType.F_ASSIGNMENT));
    }

    if (AbstractRoleType.class.isAssignableFrom(parent.getCompileTimeClass())) {
      containers.add(parent.findContainer(AbstractRoleType.F_INDUCEMENT));
      containers.add(parent.findContainer(AbstractRoleType.F_EXCLUSION));
      containers.add(parent.findContainer(AbstractRoleType.F_AUTHORIZATION));
      PrismContainer policyConstraints =
          parent.findContainer(AbstractRoleType.F_POLICY_CONSTRAINTS);
      if (policyConstraints != null) {
        containers.add(policyConstraints.findContainer(PolicyConstraintsType.F_MAX_ASSIGNEES));
        containers.add(policyConstraints.findContainer(PolicyConstraintsType.F_MIN_ASSIGNEES));
      }
    }

    return containers;
  }
예제 #2
0
  private List<ContainerWrapper> createContainerWrapper(
      PrismContainer parent, ItemPath path, PageBase pageBase) {

    PrismContainerDefinition definition = parent.getDefinition();
    List<ContainerWrapper> wrappers = new ArrayList<ContainerWrapper>();

    List<ItemPathSegment> segments = new ArrayList<ItemPathSegment>();
    if (path != null) {
      segments.addAll(path.getSegments());
    }
    ItemPath parentPath = new ItemPath(segments);
    for (ItemDefinition def : (Collection<ItemDefinition>) definition.getDefinitions()) {
      if (!(def instanceof PrismContainerDefinition)) {
        continue;
      }
      if (ObjectSpecificationType.COMPLEX_TYPE.equals(def.getTypeName())) {
        continue; // TEMPORARY FIX
      }
      if (TriggerType.COMPLEX_TYPE.equals(def.getTypeName())) {
        continue; // TEMPORARY FIX TODO: remove after getEditSchema
        // (authorization) will be fixed.
      }
      if (ApprovalSchemaType.COMPLEX_TYPE.equals(def.getTypeName())) {
        continue;
      }

      LOGGER.trace("ObjectWrapper.createContainerWrapper processing definition: {}", def);

      PrismContainerDefinition containerDef = (PrismContainerDefinition) def;
      if (!showAssignments && AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName())) {
        continue;
      }
      if (!showInheritedObjectAttributes) {
        boolean result = INHERITED_OBJECT_SUBCONTAINERS.contains(containerDef.getName());
        LOGGER.info("checking " + containerDef.getName() + ", result = " + result);
        if (result) {
          continue;
        }
      }

      ItemPath newPath = createPropertyPath(parentPath, containerDef.getName());

      // [med]
      // The following code fails to work when parent is multivalued or
      // potentially multivalued.
      // Therefore (as a brutal hack), for multivalued parents we simply
      // skip it.
      if (parent.size() <= 1) {

        // the same check as in getValue() implementation
        boolean isMultiValued =
            parent.getDefinition() != null
                && !parent.getDefinition().isDynamic()
                && !parent.getDefinition().isSingleValue();
        if (!isMultiValued) {
          PrismContainer prismContainer = parent.findContainer(def.getName());

          ContainerWrapper container;
          if (prismContainer != null) {
            container =
                new ContainerWrapper(
                    this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase);
          } else {
            prismContainer = containerDef.instantiate();
            container =
                new ContainerWrapper(
                    this, prismContainer, ContainerStatus.ADDING, newPath, pageBase);
          }
          addSubresult(container.getResult());
          wrappers.add(container);

          if (!AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName())
              || !ShadowType.F_ASSOCIATION.equals(parent.getElementName())) { // do
            // not
            // show
            // internals
            // of
            // Assignments
            // (e.g.
            // activation)
            wrappers.addAll(createContainerWrapper(prismContainer, newPath, pageBase));
          }
        }
      }
    }

    return wrappers;
  }