public void addDeclaredProperty(Property p) { //Do not add duplicate properties //TODO is it efficient enough? String name = p.getName(); Iterator it = declaredProperties.iterator(); while (it.hasNext()) { if ( name.equals( ((Property)it.next()).getName() ) ) { return; } } declaredProperties.add(p); }
@SuppressWarnings("unchecked") private void createPropertiesGroupMapping(Property property) { final Component component = (Component) property.getValue(); final Iterator<Property> componentProperties = component.getPropertyIterator(); while ( componentProperties.hasNext() ) { final Property componentProperty = componentProperties.next(); propertiesGroupMapping.put( componentProperty.getName(), property.getName() ); } }
private boolean checkPropertiesAudited(Iterator<Property> properties, ClassAuditingData auditingData) { while ( properties.hasNext() ) { final Property property = properties.next(); final String propertyName = property.getName(); final PropertyAuditingData propertyAuditingData = auditingData.getPropertyAuditingData( propertyName ); if ( propertyAuditingData == null ) { return false; } } return true; }
private void checkPropertyDuplication() throws MappingException { HashSet<String> names = new HashSet<>(); Iterator iter = getPropertyIterator(); while ( iter.hasNext() ) { Property prop = (Property) iter.next(); if ( !names.add( prop.getName() ) ) { throw new MappingException( "Duplicate property mapping of " + prop.getName() + " found in " + getEntityName() ); } } }
public Property getProperty(String propertyName) throws MappingException { Iterator iter = getPropertyIterator(); while ( iter.hasNext() ) { Property prop = (Property) iter.next(); if ( prop.getName().equals(propertyName) ) { return prop; } } throw new MappingException("component property not found: " + propertyName); }
private Property getProperty(String propertyName, Iterator iterator) throws MappingException { if ( iterator.hasNext() ) { String root = StringHelper.root( propertyName ); while ( iterator.hasNext() ) { Property prop = (Property) iterator.next(); if ( prop.getName().equals( root ) ) { return prop; } } } throw new MappingException( "property [" + propertyName + "] not found on entity [" + getEntityName() + "]" ); }
private PropertyAuditingData getIdPersistentPropertyAuditingData(Property property) { return new PropertyAuditingData( property.getName(), property.getPropertyAccessorName(), ModificationStore.FULL, RelationTargetAuditMode.AUDITED, null, null, false ); }
private void readPersistentPropertiesAccess() { final Iterator<Property> propertyIter = persistentPropertiesSource.getPropertyIterator(); while ( propertyIter.hasNext() ) { final Property property = propertyIter.next(); addPersistentProperty( property ); // See HHH-6636 if ( "embedded".equals( property.getPropertyAccessorName() ) && !PropertyPath.IDENTIFIER_MAPPER_PROPERTY.equals( property.getName() ) ) { createPropertiesGroupMapping( property ); } } }
private PropertyAccess buildPropertyAccess(Property mappedProperty) { if ( mappedProperty.isBackRef() ) { return mappedProperty.getPropertyAccessStrategy( null ).buildPropertyAccess( null, mappedProperty.getName() ); } else { return PropertyAccessStrategyMapImpl.INSTANCE.buildPropertyAccess( null, mappedProperty.getName() ); } }
protected Setter buildSetter(Component component, Property prop) { return PropertyAccessStrategyMapImpl.INSTANCE.buildPropertyAccess( null, prop.getName() ).getSetter(); }
@Override public String getIdentifierPropertyName(String entityName) throws MappingException { final PersistentClass pc = entityBindingMap.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } if ( !pc.hasIdentifierProperty() ) { return null; } return pc.getIdentifierProperty().getName(); }
@Override public String getIdentifierPropertyName(String entityName) throws MappingException { final PersistentClass pc = entityBindingMap.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } if ( !pc.hasIdentifierProperty() ) { return null; } return pc.getIdentifierProperty().getName(); }
private Setter injector(Property property, Class attributeDeclarer) { return property.getPropertyAccessStrategy( attributeDeclarer ) .buildPropertyAccess( attributeDeclarer, property.getName() ) .getSetter(); }
public static Set<String> extractModProperties(PersistentClass persistentClass, String suffix) { final Set<String> result = new HashSet<String>(); final Iterator iterator = persistentClass.getPropertyIterator(); while ( iterator.hasNext() ) { final Property property = (Property) iterator.next(); final String propertyName = property.getName(); if ( propertyName.endsWith( suffix ) ) { result.add( propertyName ); } } return result; }
public Property getProperty(String propertyName) throws MappingException { Iterator iter = getPropertyClosureIterator(); Property identifierProperty = getIdentifierProperty(); if ( identifierProperty != null && identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) { return identifierProperty; } else { return getProperty( propertyName, iter ); } }
@Test public void testMapping() { PersistentClass pc = metadata().getEntityBinding( UnversionedOptimisticLockingFieldEntity.class.getName() + "_AUD" ); Iterator pi = pc.getPropertyIterator(); while ( pi.hasNext() ) { Property p = (Property) pi.next(); assert !"optLocking".equals( p.getName() ); } } }
protected AbstractPluralAttribute(PluralAttributeBuilder<D,C,E,?> builder) { super( builder.getDeclaringType(), builder.getProperty().getName(), builder.getAttributeNature(), builder.getValueType(), builder.getMember() ); this.collectionClass = builder.getCollectionClass(); }
@Override public Member resolveMember(AttributeContext attributeContext) { final EmbeddedTypeDescriptor embeddableType = (EmbeddedTypeDescriptor<?>) attributeContext.getOwnerType(); final String attributeName = attributeContext.getPropertyMapping().getName(); final Getter getter = embeddableType.getHibernateType() .getComponentTuplizer() .getGetter( embeddableType.getHibernateType().getPropertyIndex( attributeName ) ); return PropertyAccessMapImpl.GetterImpl.class.isInstance( getter ) ? new MapMember( attributeName, attributeContext.getPropertyMapping().getType().getReturnedClass() ) : getter.getMember(); } };