@NotNull @Override public PrismReference instantiate(QName name) { name = DefinitionUtil.addNamespaceIfApplicable(name, this.name); return new PrismReferenceImpl(name, this, prismContext); }
private <O extends ObjectType> void checkItemLimitations(PrismObject<O> object, ItemPath path, PropertyLimitationsType limitation) throws SchemaException { Object item = object.find(path); if (isTrue(limitation.isIgnore())) { return; } int count = getValueCount(item); Integer min = DefinitionUtil.parseMultiplicity(limitation.getMinOccurs()); if (min != null && min > 0 && count < min) { throw new SchemaException("Expected at least " + min + " values of " + path + ", got " + count); } Integer max = DefinitionUtil.parseMultiplicity(limitation.getMaxOccurs()); if (max != null && max >= 0 && count > max) { throw new SchemaException("Expected at most " + max + " values of " + path + ", got " + count); } }
private static void applyLimitationsType(PropertyLimitations limitations, PropertyLimitationsType layerLimitationsType) { if (layerLimitationsType.getMinOccurs() != null) { limitations.setMinOccurs(DefinitionUtil.parseMultiplicity(layerLimitationsType.getMinOccurs())); } if (layerLimitationsType.getMaxOccurs() != null) { limitations.setMaxOccurs(DefinitionUtil.parseMultiplicity(layerLimitationsType.getMaxOccurs())); } if (layerLimitationsType.isIgnore() != null) { limitations.setProcessing(ItemProcessing.IGNORE); } if (layerLimitationsType.getProcessing() != null) { limitations.setProcessing(MiscSchemaUtil.toItemProcessing(layerLimitationsType.getProcessing())); } if (layerLimitationsType.getAccess() != null) { PropertyAccessType accessType = layerLimitationsType.getAccess(); if (accessType.isAdd() != null) { limitations.getAccess().setAdd(accessType.isAdd()); } if (accessType.isRead() != null) { limitations.getAccess().setRead(accessType.isRead()); } if (accessType.isModify() != null) { limitations.getAccess().setModify(accessType.isModify()); } } }
@NotNull @Override public PrismProperty<T> instantiate(QName name) { name = DefinitionUtil.addNamespaceIfApplicable(name, this.name); return new PrismPropertyImpl<>(name, this, prismContext); }
@NotNull @Override public ResourceAttribute<T> instantiate(QName name) { name = addNamespaceIfApplicable(name, this.name); return new ResourceAttributeImpl<>(name, this, prismContext); }
@NotNull @Override public ResourceAttributeContainer instantiate(QName name) { name = DefinitionUtil.addNamespaceIfApplicable(name, this.name); return new ResourceAttributeContainerImpl(name, this, prismContext); }
@NotNull @Override public PrismContainer<C> instantiate(QName elementName) throws SchemaException { if (isAbstract()) { throw new SchemaException("Cannot instantiate abstract definition "+this); } elementName = DefinitionUtil.addNamespaceIfApplicable(elementName, this.name); return new PrismContainerImpl<>(elementName, this, prismContext); }
@NotNull @Override public PrismObject<O> instantiate(QName name) throws SchemaException { if (isAbstract()) { throw new SchemaException("Cannot instantiate abstract definition "+this); } name = DefinitionUtil.addNamespaceIfApplicable(name, this.name); return new PrismObjectImpl<>(name, this, prismContext); }