

package tools.xor.util;

import tools.xor.BusinessObject;
import tools.xor.EntityKey;


/**
 * Defines the interface of obtaining the appropriate EntityKey for the EntityType.
 * 
 * Some Types define entity uniqueness based on a surrogate key.
 * Whereas other types define entity uniqueness based on the user key.
 * So both SurrogateKeyStrategy and UserKeyStrategy implementations are provided. Each
 * returning a SurrogateEntityKey and a UserEntityKey respectively.
 * 
 * This interface allows the user to also any custom entity key behavior in the future.
 * 
 * @author family
 *
 */
public interface EntityKeyStrategy {

	/**
	 * Obtain the EntityKey for a BusinessObject. This method is only applicable for a BusinessObject wrapping an entity
	 * and not a BusinessObject wrapping a collection instance.
	 *  
	 * @param bo the BusinessObject for which the EntityKey needs to be derived
	 * @param domainEntityName the domain EntityType name for this business object under which it is registered
	 * @param anchor state tree path that determines the shape that we are interested in
	 * @return EntityKey.
	 */
	public EntityKey execute(BusinessObject bo, String domainEntityName, String anchor);
}
