{
modelProperties.put(PROPERTY_ATTRIBUTE_NAME, props.get(0));
}
else if (props.size() > 1)
{
throw new IdentityException(
"Ambiguous attribute name property in class " +
attributeClass.getName());
}
else
{
Property<Object> prop = findNamedProperty(attributeClass,
"attributeName", "name");
if (prop != null) modelProperties.put(PROPERTY_ATTRIBUTE_NAME, prop);
}
props = PropertyQueries.createQuery(attributeClass)
.addCriteria(new PropertyTypeCriteria(PropertyType.VALUE))
.getResultList();
if (props.size() == 1)
{
modelProperties.put(PROPERTY_ATTRIBUTE_VALUE, props.get(0));
}
else if (props.size() > 1)
{
throw new IdentityException(
"Ambiguous attribute value property in class " +
attributeClass.getName());
}
else
{
Property<Object> prop = findNamedProperty(attributeClass,
"attributeValue", "value");
if (prop != null) modelProperties.put(PROPERTY_ATTRIBUTE_VALUE, prop);
}
props = PropertyQueries.createQuery(attributeClass)
.addCriteria(new TypedPropertyCriteria(identityClass))
.getResultList();
if (props.size() == 1)
{
modelProperties.put(PROPERTY_ATTRIBUTE_IDENTITY, props.get(0));
}
else if (props.size() > 1)
{
throw new IdentityException(
"Ambiguous identity property in attribute class " +
attributeClass.getName());
}
else
{
throw new IdentityException("Error initializing JpaIdentityStore - " +
"no attribute identity property found.");
}
props = PropertyQueries.createQuery(attributeClass)
.addCriteria(new PropertyTypeCriteria(PropertyType.TYPE))
.getResultList();
if (props.size() == 1)
{
modelProperties.put(PROPERTY_ATTRIBUTE_TYPE, props.get(0));
}
else if (props.size() > 1)
{
throw new IdentityException(
"Ambiguous attribute type property in class " +
attributeClass.getName());
}
}