static boolean isIgnored(ResourceAttributeDefinitionType attrDefType) throws SchemaException { List<PropertyLimitationsType> limitations = attrDefType.getLimitations(); if (limitations == null) { return false; } PropertyLimitationsType limitationsType = MiscSchemaUtil.getLimitationsType(limitations, DEFAULT_LAYER); if (limitationsType == null) { return false; } if (limitationsType.getProcessing() != null) { return limitationsType.getProcessing() == ItemProcessingType.IGNORE; } if (limitationsType.isIgnore() != null) { return limitationsType.isIgnore(); } return false; }
clone.ignore = ((this.ignore == null)?null:this.isIgnore());
/** * Creates a new {@code PropertyLimitationsType} instance by deeply copying a given {@code PropertyLimitationsType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public PropertyLimitationsType(final PropertyLimitationsType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'PropertyLimitationsType' from 'null'."); } // 'Layer' collection. if (o.layer!= null) { copyLayer(o.getLayer(), this.getLayer()); } // CBuiltinLeafInfo: java.lang.String this.minOccurs = ((o.minOccurs == null)?null:o.getMinOccurs()); // CBuiltinLeafInfo: java.lang.String this.maxOccurs = ((o.maxOccurs == null)?null:o.getMaxOccurs()); // CBuiltinLeafInfo: java.lang.Boolean this.ignore = ((o.ignore == null)?null:o.isIgnore()); // CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.ItemProcessingType this.processing = ((o.processing == null)?null:o.getProcessing()); // CClassInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyAccessType this.access = ((o.access == null)?null:((o.getAccess() == null)?null:o.getAccess().clone())); }
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); } }
theIgnore = this.isIgnore(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "ignore", theIgnore), currentHashCode, theIgnore);
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()); } } }