class DomainSchemaHelper {

    public static String getDataIslandPathFromElement(PresentationSingleElement element, List<ResourceElement> clientResources){
        // data island ID is based on particular item resource path.
        String result = null;
        if(element != null && element.getResourcePath() != null){
            final String resourcePath = element.getResourcePath();
            final String firstLevelResourcePath = resourcePath.substring(0, resourcePath.indexOf("."));
            if(findResourceElement(firstLevelResourcePath, clientResources) instanceof JoinResourceGroupElement){
                // this is an item from join tree. Use join group path as data island ID then
                result = firstLevelResourcePath;
            } else {
                // it's an item from not joined table. Use table path as data island ID in this case.
                result = resourcePath.substring(0, resourcePath.lastIndexOf("."));
            }
        }
        return result;
    }

}