@NotNull @Override public PrismPropertyDefinitionImpl<T> clone() { PrismPropertyDefinitionImpl<T> clone = new PrismPropertyDefinitionImpl<>(getName(), getTypeName(), getPrismContext()); copyDefinitionData(clone); return clone; }
@NotNull @Override public PrismProperty<T> instantiate() { return instantiate(getName()); }
private PrismPropertyDefinition<?> createAdHocPropertyDefinition(QName elementName, QName typeName, int minOccurs, int maxOccurs) { PrismPropertyDefinitionImpl<?> def = new PrismPropertyDefinitionImpl<>(elementName, typeName, prismContext); def.setMinOccurs(minOccurs); def.setMaxOccurs(maxOccurs); return def; }
public static ItemDefinition createDefaultItemDefinition(QName itemName, PrismContext prismContext) { PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(itemName, DEFAULT_XSD_TYPE, prismContext); // Set it to multi-value to be on the safe side propDef.setMaxOccurs(-1); propDef.setDynamic(true); return propDef; }
@Override public <T> MutablePrismPropertyDefinition<T> createPropertyDefinition(QName name, QName typeName, Collection<? extends DisplayableValue<T>> allowedValues, T defaultValue) { return new PrismPropertyDefinitionImpl<>(name, typeName, prismContext, allowedValues, defaultValue); } }
if (val.getClass().isPrimitive()){ QName typeName = XsdTypeMapper.toXsdType(val.getClass()); PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(elementQName, typeName, prismContext); propDef.setDynamic(true); return propDef;
protected void copyDefinitionData(ResourceAttributeDefinitionImpl<T> clone) { super.copyDefinitionData(clone); clone.nativeAttributeName = this.nativeAttributeName; clone.frameworkAttributeName = this.frameworkAttributeName; clone.returnedByDefault = this.returnedByDefault; }
oidDefinition = new PrismPropertyDefinitionImpl<>(PrismConstants.T_ID, DOMUtil.XSD_STRING, prismContext); } else if (containerMarker) { oidDefinition = new PrismPropertyDefinitionImpl<>(PrismConstants.T_ID, DOMUtil.XSD_INTEGER, prismContext); } else { throw new IllegalStateException("No identifier for complex type " + this); oidDefinition.setMaxOccurs(1);
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((frameworkAttributeName == null) ? 0 : frameworkAttributeName.hashCode()); result = prime * result + ((nativeAttributeName == null) ? 0 : nativeAttributeName.hashCode()); result = prime * result + ((returnedByDefault == null) ? 0 : returnedByDefault.hashCode()); return result; }
@Override public boolean canBeDefinitionOf(PrismValue pvalue) { if (pvalue == null) { return false; } if (!(pvalue instanceof PrismPropertyValue<?>)) { return false; } Itemable parent = pvalue.getParent(); if (parent != null) { if (!(parent instanceof PrismProperty<?>)) { return false; } return canBeDefinitionOf((PrismProperty)parent); } else { // TODO: maybe look actual value java type? return true; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ResourceAttributeDefinitionImpl other = (ResourceAttributeDefinitionImpl) obj; if (frameworkAttributeName == null) { if (other.frameworkAttributeName != null) return false; } else if (!frameworkAttributeName.equals(other.frameworkAttributeName)) return false; if (nativeAttributeName == null) { if (other.nativeAttributeName != null) return false; } else if (!nativeAttributeName.equals(other.nativeAttributeName)) return false; if (returnedByDefault == null) { if (other.returnedByDefault != null) return false; } else if (!returnedByDefault.equals(other.returnedByDefault)) return false; return true; }
protected void extendToString(StringBuilder sb) { super.extendToString(sb); if (getNativeAttributeName()!=null) { sb.append(" native="); sb.append(getNativeAttributeName()); } if (getFrameworkAttributeName()!=null) { sb.append(" framework="); sb.append(getFrameworkAttributeName()); } if (returnedByDefault != null) { sb.append(" returnedByDefault="); sb.append(returnedByDefault); } }
PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(itemName, typeName, prismContext); Integer maxOccurs = node.getMaxOccurs(); if (maxOccurs != null) { propDef.setMaxOccurs(maxOccurs); } else { propDef.setMaxOccurs(-1); propDef.setDynamic(true); return propDef;
/** * Creates new instance of property definition and adds it to the container. * <p> * This is the preferred method of creating a new definition. * * @param name name of the property (element name) * @param typeName XSD type of the property * @param minOccurs minimal number of occurrences * @param maxOccurs maximal number of occurrences (-1 means unbounded) * @return created property definition */ public MutablePrismPropertyDefinition<?> createPropertyDefinition(QName name, QName typeName, int minOccurs, int maxOccurs) { PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(name, typeName, prismContext); propDef.setMinOccurs(minOccurs); propDef.setMaxOccurs(maxOccurs); addDefinition(propDef); return propDef; }
public <T> MutablePrismPropertyDefinition<T> createPropertyDefinition(QName elementName, QName typeName, ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, XSAnnotation annotation, XSParticle elementParticle, Collection<? extends DisplayableValue<T>> allowedValues, T defaultValue) throws SchemaException { return new PrismPropertyDefinitionImpl<>(elementName, typeName, prismContext, allowedValues, defaultValue); }
@SuppressWarnings("unchecked") Item<?, ?> parseItem(@NotNull RootXNodeImpl root, ItemDefinition<?> itemDefinition, QName itemName, QName typeName, Class<?> typeClass, @NotNull ParsingContext pc) throws SchemaException { ItemInfo itemInfo = ItemInfo.determine(itemDefinition, root.getRootElementName(), itemName, ARTIFICIAL_OBJECT_NAME, root.getTypeQName(), typeName, typeClass, ItemDefinition.class, pc, getSchemaRegistry()); ItemDefinition realDefinition; if (itemInfo.getItemDefinition() == null && itemInfo.getComplexTypeDefinition() != null) { // let's create container definition dynamically QName actualTypeName = itemInfo.getComplexTypeDefinition().getTypeName(); if (getSchemaRegistry().isContainer(actualTypeName)) { // TODO what about objects? PrismContainerDefinitionImpl def = new PrismContainerDefinitionImpl(itemInfo.getItemName(), itemInfo.getComplexTypeDefinition(), prismContext); def.setDynamic(true); realDefinition = def; } else { PrismPropertyDefinitionImpl def = new PrismPropertyDefinitionImpl(itemInfo.getItemName(), actualTypeName, prismContext); def.setDynamic(true); realDefinition = def; } } else { realDefinition = itemInfo.getItemDefinition(); } return parseItemInternal(root.getSubnode(), itemInfo.getItemName(), realDefinition, pc); }
return null; PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(elementName, typeName, prismContext); propDef.setMaxOccurs(maxOccurs); propDef.setDynamic(true); return propDef;
@Override public <T> MutablePrismPropertyDefinition<T> createPropertyDefinition(QName name, QName typeName) { return new PrismPropertyDefinitionImpl<>(name, typeName, prismContext); }
public <T> PrismPropertyDefinition<T> createPropertyDefinition(QName elementName, QName typeName, ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, XSAnnotation annotation, XSParticle elementParticle) throws SchemaException { return new PrismPropertyDefinitionImpl<>(elementName, typeName, prismContext); }
public PrismPropertyDefinitionImpl createPropertyDefinition(QName name, QName typeName) { PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(name, typeName, prismContext); itemDefinitions.add(propDef); return propDef; }