private static Map collectProperties()

in neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/remote/common/dialect/impl/RemoteNeo4jTupleAssociationSnapshot.java [48:86]


	private static Map<String, Object> collectProperties(RemoteNeo4jAssociationPropertiesRow row, AssociationKey associationKey,
			AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {

		Map<String, Object> properties = new HashMap<String, Object>();
		String[] rowKeyColumnNames = associationKey.getMetadata().getRowKeyColumnNames();

		Map<String, Object> relationship = row.getRelationship();
		Map<String, Object> ownerNode = row.getOwnerNode();
		Map<String, Object> targetNode = row.getTargetNode();

		// Index columns
		for ( int i = 0; i < rowKeyColumnNames.length; i++ ) {
			if ( relationship.containsKey( rowKeyColumnNames[i] ) ) {
				properties.put( rowKeyColumnNames[i], relationship.get( rowKeyColumnNames[i] ) );
			}
		}

		// Properties stored in the target side of the association
		for ( String associationColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) {
			String targetColumnName = associatedEntityKeyMetadata.getCorrespondingEntityKeyColumn( associationColumn );
			if ( isPartOfEmbedded( targetColumnName ) ) {
				fetchEmbeddedProperties( associationKey, properties, targetNode, associationColumn, targetColumnName );
			}
			else {
				if ( targetNode.containsKey( targetColumnName ) ) {
					properties.put( associationColumn, targetNode.get( targetColumnName ) );
				}
			}
		}

		// Property stored in the owner side of the association
		for ( int i = 0; i < associationKey.getColumnNames().length; i++ ) {
			String key = associationKey.getEntityKey().getColumnNames()[i];
			if ( ownerNode.containsKey( key ) ) {
				properties.put( associationKey.getColumnNames()[i], ownerNode.get( key ) );
			}
		}
		return properties;
	}