protected String getSchemaNamespace() { return getTypeName().getNamespaceURI(); }
@NotNull @Override public ComplexTypeDefinition deepClone(Map<QName, ComplexTypeDefinition> ctdMap, Map<QName, ComplexTypeDefinition> onThisPath, Consumer<ItemDefinition> postCloneAction) { if (ctdMap != null) { ComplexTypeDefinition clone = ctdMap.get(this.getTypeName()); if (clone != null) { return clone; // already cloned } } ComplexTypeDefinition cloneInParent = onThisPath.get(this.getTypeName()); if (cloneInParent != null) { return cloneInParent; } ComplexTypeDefinitionImpl clone = clone(); // shallow if (ctdMap != null) { ctdMap.put(this.getTypeName(), clone); } onThisPath.put(this.getTypeName(), clone); clone.itemDefinitions.clear(); for (ItemDefinition itemDef: this.itemDefinitions) { ItemDefinition itemClone = itemDef.deepClone(ctdMap, onThisPath, postCloneAction); clone.itemDefinitions.add(itemClone); if (postCloneAction != null) { postCloneAction.accept(itemClone); } } onThisPath.remove(this.getTypeName()); return clone; }
@Override public void replaceDefinition(QName itemName, ItemDefinition newDefinition) { for (int i=0; i<itemDefinitions.size(); i++) { ItemDefinition itemDef = itemDefinitions.get(i); if (itemDef.getName().equals(itemName)) { if (!itemDef.getClass().isAssignableFrom(newDefinition.getClass())) { throw new IllegalArgumentException("The provided definition of class "+newDefinition.getClass().getName()+" does not match existing definition of class "+itemDef.getClass().getName()); } if (!itemDef.getName().equals(newDefinition.getName())) { newDefinition = newDefinition.clone(); ((ItemDefinitionImpl) newDefinition).setName(itemName); } // Make sure this is set, not add. set will keep correct ordering itemDefinitions.set(i, newDefinition); return; } } throw new IllegalArgumentException("The definition with name "+ itemName +" was not found in complex type "+getTypeName()); }
throw new IllegalStateException("Couldn't use '@' path segment in this context. CTD=" + getTypeName() + ", path=" + path); } else if (ItemPath.isIdentifier(first)) { if (!clazz.isAssignableFrom(PrismPropertyDefinition.class)) {