@Nullable private QName itemRefToName(ItemPathType ref) { return ref != null ? ref.getItemPath().asSingleName() : null; }
public static QName asSingleName(ItemPathType pathType) { return pathType != null ? pathType.getItemPath().asSingleName() : null; }
@Override public void trimTo(@NotNull Collection<ItemPath> paths) { originalObjectClassDefinition.trimTo(paths); List<QName> names = paths.stream() .filter(p -> p.isSingleName()) .map(p -> p.asSingleName()) .collect(Collectors.toList()); attributeDefinitions.removeIf(itemDefinition -> !QNameUtil.contains(names, itemDefinition.getName())); associationDefinitions.removeIf(itemDefinition -> !QNameUtil.contains(names, itemDefinition.getName())); }
private ObjectQuery narrowQueryForBucket(ObjectQuery query, Task localCoordinatorTask, WorkBucketType workBucket, ObjectClassComplexTypeDefinition objectclassDef, OperationResult opResult) throws SchemaException, ObjectNotFoundException { return taskManager.narrowQueryForWorkBucket(query, ShadowType.class, itemPath -> { if (itemPath.startsWithName(ShadowType.F_ATTRIBUTES)) { return objectclassDef.findAttributeDefinition(itemPath.rest().asSingleName()); } else { return null; } }, localCoordinatorTask, workBucket, opResult); }
@Override protected Function<ItemPath, ItemDefinition<?>> getIdentifierDefinitionProvider(Task localCoordinatorTask, OperationResult opResult) { TaskRunResult dummyRunResult = new TaskRunResult(); ResourceType resource = resolveObjectRef(ResourceType.class, dummyRunResult, localCoordinatorTask, opResult); if (resource == null) { return null; } ObjectClassComplexTypeDefinition objectClass = determineObjectClassDefinition(resource, null, dummyRunResult, localCoordinatorTask, opResult); if (objectClass == null) { return null; } return itemPath -> { if (itemPath.startsWithName(ShadowType.F_ATTRIBUTES)) { return objectClass.findAttributeDefinition(itemPath.rest().asSingleName()); } else { return null; } }; }
private void checkItemRef(ResourceValidationContext ctx, ItemPath path, ResourceObjectTypeDefinitionType objectType, ResourceItemDefinitionType itemDef, String noRefKey) { ItemPath refPath = itemDef.getRef() != null ? itemDef.getRef().getItemPath() : null; if (ItemPath.isEmpty(refPath)) { ctx.validationResult.add(Issue.Severity.ERROR, CAT_SCHEMA_HANDLING, noRefKey, getString(CLASS_DOT + noRefKey, getName(objectType)), ctx.resourceRef, path.append(ItemRefinedDefinitionType.F_REF)); } else if (refPath.size() > 1 || !refPath.startsWithName()) { ctx.validationResult.add(Issue.Severity.ERROR, CAT_SCHEMA_HANDLING, C_WRONG_ITEM_NAME, getString(CLASS_DOT + C_WRONG_ITEM_NAME, getName(objectType), refPath.toString()), ctx.resourceRef, path.append(ItemRefinedDefinitionType.F_REF)); } else if (StringUtils.isBlank(refPath.asSingleName().getNamespaceURI())) { ctx.validationResult.add(Issue.Severity.WARNING, CAT_SCHEMA_HANDLING, C_NO_ITEM_NAMESPACE, getString(CLASS_DOT + C_NO_ITEM_NAMESPACE, getName(objectType), refPath.toString()), ctx.resourceRef, path.append(ItemRefinedDefinitionType.F_REF)); } }